[jboss-svn-commits] JBL Code SVN: r8600 - labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 29 03:23:42 EST 2006


Author: mark.little at jboss.com
Date: 2006-12-29 03:23:40 -0500 (Fri, 29 Dec 2006)
New Revision: 8600

Modified:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java
Log:
http://jira.jboss.com/jira/browse/JBTM-183

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java	2006-12-29 00:40:49 UTC (rev 8599)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java	2006-12-29 08:23:40 UTC (rev 8600)
@@ -49,141 +49,155 @@
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.BAD_OPERATION;
 
-public class ServerSynchronization extends org.omg.CosTransactions.SynchronizationPOA
+public class ServerSynchronization extends
+		org.omg.CosTransactions.SynchronizationPOA
 {
 
-public ServerSynchronization (ServerTransaction topLevel)
-    {
-	ORBManager.getPOA().objectIsReady(this);
-	
-	_theTransaction = topLevel;
-	_theSynchronization = org.omg.CosTransactions.SynchronizationHelper.narrow(ORBManager.getPOA().corbaReference(this));
-    }
+	public ServerSynchronization(ServerTransaction topLevel)
+	{
+		ORBManager.getPOA().objectIsReady(this);
 
-public void finalize ()
-    {
-	_theTransaction = null;
-	_theSynchronization = null;
-    }
- 
-public final Synchronization getSynchronization ()
-    {
-	return _theSynchronization;
-    }
- 
-    /**
-     * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.destroyfailed Failed to destroy server-side synchronization object!
-     */
+		_theTransaction = topLevel;
+		_theSynchronization = org.omg.CosTransactions.SynchronizationHelper
+				.narrow(ORBManager.getPOA().corbaReference(this));
+	}
 
-public void destroy ()
-    {
-	try
+	public void finalize()
 	{
-	    ORBManager.getPOA().shutdownObject(this);
+		_theTransaction = null;
+		_theSynchronization = null;
 	}
-	catch (Exception e)
+
+	public final Synchronization getSynchronization()
 	{
-	    if (jtsLogger.logger.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.destroyfailed");
-	    }
+		return _theSynchronization;
 	}
-    }
 
-public void before_completion () throws SystemException
-    {
-	if (_theTransaction == null)
-	    throw new BAD_OPERATION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO);
-	else
+	/**
+	 * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.destroyfailed
+	 *          Failed to destroy server-side synchronization object!
+	 */
+
+	public void destroy()
 	{
-	    _theTransaction.doBeforeCompletion();
+		try
+		{
+			ORBManager.getPOA().shutdownObject(this);
+		}
+		catch (Exception e)
+		{
+			if (jtsLogger.logger.isWarnEnabled())
+			{
+				jtsLogger.loggerI18N
+						.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.destroyfailed");
+			}
+		}
 	}
-    }
 
