tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r701464 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction: JtaTransactionPolicy.java TxBeanManaged.java TxRequiresNew.java
Date Fri, 03 Oct 2008 17:43:24 GMT
Author: djencks
Date: Fri Oct  3 10:43:24 2008
New Revision: 701464

URL: http://svn.apache.org/viewvc?rev=701464&view=rev
Log:
OPENEJB-918 make tx logging less intrusive

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxBeanManaged.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxRequiresNew.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java?rev=701464&r1=701463&r2=701464&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java
Fri Oct  3 10:43:24 2008
@@ -200,7 +200,7 @@
         try {
             return transactionManager.getTransaction();
         } catch (javax.transaction.SystemException e) {
-            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to obtain current transaction: " + e.getMessage());
+            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to obtain current transaction: {}", e.getMessage());
             throw new SystemException(e);
         }
     }
@@ -210,12 +210,10 @@
         try {
             if (tx != null && tx.getStatus() == Status.STATUS_ACTIVE) {
                 tx.setRollbackOnly();
-                if (txLogger.isInfoEnabled()) {
-                    txLogger.info("TX " + transactionType + ": setRollbackOnly() on transaction
" + tx);
-                }
+                txLogger.debug("TX {}: setRollbackOnly() on transaction {}", transactionType,
tx);
             }
         } catch (Exception e) {
-            logger.error("Exception during setRollbackOnly()", e);
+            txLogger.error("Exception during setRollbackOnly()", e);
             throw new IllegalStateException("No transaction active", e);
         }
     }
@@ -226,7 +224,7 @@
             transactionManager.begin();
             transaction = transactionManager.getTransaction();
         } catch (Exception e) {
-            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to begin a new transaction: " + e.getMessage());
+            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to begin a new transaction: {}", e.getMessage());
             throw new SystemException(e);
         }
 
@@ -234,21 +232,17 @@
             throw new SystemException("Failed to begin a new transaction");
         }
 
-        if (txLogger.isInfoEnabled()) {
-            txLogger.info("TX " + transactionType + ": Started transaction " + transaction);
-        }
+        txLogger.debug("TX {}: Started transaction {}", transactionType, transaction);
         return transaction;
     }
 
     protected Transaction suspendTransaction() throws SystemException {
         try {
             Transaction tx = transactionManager.suspend();
-            if (txLogger.isInfoEnabled()) {
-                txLogger.info("TX " + transactionType + ": Suspended transaction " + tx);
-            }
+            txLogger.info("TX {}: Suspended transaction {}", transactionType, tx);
             return tx;
         } catch (javax.transaction.SystemException se) {
-            logger.error("Exception during suspend()", se);
+            txLogger.error("Exception during suspend()", se);
             throw new SystemException(se);
         }
     }
@@ -256,26 +250,22 @@
     protected void resumeTransaction(Transaction tx) throws SystemException {
         try {
             if (tx == null) {
-                if (txLogger.isInfoEnabled()) {
-                    txLogger.info("TX " + transactionType + ": No transaction to resume");
-                }
+                txLogger.debug("TX {}: No transaction to resume", transactionType);
             } else {
-                if (txLogger.isInfoEnabled()) {
-                    txLogger.info("TX " + transactionType + ": Resuming transaction " + tx);
-                }
+                txLogger.debug("TX {}: Resuming transaction {}",transactionType, tx);
                 transactionManager.resume(tx);
             }
         } catch (InvalidTransactionException ite) {
 
-            txLogger.error("Could not resume the client's transaction, the transaction is
no longer valid: " + ite.getMessage());
+            txLogger.error("Could not resume the client's transaction, the transaction is
no longer valid: {}", ite.getMessage());
             throw new SystemException(ite);
         } catch (IllegalStateException e) {
 
-            txLogger.error("Could not resume the client's transaction: " + e.getMessage());
+            txLogger.error("Could not resume the client's transaction: {}", e.getMessage());
             throw new SystemException(e);
         } catch (javax.transaction.SystemException e) {
 
-            txLogger.error("Could not resume the client's transaction: The transaction reported
a system exception: " + e.getMessage());
+            txLogger.error("Could not resume the client's transaction: The transaction reported
a system exception: {}", e.getMessage());
             throw new SystemException(e);
         }
     }
@@ -285,7 +275,7 @@
         try {
             shouldRollback = tx.getStatus() != Status.STATUS_ACTIVE;
         } catch (javax.transaction.SystemException e) {
-            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to obtain transaction status: " + e.getMessage());
+            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to obtain transaction status: {}", e.getMessage());
             throw new SystemException(e);
         }
 
@@ -295,9 +285,7 @@
         }
 
         try {
-            if (txLogger.isInfoEnabled()) {
-                txLogger.info("TX " + transactionType + ": Committing transaction " + tx);
-            }
+            txLogger.debug("TX {}: Committing transaction {}", transactionType, tx);
             if (tx.equals(transactionManager.getTransaction())) {
 
                 transactionManager.commit();
@@ -306,32 +294,32 @@
             }
         } catch (RollbackException e) {
 
-            txLogger.info("The transaction has been rolled back rather than commited: " +
e.getMessage());
+            txLogger.debug("The transaction has been rolled back rather than commited: {}",
e.getMessage());
             Throwable txe = new TransactionRolledbackException("Transaction was rolled back,
presumably because setRollbackOnly was called during a synchronization").initCause(e);
             throw new ApplicationException(txe);
 
         } catch (HeuristicMixedException e) {
 
-            txLogger.info("A heuristic decision was made, some relevant updates have been
committed while others have been rolled back: " + e.getMessage());
+            txLogger.debug("A heuristic decision was made, some relevant updates have been
committed while others have been rolled back: {}", e.getMessage());
             throw new ApplicationException(new RemoteException("A heuristic decision was
made, some relevant updates have been committed while others have been rolled back").initCause(e));
 
         } catch (HeuristicRollbackException e) {
 
-            txLogger.info("A heuristic decision was made while commiting the transaction,
some relevant updates have been rolled back: " + e.getMessage());
+            txLogger.debug("A heuristic decision was made while commiting the transaction,
some relevant updates have been rolled back: {}", e.getMessage());
             throw new ApplicationException(new RemoteException("A heuristic decision was
made while commiting the transaction, some relevant updates have been rolled back").initCause(e));
 
         } catch (SecurityException e) {
 
-            txLogger.error("The current thread is not allowed to commit the transaction:
" + e.getMessage());
+            txLogger.error("The current thread is not allowed to commit the transaction:
{}", e.getMessage());
             throw new SystemException(e);
 
         } catch (IllegalStateException e) {
 
-            txLogger.error("The current thread is not associated with a transaction: " +
e.getMessage());
+            txLogger.error("The current thread is not associated with a transaction: {}",
e.getMessage());
             throw new SystemException(e);
 
         } catch (javax.transaction.SystemException e) {
-            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to commit the transaction: " + e.getMessage());
+            txLogger.error("The Transaction Manager has encountered an unexpected error condition
while attempting to commit the transaction: {}", e.getMessage());
 
             throw new SystemException(e);
         }
@@ -339,9 +327,7 @@
 
     protected void rollbackTransaction(Transaction tx) throws SystemException {
         try {
-            if (txLogger.isInfoEnabled()) {
-                txLogger.info("TX " + transactionType + ": Rolling back transaction " + tx);
-            }
+            txLogger.debug("TX {}: Rolling back transaction {}", transactionType, tx);
             if (tx.equals(transactionManager.getTransaction())) {
 
                 transactionManager.rollback();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxBeanManaged.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxBeanManaged.java?rev=701464&r1=701463&r2=701464&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxBeanManaged.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxBeanManaged.java
Fri Oct  3 10:43:24 2008
@@ -57,9 +57,7 @@
             return null;
         }
 
-        if (JtaTransactionPolicy.txLogger.isInfoEnabled()) {
-            JtaTransactionPolicy.txLogger.info("TX " + transactionType + ": Suspended transaction
" + currentTx);
-        }
+        txLogger.info("TX {}: Suspended transaction {}", transactionType, currentTx);
 
         return new JtaSuspendedTransaction(currentTx);
     }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxRequiresNew.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxRequiresNew.java?rev=701464&r1=701463&r2=701464&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxRequiresNew.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/TxRequiresNew.java
Fri Oct  3 10:43:24 2008
@@ -69,8 +69,8 @@
         } finally {
             if (clientTx != null) {
                 resumeTransaction(clientTx);
-            } else if (txLogger.isInfoEnabled()) {
-                txLogger.info("TX " + transactionType + ": No transaction to resume");
+            } else {
+                txLogger.debug("TX {}: No transaction to resume", transactionType);
             }
         }
     }



Mime
View raw message