Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.virtualdatabase.protocol.Commit Class Reference

List of all members.

Public Member Functions

 Commit (long transactionId)
Object commit (DistributedRequestManager drm) throws SQLException

Detailed Description

Execute a distributed commit.

Author:
Emmanuel Cecchet
Version:
1.0

Definition at line 43 of file Commit.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.virtualdatabase.protocol.Commit.Commit long  transactionId  ) 
 

Creates a new Commit message.

Parameters:
transactionId id of the transaction to commit

Definition at line 53 of file Commit.java.

00054   {
00055     this.transactionId = transactionId;
00056   }


Member Function Documentation

Object org.objectweb.cjdbc.controller.virtualdatabase.protocol.Commit.commit DistributedRequestManager  drm  )  throws SQLException
 

Execution of a distributed commit command on the specified DistributedRequestManager

Parameters:
drm the DistributedRequestManager that will execute the commit
Returns:
Boolean.TRUE if everything went fine or a SQLException if an error occured
Exceptions:
SQLException if an error occurs

Definition at line 67 of file Commit.java.

References org.objectweb.cjdbc.common.sql.AbstractRequest.debug(), org.objectweb.cjdbc.controller.requestmanager.TransactionMarkerMetaData.getTransactionId(), and org.objectweb.cjdbc.common.sql.AbstractRequest.setTransactionId().

00068   {
00069     try
00070     {
00071       Long tid = new Long(transactionId);
00072       TransactionMarkerMetaData tm = drm.getTransactionMarker(tid);
00073 
00074       // Wait for the scheduler to give us the authorization to execute
00075       drm.getScheduler().commit(tm);
00076 
00077       if (drm.getLogger().isDebugEnabled())
00078         drm.getLogger().debug(Translate.get("transaction.commit", "" + tid));
00079 
00080       try
00081       {
00082         // Send to load balancer
00083         drm.getLoadBalancer().commit(tm);
00084 
00085         // Notify the cache
00086         if (drm.getResultCache() != null)
00087           drm.getResultCache().commit(tm.getTransactionId());
00088 
00089         // Notify the recovery log manager
00090         if (drm.getRecoveryLog() != null)
00091           drm.getRecoveryLog().commit(tm);
00092       }
00093       catch (SQLException e)
00094       {
00095         return e;
00096       }
00097       catch (AllBackendsFailedException e)
00098       {
00099         AbstractRequest request = new UnknownRequest("commit", false, 0, "\n");
00100         request.setTransactionId(transactionId);
00101         drm.addFailedOnAllBackends(request);
00102         if (drm.getLogger().isDebugEnabled())
00103           drm
00104               .getLogger()
00105               .debug(
00106                   Translate
00107                       .get(
00108                           "virtualdatabase.distributed.commit.all.backends.locally.failed",
00109                           transactionId));
00110         return e;
00111       }
00112       finally
00113       {
00114         // Notify scheduler for completion
00115         drm.getScheduler().commitCompleted(transactionId);
00116         drm.completeTransaction(tid);
00117       }
00118       return Boolean.TRUE;
00119     }
00120     catch (SQLException e)
00121     {
00122       drm.getLogger().warn(
00123           Translate.get("virtualdatabase.distributed.commit.sqlexception"), e);
00124       throw e;
00125     }
00126     catch (RuntimeException re)
00127     {
00128       drm.getLogger().warn(
00129           Translate.get("virtualdatabase.distributed.commit.exception"), re);
00130       throw new SQLException(re.getMessage());
00131     }
00132   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:04:47 2005 for C-JDBC by  doxygen 1.3.9.1