geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction UserTransactionImpl.java
Date Tue, 06 Apr 2004 18:33:36 GMT
dain        2004/04/06 11:33:36

  Modified:    modules/transaction/src/java/org/apache/geronimo/transaction
                        UserTransactionImpl.java
  Log:
  Made UserTransactionImpl serializable
  
  Revision  Changes    Path
  1.2       +12 -7     incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java
  
  Index: UserTransactionImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/UserTransactionImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserTransactionImpl.java	6 Apr 2004 00:21:20 -0000	1.1
  +++ UserTransactionImpl.java	6 Apr 2004 18:33:36 -0000	1.2
  @@ -17,6 +17,7 @@
   
   package org.apache.geronimo.transaction;
   
  +import java.io.Serializable;
   import javax.transaction.HeuristicMixedException;
   import javax.transaction.HeuristicRollbackException;
   import javax.transaction.NotSupportedException;
  @@ -38,10 +39,12 @@
    *
    * @version $Revision$ $Date$
    */
  -public class UserTransactionImpl implements UserTransaction {
  -    private TransactionManager txnManager;
  -    private TrackedConnectionAssociator trackedConnectionAssociator;
  -    private final ThreadLocal state = new ThreadLocal() {
  +public class UserTransactionImpl implements UserTransaction, Serializable {
  +    private transient TransactionManager txnManager;
  +    private transient TrackedConnectionAssociator trackedConnectionAssociator;
  +
  +    private final ThreadLocal state = new StateThreadLocal();
  +    private static class StateThreadLocal extends ThreadLocal implements Serializable {
           protected Object initialValue() {
               return OFFLINE;
           }
  @@ -96,7 +99,8 @@
           getUserTransaction().setTransactionTimeout(timeout);
       }
   
  -    private final UserTransaction ONLINE = new UserTransaction() {
  +    private final UserTransaction ONLINE = new OnlineUserTransaction();
  +    private final class OnlineUserTransaction implements UserTransaction, Serializable
{
           public int getStatus() throws SystemException {
               return txnManager.getStatus();
           }
  @@ -165,7 +169,8 @@
           }
       };
   
  -    private static final UserTransaction OFFLINE = new UserTransaction() {
  +    private static final UserTransaction OFFLINE = new OfflineUserTransaction();
  +    private static final class OfflineUserTransaction implements UserTransaction, Serializable
{
           public void begin() throws NotSupportedException, SystemException {
               throw new IllegalStateException("Cannot use UserTransaction methods in this
state");
           }
  
  
  

Mime
View raw message