-    /**
-     * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.stateerror {0} status of transaction is different from our status: <{1}, {2}>
-     */
-
-public void after_completion (org.omg.CosTransactions.Status status) throws SystemException
-    {
-	if (_theTransaction == null)
+	public void before_completion() throws SystemException
 	{
-	    destroy();
-	    
-	    throw new BAD_OPERATION(ExceptionCodes.NO_TRANSACTION, CompletionStatus.COMPLETED_NO);
+		if (_theTransaction == null)
+			throw new BAD_OPERATION(ExceptionCodes.NO_TRANSACTION,
+					CompletionStatus.COMPLETED_NO);
+		else
+		{
+			_theTransaction.doBeforeCompletion();
+		}
 	}
-	else
-	{
-	    /*
-	     * Check that the given status is the same as our status. It
-	     * should be!
-	     */
 
-	    org.omg.CosTransactions.Status myStatus = org.omg.CosTransactions.Status.StatusUnknown;
-    
-	    try
-	    {
-		myStatus = _theTransaction.get_status();
-	    }
-	    catch (Exception e)
-	    {
-		myStatus = org.omg.CosTransactions.Status.StatusUnknown;
-	    }
+	/**
+	 * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.stateerror
+	 *          {0} status of transaction is different from our status: <{1},
+	 *          {2}>
+	 */
 
-	    if (myStatus != status)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
+	public void after_completion(org.omg.CosTransactions.Status status)
+			throws SystemException
+	{
+		if (_theTransaction == null)
 		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.stateerror",
-					      new Object[] { "ServerSynchronization.after_completion", myStatus, status });
+			destroy();
+
+			throw new BAD_OPERATION(ExceptionCodes.NO_TRANSACTION,
+					CompletionStatus.COMPLETED_NO);
 		}
+		else
+		{
+			/*
+			 * Check that the given status is the same as our status. It should
+			 * be!
+			 */
 
+			org.omg.CosTransactions.Status myStatus = org.omg.CosTransactions.Status.StatusUnknown;
+
+			try
+			{
+				myStatus = _theTransaction.get_status();
+			}
+			catch (Exception e)
+			{
+				myStatus = org.omg.CosTransactions.Status.StatusUnknown;
+			}
+
+			if (myStatus != status)
+			{
+				if (jtsLogger.loggerI18N.isWarnEnabled())
+				{
+					jtsLogger.loggerI18N
+							.warn(
+									"com.arjuna.ats.internal.jts.orbspecific.interposition.resources.stateerror",
+									new Object[]
+									{ "ServerSynchronization.after_completion",
+											com.arjuna.ats.jts.utils.Utility.stringStatus(myStatus), com.arjuna.ats.jts.utils.Utility.stringStatus(status) });
+				}
+
+				/*
+				 * There's nothing much we can do, since the transaction should
+				 * have completed. The best we can hope for it to try to
+				 * rollback our portion of the transaction, but this may result
+				 * in heuristics (which may not be reported to the coordinator,
+				 * since exceptions from after_completion can be ignored in the
+				 * spec.)
+				 */
+
+				if (myStatus == org.omg.CosTransactions.Status.StatusActive)
+				{
+					try
+					{
+						_theTransaction.rollback();
+					}
+					catch (Exception e)
+					{
+					}
+
+					/*
+					 * Get the local status to pass to our local
+					 * synchronizations.
+					 */
+
+					try
+					{
+						status = _theTransaction.get_status();
+					}
+					catch (Exception e)
+					{
+						status = org.omg.CosTransactions.Status.StatusUnknown;
+					}
+				}
+			}
+
+			_theTransaction.doAfterCompletion(status);
+		}
+
 		/*
-		 * There's nothing much we can do, since the transaction
-		 * should have completed. The best we can hope for it to try
-		 * to rollback our portion of the transaction, but this may
-		 * result in heuristics (which may not be reported to the
-		 * coordinator, since exceptions from after_completion can be
-		 * ignored in the spec.)
+		 * Now dispose of self.
 		 */
 
-		if (myStatus == org.omg.CosTransactions.Status.StatusActive)
-		{
-		    try
-		    {
-			_theTransaction.rollback();
-		    }
-		    catch (Exception e)
-		    {
-		    }
-
-		    /*
-		     * Get the local status to pass to our local
-		     * synchronizations.
-		     */
-		
-		    try
-		    {
-			status = _theTransaction.get_status();
-		    }
-		    catch (Exception e)
-		    {
-			status = org.omg.CosTransactions.Status.StatusUnknown;
-		    }
-		}
-	    }
-	
-	    _theTransaction.doAfterCompletion(status);
+		destroy();
 	}
 
-	/*
-	 * Now dispose of self.
-	 */
+	private ServerTransaction _theTransaction;
 
-	destroy();
-    }
+	private Synchronization _theSynchronization;
 
-private ServerTransaction _theTransaction;
-private Synchronization   _theSynchronization;
- 
 }




More information about the jboss-svn-commits mailing list