RollbackTask.java の 41 行で定義されています。
Public メソッド | |
RollbackTask (int nbToComplete, int totalNb, long timeout, String login, long transactionId) | |
void | execute (BackendWorkerThread backendThread) throws SQLException |
String | toString () |
boolean | hasTid () |
synchronized void | notifySuccess () |
synchronized boolean | notifyFailure (BackendWorkerThread backendThread, long timeout, SQLException e) throws SQLException |
ArrayList | getExceptions () |
int | getFailed () |
int | getNbToComplete () |
int | getSuccess () |
int | getTotalNb () |
void | setTotalNb (int totalNb) |
void | setHasTid (boolean hasTid) |
Private 変数 | |
String | login |
long | transactionId |
long | timeout |
|
Rollbacks a transaction given a login and a transaction id.
RollbackTask.java の 61 行で定義されています。
00063 { 00064 super(nbToComplete, totalNb); 00065 this.login = login; 00066 this.transactionId = transactionId; 00067 this.timeout = timeout; 00068 } |
|
Rollbacks a transaction with the given backend thread.
org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTaskに実装されています. RollbackTask.java の 76 行で定義されています。 参照先 org.objectweb.cjdbc.controller.backend.DatabaseBackend.getConnectionManager(), org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.getSuccess(), org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.notifyFailure(), org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.notifySuccess(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.releaseConnection(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.retrieveConnection(), と org.objectweb.cjdbc.controller.backend.DatabaseBackend.stopTransaction().
00077 { 00078 DatabaseBackend db = backendThread.getBackend(); 00079 Long lTid = new Long(transactionId); 00080 00081 AbstractConnectionManager cm = db.getConnectionManager(login); 00082 Connection c = cm.retrieveConnection(transactionId); 00083 00084 // Sanity check 00085 if (c == null) 00086 { // Bad connection 00087 db.stopTransaction(lTid); 00088 SQLException se = new SQLException( 00089 "Unable to retrieve connection for transaction " + transactionId); 00090 try 00091 { // All backends failed, just ignore 00092 if (!notifyFailure(backendThread, timeout, se)) 00093 return; 00094 } 00095 catch (SQLException ignore) 00096 { 00097 } 00098 // Disable this backend (it is no more in sync) by killing the backend 00099 // thread 00100 backendThread.kill(); 00101 String msg = "Failed to rollback transaction " + transactionId 00102 + " on backend " + db.getName() + " but " + getSuccess() 00103 + " succeeded (" + se + ")"; 00104 backendThread.getLogger().error(msg); 00105 throw new SQLException(msg); 00106 } 00107 00108 // Execute Query 00109 try 00110 { 00111 c.rollback(); 00112 c.setAutoCommit(true); 00113 } 00114 catch (Exception e) 00115 { 00116 try 00117 { 00118 if (!notifyFailure(backendThread, timeout, new SQLException(e 00119 .getMessage()))) 00120 return; 00121 } 00122 catch (SQLException ignore) 00123 { 00124 } 00125 // Disable this backend (it is no more in sync) by killing the backend 00126 // thread 00127 backendThread.kill(); 00128 String msg = "Failed to rollback transaction " + transactionId 00129 + " on backend " + db.getName() + " but " + getSuccess() 00130 + " succeeded (" + e + ")"; 00131 backendThread.getLogger().error(msg); 00132 throw new SQLException(msg); 00133 } 00134 finally 00135 { 00136 cm.releaseConnection(transactionId); 00137 db.stopTransaction(lTid); 00138 } 00139 notifySuccess(); 00140 } |
|
Returns the exceptions lists.
AbstractTask.java の 167 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.exceptions.
00168 {
00169 return exceptions;
00170 }
|
|
|
Returns the number of threads that must succeed before returning.
AbstractTask.java の 187 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.nbToComplete.
00188 {
00189 return nbToComplete;
00190 }
|
|
|
Returns the total number of threads.
AbstractTask.java の 208 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.totalNb.
00209 {
00210 return totalNb;
00211 }
|
|
Returns true if this task has a tid attached to it. Used internally by BackendWorkerThread.
AbstractTask.java の 231 行で定義されています。
00232 { 00233 return hasTid; 00234 } |
|
Notifies that the specified backendThread failed to execute this task. If all nodes failed, this method return
AbstractTask.java の 127 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.exceptions, org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.failed, org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.success, と org.objectweb.cjdbc.controller.loadbalancer.tasks.AbstractTask.totalNb. 参照元 org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteStoredProcedureTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteRequestWithKeysTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteRequestTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.SelectRequestTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.RollbackTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.ReadStoredProcedureTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.CommitTask.execute(), org.objectweb.cjdbc.controller.loadbalancer.tasks.BeginTask.execute(), と org.objectweb.cjdbc.controller.loadbalancer.BackendWorkerThread.kill().
00129 { 00130 failed++; 00131 00132 // Log the exception 00133 if (exceptions == null) 00134 exceptions = new ArrayList(); 00135 exceptions.add(new SQLException("BackendThread " 00136 + backendThread.getBackend().getName() + " failed (" + e + ")")); 00137 00138 // Notify if needed 00139 if (success + failed == totalNb) 00140 { 00141 notifyAll(); // Notify all failed threads 00142 } 00143 else 00144 { 00145 try 00146 { // Wait to check if all other threads failed or not 00147 wait(timeout); 00148 } 00149 catch (InterruptedException ie) 00150 { 00151 throw new SQLException("Wait interrupted() in failed task of backend " 00152 + backendThread.getBackend().getName() + " (" + e + ")"); 00153 } 00154 } 00155 return success > 0; 00156 } |
|
|
Sets the hasTid value. Used internally by BackendWorkerThread.
AbstractTask.java の 243 行で定義されています。 参照元 org.objectweb.cjdbc.controller.loadbalancer.BackendWorkerThread.addPriorityTask(), と org.objectweb.cjdbc.controller.loadbalancer.BackendWorkerThread.addTask().
00244 {
00245 this.hasTid = hasTid;
00246 }
|
|
Sets the total number of threads.
AbstractTask.java の 219 行で定義されています。 参照元 org.objectweb.cjdbc.controller.loadbalancer.raidb2.RAIDb2.callStoredProcedure().
00220 {
00221 this.totalNb = totalNb;
00222 }
|
|
RollbackTask.java の 145 行で定義されています。
00146 { 00147 return "RollbackTask (" + transactionId + ")"; 00148 } |
|
Login used by the connection. RollbackTask.java の 44 行で定義されています。 |
|
Request timeout in milliseconds. RollbackTask.java の 50 行で定義されています。 |
|
Unique transaction identifier. RollbackTask.java の 47 行で定義されています。 |