[jboss-cvs] JBoss Messaging SVN: r6254 - trunk/src/main/org/jboss/messaging/ra/inflow.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 1 03:56:30 EDT 2009


Author: ataylor
Date: 2009-04-01 03:56:30 -0400 (Wed, 01 Apr 2009)
New Revision: 6254

Modified:
   trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java
   trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
Log:
removed JCA reconnect logic - https://jira.jboss.org/jira/browse/JBMESSAGING-1563

Modified: trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java	2009-04-01 07:43:25 UTC (rev 6253)
+++ trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivation.java	2009-04-01 07:56:30 UTC (rev 6254)
@@ -22,11 +22,7 @@
 package org.jboss.messaging.ra.inflow;
 
 import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.remoting.FailureListener;
-import org.jboss.messaging.jms.client.JBossSession;
 import org.jboss.messaging.jms.JBossDestination;
 import org.jboss.messaging.ra.JBMResourceAdapter;
 import org.jboss.messaging.ra.Util;
@@ -34,17 +30,14 @@
 import org.jboss.tm.TransactionManagerLocator;
 
 import javax.jms.Destination;
-import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
 import javax.jms.Queue;
-import javax.jms.Session;
 import javax.jms.Topic;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.resource.ResourceException;
 import javax.resource.spi.endpoint.MessageEndpointFactory;
-import javax.resource.spi.work.Work;
 import javax.resource.spi.work.WorkManager;
 import javax.transaction.TransactionManager;
 import java.lang.reflect.Method;
@@ -60,7 +53,7 @@
  * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
  * @version $Revision: $
  */
-public class JBMActivation implements FailureListener
+public class JBMActivation
 {
    /**
     * The logger
@@ -98,11 +91,6 @@
    protected AtomicBoolean deliveryActive = new AtomicBoolean(false);
 
    /**
-    * Whether we are in the failure recovery loop
-    */
-   private AtomicBoolean inFailure = new AtomicBoolean(false);
-
-   /**
     * The destination type
     */
    protected boolean isTopic = false;
@@ -293,79 +281,8 @@
       teardown();
    }
 
-   /**
-    * Handles any failure by trying to reconnect
-    *
-    * @param failure The reason for the failure
-    */
-   public void handleFailure(Throwable failure)
-   {
-      log.warn("Failure in jms activation " + spec, failure);
-      int reconnectCount = 0;
 
-      // Only enter the failure loop once
-      if (inFailure.getAndSet(true))
-      {
-         return;
-      }
-
-      try
-      {
-         while (deliveryActive.get() && reconnectCount < spec.getRereconnectAttempts())
-         {
-            teardown();
-
-            try
-            {
-               if (spec.getReconnectIntervalMillis() > 0)
-               {
-                  Thread.sleep(spec.getReconnectIntervalMillis());
-               }
-            }
-            catch (InterruptedException e)
-            {
-               log.debug("Interrupted trying to reconnect " + spec, e);
-               break;
-            }
-
-            log.info("Attempting to reconnect " + spec);
-            try
-            {
-               setup();
-               log.info("Reconnected with messaging provider.");
-               break;
-            }
-            catch (Throwable t)
-            {
-               log.error("Unable to reconnect " + spec, t);
-            }
-            ++reconnectCount;
-         }
-      }
-      finally
-      {
-         // Leaving failure recovery loop
-         inFailure.set(false);
-      }
-   }
-
    /**
-    * On exception
-    *
-    * @param exception The reason for the failure
-    */
-   public void onException(JMSException exception)
-   {
-      if (trace)
-      {
-         log.trace("onException(" + exception + ")");
-      }
-
-      handleFailure(exception);
-   }
-
-
-   /**
     * Setup the activation
     *
     * @throws Exception Thrown if an error occurs
@@ -421,8 +338,6 @@
       {
          result = ra.createSession(spec.getAcknowledgeModeInt(), user, pass, ra.getPreAcknowledge(), ra.getDupsOKBatchSize(), ra.getTransactionBatchSize(), isDeliveryTransacted);
 
-         result.addFailureListener(this);
-
          log.debug("Using queue connection " + result);
 
          return result;
@@ -522,17 +437,6 @@
       buffer.append(')');
       return buffer.toString();
    }
-
-   public boolean connectionFailed(MessagingException me)
-   {
-      if (trace)
-      {
-         log.trace("onException(" + me + ")");
-      }
-
-      handleFailure(me);
-      return true;
-   }
 }
 
 

Modified: trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java	2009-04-01 07:43:25 UTC (rev 6253)
+++ trunk/src/main/org/jboss/messaging/ra/inflow/JBMActivationSpec.java	2009-04-01 07:56:30 UTC (rev 6254)
@@ -21,6 +21,7 @@
  */
 package org.jboss.messaging.ra.inflow;
 
