|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.objectweb.cjdbc.controller.loadbalancer.BackendWorkerThread
Process sequentially a set of tasks and send them to a backend.
Field Summary | |
private DatabaseBackend |
backend
|
private boolean |
currentlyProcessing
|
private boolean |
isKilled
|
private AbstractLoadBalancer |
loadBalancer
|
private Trace |
logger
|
private java.util.ArrayList |
taskList
|
private java.util.ArrayList |
tidList
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
BackendWorkerThread(DatabaseBackend backend,
AbstractLoadBalancer loadBalancer)
Creates a new BackendWorkerThread . |
Method Summary | |
void |
addPriorityTask(AbstractTask task)
Adds a task upfront to the task list so that this task will be the next executed task. |
void |
addPriorityTask(AbstractTask task,
int transactionId)
Adds a task upfront to the task list so that this task will be the next executed task. |
void |
addTask(AbstractTask task)
Adds a task at the end of the task list. |
void |
addTask(AbstractTask task,
int transactionId)
Adds a task at the end of the task list. |
DatabaseBackend |
getBackend()
Returns the backend. |
Trace |
getLogger()
Returns the logger for tracing. |
void |
kill()
Kills this thread after the next task processing. |
boolean |
removeTask(AbstractTask task)
Removes a task from the task list if it has not been already executed. |
void |
run()
Process the tasklist and call wait() (on itself) when the
tasklist becomes empty. |
void |
waitForAllTasksToComplete()
Waits for all current tasks to complete. |
void |
waitForAllTasksToComplete(int transactionId)
Waits for all tasks of the specified transaction to complete. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private AbstractLoadBalancer loadBalancer
private DatabaseBackend backend
private java.util.ArrayList taskList
private java.util.ArrayList tidList
private boolean isKilled
private boolean currentlyProcessing
private Trace logger
Constructor Detail |
public BackendWorkerThread(DatabaseBackend backend, AbstractLoadBalancer loadBalancer) throws java.sql.SQLException
BackendWorkerThread
.
backend
- the backend this thread is associated to.loadBalancer
- the load balancer instanciating this thread
java.sql.SQLException
- if an error occursMethod Detail |
public void addTask(AbstractTask task)
task
- the task to addpublic void addTask(AbstractTask task, int transactionId)
task
- the task to addtransactionId
- transaction id in which this task executepublic void addPriorityTask(AbstractTask task)
task
- the task to addpublic void addPriorityTask(AbstractTask task, int transactionId)
task
- the task to addtransactionId
- transaction id in which this task executepublic boolean removeTask(AbstractTask task)
task
- the task to add
true
if the task has been removes or
false
if the task does not exist.public void waitForAllTasksToComplete(int transactionId)
transactionId
- the transaction identifierpublic void waitForAllTasksToComplete()
public void kill()
public void run()
wait()
(on itself) when the
tasklist becomes empty.
public DatabaseBackend getBackend()
DatabaseBackend
instancepublic Trace getLogger()
Trace
instance
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |