Java Doc for AbstractTask.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » loadbalancer » tasks » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.loadbalancer.tasks 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.loadbalancer.tasks.AbstractTask

All known Subclasses:   org.continuent.sequoia.controller.loadbalancer.tasks.OpenPersistentConnectionTask,  org.continuent.sequoia.controller.loadbalancer.tasks.ClosePersistentConnectionTask,  org.continuent.sequoia.controller.loadbalancer.tasks.StatementExecuteTask,  org.continuent.sequoia.controller.loadbalancer.tasks.CallableStatementExecuteUpdateTask,  org.continuent.sequoia.controller.loadbalancer.tasks.CommitTask,  org.continuent.sequoia.controller.loadbalancer.tasks.RollbackToSavepointTask,  org.continuent.sequoia.controller.loadbalancer.tasks.CallableStatementExecuteTask,  org.continuent.sequoia.controller.loadbalancer.tasks.RollbackTask,  org.continuent.sequoia.controller.loadbalancer.tasks.ReleaseSavepointTask,  org.continuent.sequoia.controller.loadbalancer.tasks.StatementExecuteUpdateWithKeysTask,  org.continuent.sequoia.controller.loadbalancer.tasks.StatementExecuteQueryTask,  org.continuent.sequoia.controller.loadbalancer.tasks.SavepointTask,  org.continuent.sequoia.controller.loadbalancer.tasks.BeginTask,  org.continuent.sequoia.controller.loadbalancer.tasks.KillThreadTask,  org.continuent.sequoia.controller.loadbalancer.tasks.StatementExecuteUpdateTask,  org.continuent.sequoia.controller.loadbalancer.tasks.CallableStatementExecuteQueryTask,
AbstractTask
abstract public class AbstractTask (Code)
Defines an abstract task to be processed by a BackendWorkerThread.
author:
   Emmanuel Cecchet
author:
   Jaco Swart
version:
   1.0



Constructor Summary
public  AbstractTask(int nbToComplete, int totalNb, boolean isPersistentConnection, long persistentConnectionId)
     Sets the number of threads among the total number of threads that must successfully complete the execution of this AbstractTask before returning.

Method Summary
public  voidexecute(BackendWorkerThread backendThread)
     The task code executed by the backendThread.
abstract public  voidexecuteTask(BackendWorkerThread backendThread)
     The implementation specific task code to be executed by backendThread.
public  ListgetExceptions()
     Returns the exceptions lists.
public synchronized  intgetExecutionStarted()
     Returns the number of threads that have started the execution of the task.
public  intgetFailed()
     Returns the failed.
public  ResultSetgetGeneratedKeysResultSet()
     Returns the generatedKeysResultSet value.
public  ListgetLocks(DatabaseBackend backend)
     Returns the locksMap taken by this task for a given backend.
public  intgetNbToComplete()
     Returns the number of threads that must succeed before returning.
final public  longgetPersistentConnectionId()
     Returns the persistentConnectionId value.
abstract public  AbstractRequestgetRequest()
     Return the request associated with this task if any, returns null otherwise.
public  intgetSuccess()
     Returns the success.
public  intgetTotalNb()
     Returns the total number of threads.
abstract public  longgetTransactionId()
     Returns the transaction identifier of this task if any (isAutoCommit returns false).
public synchronized  booleanhasCompleted()
     Returns true if the task has been sucessfully completed by nbToComplete nodes (set in the constructor) of if everyone has completed (successfully or not), false otherwise.
public synchronized  booleanhasFullyCompleted()
     Returns true if the task has completed (successfully or not) or false if we are still expecting answers from some backends.
abstract public  booleanisAutoCommit()
     Returns true if this task is in autocommit mode, false if it is in a transaction.
final public  booleanisPersistentConnection()
     Returns the persistentConnection value.
public synchronized  voidnotifyCompletion(BackendWorkerThread backendThread)
     This is used to notify the completion of this task without success or failure.
public synchronized  booleannotifyFailure(BackendWorkerThread backendThread, long timeout, Throwable e)
     Notifies that the specified backendThread failed to execute this task.
public synchronized  voidnotifySuccess(BackendWorkerThread backendThread)
     Notifies the successful completion of this task.
public synchronized  intnotifySuccess(BackendWorkerThread backendThread, int result)
     Notifies the successful completion of this task and provide the resultOnFirstBackendToSucceed for checking.
public synchronized  booleansetExpiredTimeout()
     Set the flag to tell that the timeout has expired on this task.
public  voidsetGeneratedKeysResultSet(ResultSet generatedKeysResultSet)
     Sets the generatedKeysResultSet value.
public synchronized  voidsetLocks(DatabaseBackend backend, List locks)
     Sets the locksMap taken by this task for a given backend (ignored if the locksMap were already set once).
final public  voidsetPersistentConnection(boolean persistentConnection)
     Sets the persistentConnection value.
final public  voidsetPersistentConnectionId(long persistentConnectionId)
     Sets the persistentConnectionId value.
public  voidsetTotalNb(int totalNb)
     Sets the total number of threads.


Constructor Detail
AbstractTask
public AbstractTask(int nbToComplete, int totalNb, boolean isPersistentConnection, long persistentConnectionId)(Code)
Sets the number of threads among the total number of threads that must successfully complete the execution of this AbstractTask before returning.
Parameters:
  nbToComplete - number of threads that must succeed before returning
Parameters:
  totalNb - total number of threads
Parameters:
  isPersistentConnection - true if this task executes on a persistentconnection
Parameters:
  persistentConnectionId - persistent connection id ifpersistentConnection is true




Method Detail
execute
public void execute(BackendWorkerThread backendThread) throws SQLException(Code)
The task code executed by the backendThread.
Parameters:
  backendThread - The backend thread executing this task
