[hornetq-commits] JBoss hornetq SVN: r12310 - in trunk/hornetq-core/src/main/java/org/hornetq/core: transaction/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Mar 16 11:23:55 EDT 2012


Author: borges
Date: 2012-03-16 11:23:54 -0400 (Fri, 16 Mar 2012)
New Revision: 12310

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java
   trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/TransactionImpl.java
Log:
Better error handling on IOAsyncTask's

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java	2012-03-16 15:23:41 UTC (rev 12309)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java	2012-03-16 15:23:54 UTC (rev 12310)
@@ -462,15 +462,26 @@
 
       store.afterCompleteOperations(new IOAsyncTask()
       {
+         volatile String error = "";
 
+         @Override
          public void onError(final int errorCode, final String errorMessage)
          {
+            error = " errorCode=" + errorCode + ", msg=" + errorMessage;
+            log.error(this + error);
          }
 
+         @Override
          public void done()
          {
             processACK(position);
          }
+
+         @Override
+         public String toString()
+         {
+            return IOAsyncTask.class.getSimpleName() + "(" + PageSubscriptionImpl.class.getSimpleName() + ") " + error;
+         }
       });
    }
 

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/TransactionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/TransactionImpl.java	2012-03-16 15:23:41 UTC (rev 12309)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/TransactionImpl.java	2012-03-16 15:23:54 UTC (rev 12310)
@@ -31,7 +31,7 @@
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="mailto:andy.taylor at jboss.org>Andy Taylor</a>
- * 
+ *
  */
 public class TransactionImpl implements Transaction
 {
@@ -48,7 +48,7 @@
    private final Xid xid;
 
    private final long id;
-   
+
    /**
     * if the appendCommit has to be done only after the current operations are completed
     */
@@ -135,7 +135,7 @@
    {
       containsPersistent = true;
    }
-   
+
    public boolean isContainsPersistent()
    {
       return containsPersistent;
@@ -155,7 +155,7 @@
    {
       return createTime;
    }
-   
+
    public boolean hasTimedOut(final long currentTime,final int defaultTimeout)
    {
       if(timeoutSeconds == - 1)
@@ -232,7 +232,7 @@
          if (state == State.ROLLBACK_ONLY)
          {
             rollback();
-            
+
             if (exception != null)
             {
                throw exception;
@@ -258,7 +258,7 @@
                throw new IllegalStateException("Transaction is in invalid state " + state);
             }
          }
-         
+
          beforeCommit();
 
          if (containsPersistent || xid != null && state == State.PREPARED)
@@ -302,17 +302,18 @@
    }
 
    /**
-    * 
+    *
     */
    protected void asyncAppendCommit()
    {
-      final OperationContext ctx = storageManager.getContext(); 
+      final OperationContext ctx = storageManager.getContext();
       storageManager.afterCompleteOperations(new IOAsyncTask()
       {
          public void onError(int errorCode, String errorMessage)
          {
+            log.error("Error=" + errorCode + ", message=" + errorMessage);
          }
-         
+
          public void done()
          {
             OperationContext originalCtx = storageManager.getContext();
@@ -330,6 +331,12 @@
                storageManager.setContext(originalCtx);
             }
          }
+
+         @Override
+         public String toString()
+         {
+            return IOAsyncTask.class.getName() + "(" + TransactionImpl.class.getName() + "-AsyncAppendCommit)";
+         }
       });
       storageManager.lineUpContext();
    }
@@ -406,7 +413,7 @@
    {
       this.state = state;
    }
-   
+
    public boolean isWaitBeforeCommit()
    {
       return waitBeforeCommit;
@@ -445,11 +452,11 @@
       return operations.size();
    }
 
-   public synchronized List<TransactionOperation> getAllOperations() 
+   public synchronized List<TransactionOperation> getAllOperations()
    {
       return new ArrayList<TransactionOperation>(operations);
    }
-   
+
    public void putProperty(final int index, final Object property)
    {
       if (index >= properties.length)



More information about the hornetq-commits mailing list