|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.synapse.commons.executors.PriorityExecutor
public class PriorityExecutor
This is the class used for executing the tasks with a given priority. It is backed by a BlockingQueue and a ThreadPoolExecutor. The BlockingQueue is a custom implementation which has multiple internal queues for handling separate priorities.
Constructor Summary | |
---|---|
PriorityExecutor()
|
Method Summary | |
---|---|
void |
destroy()
Destroy the executor. |
void |
execute(Runnable task,
int priority)
Execute a given task with the priority specified. |
BeforeExecuteHandler |
getBeforeExecuteHandler()
Get the handler that is executed before the worker is put in to the queue |
int |
getCore()
Get the core number of threads |
String |
getFileName()
Get the file used to store this executor config |
int |
getKeepAlive()
Get the keep alive time for threads |
int |
getMax()
Get the max threads |
String |
getName()
Get the name of the executor |
MultiPriorityBlockingQueue<Runnable> |
getQueue()
Get the queue. |
void |
init()
Initialize the executor by using the properties. |
void |
setBeforeExecuteHandler(BeforeExecuteHandler beforeExecuteHandler)
Set a handler for execute before putting a worker in to the queues. |
void |
setCore(int core)
Set the core number of threads |
void |
setFileName(String fileName)
Set the file used to store the config |
void |
setKeepAlive(int keepAlive)
Set the keep alive time for threads |
void |
setMax(int max)
Set the max number of threads |
void |
setName(String name)
Set the name of the executor |
void |
setQueue(MultiPriorityBlockingQueue<Runnable> queue)
Set the queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PriorityExecutor()
Method Detail |
---|
public void execute(Runnable task, int priority)
task
- task to be executedpriority
- priority of the taskpublic void init()
public void destroy()
public void setName(String name)
name
- of the executorpublic String getName()
public void setBeforeExecuteHandler(BeforeExecuteHandler beforeExecuteHandler)
beforeExecuteHandler
- an object implementing the BeforeExecuteHandlerpublic BeforeExecuteHandler getBeforeExecuteHandler()
public void setQueue(MultiPriorityBlockingQueue<Runnable> queue)
queue
- queue used for handling the prioritiespublic MultiPriorityBlockingQueue<Runnable> getQueue()
public int getCore()
public int getMax()
public int getKeepAlive()
public void setCore(int core)
core
- core number of threadspublic void setMax(int max)
max
- max threadspublic void setKeepAlive(int keepAlive)
keepAlive
- keep alive threadspublic String getFileName()
public void setFileName(String fileName)
fileName
- file name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |