db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r420915 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java
Date Tue, 11 Jul 2006 16:29:26 GMT
Author: arminw
Date: Tue Jul 11 09:29:24 2006
New Revision: 420915

URL: http://svn.apache.org/viewvc?rev=420915&view=rev
Log:
override finalize() to add check for unclosed tx

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java?rev=420915&r1=420914&r2=420915&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/LocalTxManager.java Tue Jul
11 09:29:24 2006
@@ -16,20 +16,24 @@
  */
 
 import java.util.Hashtable;
+import java.util.ArrayList;
 
 import org.apache.ojb.broker.util.configuration.Configuration;
+import org.apache.ojb.broker.util.logging.Logger;
+import org.apache.ojb.broker.util.logging.LoggerFactory;
 import org.odmg.TransactionNotInProgressException;
+import org.odmg.TransactionInProgressException;
 
 /**
  * In a non-appserver environment, without a transaction manager, we can
  * safely associate the current ODMG transaction with the calling thread.
  *
- * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
- * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
  * @version $Id$
  */
 public class LocalTxManager implements OJBTxManager
 {
+    private static Logger log = LoggerFactory.getLogger(LocalTxManager.class);
+
     /**
      * Internal table which provides mapping between threads and transactions.
      * This is required because a Thread can join a Transaction already in
@@ -159,6 +163,18 @@
         public void remove(Thread key_thread)
         {
             m_table.remove(key_thread);
+        }
+
+        protected void finalize() throws Throwable
+        {
+            super.finalize();
+            if(m_table.size() > 0)
+            {
+                log.error("Found registered transactions on shutdown, please check your tx-demarcation,"
+
+                        " tx's are: " + new ArrayList(m_table.values()));
+                throw new TransactionInProgressException("Found registered transactions on
shutdown, please check your tx-demarcation");
+
+            }
         }
     }
 }



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


Mime
View raw message