|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask
Defines an abstract task to be processed by a BackendWorkerThread.
| Field Summary | |
private java.util.ArrayList |
exceptions
|
private int |
failed
|
private int |
nbToComplete
Number of threads that must succeed before returning. |
private int |
success
|
private int |
totalNb
Total number of threads. |
| Constructor Summary | |
AbstractTask(int nbToComplete,
int totalNb)
Sets the number of threads among the total number of threads that must successfully complete the execution of this AbstractTask before returning. |
|
| Method Summary | |
abstract void |
execute(BackendWorkerThread backendThread)
The task code to be executed by backendThread. |
java.util.ArrayList |
getExceptions()
Returns the exceptions lists. |
int |
getFailed()
Returns the failed. |
int |
getNbToComplete()
Returns the number of threads that must succeed before returning. |
int |
getSuccess()
Returns the success. |
int |
getTotalNb()
Returns the total number of threads. |
boolean |
notifyFailure(BackendWorkerThread backendThread,
long timeout,
java.sql.SQLException e)
Notifies that the specified backendThread failed to execute this task. |
void |
notifySuccess()
Notifies the successful completion of this task. |
void |
setTotalNb(int totalNb)
Sets the total number of threads. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int totalNb
private int nbToComplete
private int success
private int failed
private java.util.ArrayList exceptions
| Constructor Detail |
public AbstractTask(int nbToComplete,
int totalNb)
nbToComplete - number of threads that must succeed before returningtotalNb - total number of threads| Method Detail |
public abstract void execute(BackendWorkerThread backendThread)
throws java.sql.SQLException
backendThread - The backend thread executing this task
java.sql.SQLException - if an error occurspublic void notifySuccess()
public boolean notifyFailure(BackendWorkerThread backendThread,
long timeout,
java.sql.SQLException e)
throws java.sql.SQLException
false meaning that the
problem was due to the task and not to the thread. If the method returns
true, it can mean that this thread failed and is no more
coherent, therefore the backend associated to this thread should be
disabled.
backendThread - the backend thread that has failedtimeout - time in milliseconds to wait for other threads to signal
success or failuree - the exception causing the failure
true if at least one node succeeded to execute this
task, false if all threads failed
java.sql.SQLException - if an error occured in the notification
processpublic java.util.ArrayList getExceptions()
ArrayListpublic int getFailed()
int valuepublic int getNbToComplete()
int valuepublic int getSuccess()
int valuepublic int getTotalNb()
int valuesetTotalNb(int)public void setTotalNb(int totalNb)
totalNb - the total number of threads to setgetTotalNb()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||