commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/file FileResourceManager.java
Date Wed, 23 Jun 2004 06:55:52 GMT
ozeigermann    2004/06/22 23:55:51

  Modified:    transaction/src/java/org/apache/commons/transaction/file
                        FileResourceManager.java
  Log:
  Removed dependency on thread which is non sense
  
  Revision  Changes    Path
  1.4       +10 -42    jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/file/FileResourceManager.java
  
  Index: FileResourceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/file/FileResourceManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FileResourceManager.java	12 Jun 2004 13:39:25 -0000	1.3
  +++ FileResourceManager.java	23 Jun 2004 06:55:51 -0000	1.4
  @@ -517,10 +517,6 @@
               return PREPARE_FAILURE;
           }
   
  -        if (!Thread.currentThread().equals(context.txThread)) {
  -            throw new ResourceManagerException(ERR_THREAD_INVALID, txId);
  -        }
  -
           synchronized (context) {
   
               sync();
  @@ -651,7 +647,7 @@
               context.isLightWeight = true;
               // XXX higher isolation might be needed to make sure upgrade to commit lock
always works
               context.isolationLevel = ISOLATION_LEVEL_READ_COMMITTED;
  -            //            context.isolationLevel = ISOLATION_LEVEL_REPEATABLE_READ;
  +//            context.isolationLevel = ISOLATION_LEVEL_REPEATABLE_READ;
               globalTransactions.put(txId, context);
           }
   
  @@ -759,7 +755,7 @@
               context.isLightWeight = true;
               // XXX higher isolation might be needed to make sure upgrade to commit lock
always works
               context.isolationLevel = ISOLATION_LEVEL_READ_COMMITTED;
  -            //            context.isolationLevel = ISOLATION_LEVEL_REPEATABLE_READ;
  +//            context.isolationLevel = ISOLATION_LEVEL_REPEATABLE_READ;
               globalTransactions.put(txId, context);
           }
   
  @@ -910,10 +906,6 @@
               throw new ResourceManagerException(ERR_NO_TX, txId);
           }
   
  -        if (!Thread.currentThread().equals(context.txThread)) {
  -            throw new ResourceManagerException(ERR_THREAD_INVALID, txId);
  -        }
  -
           return context;
       }
   
  @@ -1266,35 +1258,13 @@
           return (globalTransactions.size() == 0);
       }
   
  -    protected boolean rollbackAllTx() {
  -        synchronized (globalTransactions) {
  -            for (Iterator it = globalTransactions.values().iterator(); it.hasNext();) {
  -                TransactionContext context = (TransactionContext) it.next();
  -                logger.logInfo("Stopping " + context.txId);
  -                context.txThread.interrupt();
  -            }
  -            return rollBackOrForward();
  -        }
  -    }
  -
  -    protected void stopAllTx() {
  -        synchronized (globalTransactions) {
  -            for (Iterator it = globalTransactions.values().iterator(); it.hasNext();) {
  -                TransactionContext context = (TransactionContext) it.next();
  -                logger.logInfo("Killing " + context.txId);
  -                context.txThread.interrupt();
  -            }
  -        }
  -    }
  -
       protected boolean shutdown(int mode, long timeoutMSecs) {
           switch (mode) {
               case SHUTDOWN_MODE_NORMAL :
                   return waitForAllTxToStop(timeoutMSecs);
               case SHUTDOWN_MODE_ROLLBACK :
  -                return rollbackAllTx();
  +                return rollBackOrForward();
               case SHUTDOWN_MODE_KILL :
  -                stopAllTx();
                   return true;
               default :
                   return false;
  @@ -1321,7 +1291,6 @@
           protected long timeoutMSecs = getDefaultTransactionTimeout();
           protected long startTime;
           protected long commitTime = -1L;
  -        protected Thread txThread;
           protected boolean isLightWeight = false;
           protected boolean readOnly = true;
           protected boolean finished = false;
  @@ -1333,7 +1302,6 @@
           public TransactionContext(Object txId) throws ResourceManagerException {
               this.txId = txId;
               startTime = System.currentTimeMillis();
  -            txThread = Thread.currentThread();
           }
   
           public Collection getLocks() {
  @@ -1529,12 +1497,12 @@
               buf.append(Long.toString(startTime)).append('\n');
               if (debug) {
                   buf.append("----- Lock Debug Info -----\n");
  -
  +                
                   for (Iterator it = locks.iterator(); it.hasNext();) {
                       MultiLevelLock lock = (MultiLevelLock) it.next();
  -                    buf.append(lock.toString() + "\n");
  +                    buf.append(lock.toString()+"\n");
                   }
  -
  +                
               }
               return buf.toString();
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message