throws:
  SQLException - if an error occurs



executeTask
abstract public void executeTask(BackendWorkerThread backendThread) throws SQLException(Code)
The implementation specific task code to be executed by backendThread.
Parameters:
  backendThread - The backend thread executing this task
throws:
  SQLException - if an error occurs



getExceptions
public List getExceptions()(Code)
Returns the exceptions lists. an List



getExecutionStarted
public synchronized int getExecutionStarted()(Code)
Returns the number of threads that have started the execution of the task. Returns the number of started executions.



getFailed
public int getFailed()(Code)
Returns the failed. an int value



getGeneratedKeysResultSet
public ResultSet getGeneratedKeysResultSet()(Code)
Returns the generatedKeysResultSet value. Returns the generatedKeysResultSet.



getLocks
public List getLocks(DatabaseBackend backend)(Code)
Returns the locksMap taken by this task for a given backend.
Parameters:
  backend - backend for which to get the locksMap Returns the locksMap.



getNbToComplete
public int getNbToComplete()(Code)
Returns the number of threads that must succeed before returning. an int value



getPersistentConnectionId
final public long getPersistentConnectionId()(Code)
Returns the persistentConnectionId value. Returns the persistentConnectionId.



getRequest
abstract public AbstractRequest getRequest()(Code)
Return the request associated with this task if any, returns null otherwise. the request associated with this task or null



getSuccess
public int getSuccess()(Code)
Returns the success. an int value



getTotalNb
public int getTotalNb()(Code)
Returns the total number of threads. an int value
See Also:   AbstractTask.setTotalNb



getTransactionId
abstract public long getTransactionId()(Code)
Returns the transaction identifier of this task if any (isAutoCommit returns false). Returns the transaction identifier.



hasCompleted
public synchronized boolean hasCompleted()(Code)
Returns true if the task has been sucessfully completed by nbToComplete nodes (set in the constructor) of if everyone has completed (successfully or not), false otherwise. true if the task execution is complete
See Also:   AbstractTask.AbstractTask(intint)



hasFullyCompleted
public synchronized boolean hasFullyCompleted()(Code)
Returns true if the task has completed (successfully or not) or false if we are still expecting answers from some backends. true if the task execution is complete



isAutoCommit
abstract public boolean isAutoCommit()(Code)
Returns true if this task is in autocommit mode, false if it is in a transaction. Returns true if task must be executed in autoCommit mode.
See Also:   AbstractTask.getTransactionId()



isPersistentConnection
final public boolean isPersistentConnection()(Code)
Returns the persistentConnection value. Returns the persistentConnection.



notifyCompletion
public synchronized void notifyCompletion(BackendWorkerThread backendThread)(Code)
This is used to notify the completion of this task without success or failure. This is usually used when the task has been discarded for example by a backend that is currently disabling but still needs to execute the remaining queries in open transactions.

Therefore, this only decrements by one the number of threads that needs to complete.
Parameters:
  backendThread - The backend worker thread notifying this task (null incase this task is cancelled before being processed by a workerthread)




notifyFailure
public synchronized boolean notifyFailure(BackendWorkerThread backendThread, long timeout, Throwable e) throws SQLException(Code)
Notifies that the specified backendThread failed to execute this task. If all nodes failed, this method return 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.
Parameters:
  backendThread - The backend thread notifying this task
Parameters:
  timeout - time in milliseconds to wait for other threads to signalsuccess or failure (use -1 if you don't want to wait)
Parameters:
  e - the exception causing the failure true if at least one node succeeded to execute thistask, false if all threads failed
throws:
  SQLException - if an error occured in the notification process



notifySuccess
public synchronized void notifySuccess(BackendWorkerThread backendThread)(Code)
Notifies the successful completion of this task.
Parameters:
  backendThread - The backend thread notifying this task



notifySuccess
public synchronized int notifySuccess(BackendWorkerThread backendThread, int result)(Code)
Notifies the successful completion of this task and provide the resultOnFirstBackendToSucceed for checking.
Parameters:
  backendThread - The backend thread notifying this task
Parameters:
  result - the result of the query on the backend that notify thesuccess the result returned by the query on the first backend whichsucceeded



setExpiredTimeout
public synchronized boolean setExpiredTimeout()(Code)
Set the flag to tell that the timeout has expired on this task. If no backend has started the task execution then the task will be canceled and the method will return true. Otherwise, all backends will execute the request and the method will return false. true if BackendThreads will ignore the task, false if all backendswill execute the task.



setGeneratedKeysResultSet
public void setGeneratedKeysResultSet(ResultSet generatedKeysResultSet)(Code)
Sets the generatedKeysResultSet value.
Parameters:
  generatedKeysResultSet - The generatedKeysResultSet to set.



setLocks
public synchronized void setLocks(DatabaseBackend backend, List locks)(Code)
Sets the locksMap taken by this task for a given backend (ignored if the locksMap were already set once).
Parameters:
  backend - backend for which to set the locksMap
Parameters:
  locks - The locks map taken.



setPersistentConnection
final public void setPersistentConnection(boolean persistentConnection)(Code)
Sets the persistentConnection value.
Parameters:
  persistentConnection - The persistentConnection to set.



setPersistentConnectionId
final public void setPersistentConnectionId(long persistentConnectionId)(Code)
Sets the persistentConnectionId value.
Parameters:
  persistentConnectionId - The persistentConnectionId to set.



setTotalNb
public void setTotalNb(int totalNb)(Code)
Sets the total number of threads.
Parameters:
  totalNb - the total number of threads to set
See Also:   AbstractTask.getTotalNb



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.