Package com.swiftmq.swiftlet.threadpool
Interface AsyncTask
-
- All Superinterfaces:
java.lang.Runnable
- All Known Implementing Classes:
MessageProcessor
public interface AsyncTask extends java.lang.RunnableAn asynchronous task to run in a thread pool.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetDescription()Returns a short description of this task.java.lang.StringgetDispatchToken()Returns the dispatch token of the task.booleanisValid()Returns whether the task is valid.voidrun()Implements the task logic.voidstop()Stops this task.
-
-
-
Method Detail
-
isValid
boolean isValid()
Returns whether the task is valid. This is application dependent. As long as a task stays in the thread pool queue, this state can change. If the task is going to execute, it will be checked whether the task is valid. If not, the task isn't executed anymore. For example, if a task depends on a connection and the connection closes before the task is executed, this method should return false which leads to drop the task out of the pool without executing it.- Returns:
- true/false.
-
getDispatchToken
java.lang.String getDispatchToken()
Returns the dispatch token of the task. The dispatch token is the thread name, used for thread assignment in the router's configuration file. It is used to determine the pool by invokingdispatchTaskof the ThreadpoolSwiftlet directly to determine the pool.- Returns:
- dispatch token.
-
getDescription
java.lang.String getDescription()
Returns a short description of this task. Used for trace outputs.- Returns:
- description.
-
run
void run()
Implements the task logic. This method will be called when a task is executed from a pool thread.- Specified by:
runin interfacejava.lang.Runnable
-
stop
void stop()
Stops this task. This method doesn't stop the task's execution. It is implementation dependent in which state the task will turn. In most cases, the task does some clean up and returns 'false' onisValid()to avoid execution.
-
-