+import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.ra.JBMResourceAdapter;
 
 import javax.jms.Session;
@@ -29,8 +30,6 @@
 import javax.resource.spi.InvalidPropertyException;
 import javax.resource.spi.ResourceAdapter;
 
-import org.jboss.messaging.core.logging.Logger;
-
 /**
  * The activation spec
  * 
@@ -71,9 +70,6 @@
    /** The client id */
    private String clientId;
 
-   /** The reconnect interval in seconds */
-   private Long reconnectInterval;
-
    /** The user */
    private String user;
 
@@ -95,9 +91,6 @@
    /** Is the session transacted */
    private Boolean sessionTransacted;
 
-   /** The number of reconnection attempts */
-   private Integer rereconnectAttempts;
-
    /** Unspecified redelivery */
    private Boolean redeliverUnspecified;
    
@@ -132,7 +125,6 @@
       subscriptionDurability = false;
       subscriptionName = null;
       clientId = null;
-      reconnectInterval = Long.valueOf(10);
       user = null;
       password = null;
       maxMessages = Integer.valueOf(1);
@@ -140,7 +132,6 @@
       maxSession = Integer.valueOf(15);
       keepAlive = Long.valueOf(60000);
       sessionTransacted = Boolean.TRUE;
-      rereconnectAttempts = Integer.valueOf(5);
       redeliverUnspecified = Boolean.TRUE;
       transactionTimeout = Integer.valueOf(0);
       isSameRMOverrideValue = null;
@@ -388,45 +379,6 @@
    }
 
    /**
-    * Get the reconnection interval
-    * @return The value
-    */
-   public Long getReconnectInterval()
-   {
-      if (trace)
-         log.trace("getReconnectInterval()");
-
-      return reconnectInterval;
-   }
-
-   /**
-    * Set the reconnection interval
-    * @param value The value
-    */
-   public void setReconnectInterval(Long value)
-   {
-      if (trace)
-         log.trace("setReconnectInterval(" + value + ")");
-
-      this.reconnectInterval = value;
-   }
-
-   /**
-    * Get the reconnection interval in milliseconds
-    * @return The value; if 0 == disable
-    */
-   public long getReconnectIntervalMillis()
-   {
-      if (trace)
-         log.trace("getReconnectIntervalMillis()");
-
-      if (reconnectInterval == null)
-         return 0;
-
-      return reconnectInterval.longValue() * 1000L;
-   }
-
-   /**
     * Get the user
     * @return The value
     */
@@ -668,32 +620,7 @@
 
       return sessionTransacted.booleanValue();
    }
-
    /**
-    * Get the rereconnect attempts
-    * @return The value
-    */
-   public Integer getRereconnectAttempts()
-   {
-      if (trace)
-         log.trace("getRereconnectAttempts()");
-
-      return rereconnectAttempts;
-   }
-
-   /**
-    * Set the rereconnect attempts
-    * @param value The value
-    */
-   public void setRereconnectAttempts(Integer value)
-   {
-      if (trace)
-         log.trace("setRereconnectAttempts(" + value + ")");
-
-      this.rereconnectAttempts = value;
-   }
-
-   /**
     * Get the redeliver upspecified
     * @return The value
     */
@@ -886,7 +813,6 @@
          buffer.append(" clientID=").append(clientId);
       if (subscriptionName != null)
          buffer.append(" subscription=").append(subscriptionName);
-      buffer.append(" reconnect=").append(reconnectInterval);
       buffer.append(" user=").append(user);
       if (password != null)
          buffer.append(" password=").append("****");




More information about the jboss-cvs-commits mailing list