[Jboss-cvs] JBossAS SVN: r57012 - in branches/Branch_4_0/messaging/src/main/org/jboss/mq: kernel pm/jdbc2 sm sm/none

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 20 11:26:27 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-20 11:26:21 -0400 (Wed, 20 Sep 2006)
New Revision: 57012

Added:
   branches/Branch_4_0/messaging/src/main/org/jboss/mq/sm/none/
   branches/Branch_4_0/messaging/src/main/org/jboss/mq/sm/none/NullStateManager.java
Modified:
   branches/Branch_4_0/messaging/src/main/org/jboss/mq/kernel/Queue.java
   branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
   branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java
Log:
Synch jbossmq between the 4.0 and 5.0 branches.

Modified: branches/Branch_4_0/messaging/src/main/org/jboss/mq/kernel/Queue.java
===================================================================
--- branches/Branch_4_0/messaging/src/main/org/jboss/mq/kernel/Queue.java	2006-09-20 15:17:27 UTC (rev 57011)
+++ branches/Branch_4_0/messaging/src/main/org/jboss/mq/kernel/Queue.java	2006-09-20 15:26:21 UTC (rev 57012)
@@ -31,6 +31,7 @@
 import org.jboss.mq.SpyQueue;
 import org.jboss.mq.server.JMSDestinationManager;
 import org.jboss.mq.server.JMSQueue;
+import org.jboss.mq.SpyDestination;
 import org.jboss.naming.Util;
 
 /**
@@ -102,7 +103,13 @@
          setJNDIName(jndiName);
       }
    }
-
+   
+   public void setExpiryDestinationJndi(String jndi) throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      parameters.expiryDestination = (SpyDestination)ctx.lookup(jndi);
+   }
+   
    public void stop()
    {
       try

Modified: branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
===================================================================
--- branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2006-09-20 15:17:27 UTC (rev 57011)
+++ branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2006-09-20 15:26:21 UTC (rev 57012)
@@ -106,6 +106,9 @@
    /** The recover messages chunk  */
    private int recoverMessagesChunk = 0;
 
+   /** The statement retries */
+   private int statementRetries = 5;
+   
    /////////////////////////////////////////////////////////////////////////////////
    //
    // JDBC Access Attributes
@@ -1353,14 +1356,6 @@
       Connection c = null;
       PreparedStatement stmt = null;
       boolean threadWasInterrupted = Thread.interrupted();
-
-      // How many times we retry to execute the statement
-      // in case of a SQLException e.g when deadlock was detected
-      // Feedback from the field shows that 1 retry is usually enough.
-      // TODO: should be a configurable attribute
-      final int MAX_TRIES = 5;
-
-
       try
       {
          c = this.getConnection();
@@ -1419,7 +1414,7 @@
                 {
                    log.warn("SQLException caught - assuming deadlock detected, try:" + (tries + 1), e);
                    tries++;
-                   if (tries == MAX_TRIES)
+                   if (tries >= statementRetries)
                    {
                       log.error("Retried " + tries + " times, now giving up");
                       throw new IllegalStateException("Could not remove message after " +tries + "attempts");
@@ -1947,4 +1942,16 @@
    {
       this.xaRecovery = xaRecovery;
    }
+
+   public int getStatementRetries()
+   {
+      return statementRetries;
+   }
+
+   public void setStatementRetries(int statementRetries)
+   {
+      if (statementRetries < 0)
+         statementRetries = 0;
+      this.statementRetries = statementRetries;
+   }
 }

Modified: branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java
===================================================================
--- branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java	2006-09-20 15:17:27 UTC (rev 57011)
+++ branches/Branch_4_0/messaging/src/main/org/jboss/mq/pm/jdbc2/PersistenceManagerMBean.java	2006-09-20 15:26:21 UTC (rev 57012)
@@ -140,4 +140,18 @@
     * @param xaRecovery the xaRecovery.
     */
    void setXARecovery(boolean xaRecovery);
+
+   /**
+    * Get the statement retries
+    * 
+    * @return the retries
+    */
+   int getStatementRetries();
+
+   /**
+    * Set the statement retries
+    * 
+    * @param statementRetries the retries
+    */
+   void setStatementRetries(int statementRetries);
 }

Added: branches/Branch_4_0/messaging/src/main/org/jboss/mq/sm/none/NullStateManager.java
===================================================================
--- branches/Branch_4_0/messaging/src/main/org/jboss/mq/sm/none/NullStateManager.java	2006-09-20 15:17:27 UTC (rev 57011)
+++ branches/Branch_4_0/messaging/src/main/org/jboss/mq/sm/none/NullStateManager.java	2006-09-20 15:26:21 UTC (rev 57012)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.mq.sm.none;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.jms.JMSException;
+
+import org.jboss.mq.DurableSubscriptionID;
+import org.jboss.mq.SpyTopic;
+import org.jboss.mq.sm.AbstractStateManager;
+import org.jboss.mq.sm.StateManager;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * NullStateManager.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40901 $
+ */
+public class NullStateManager extends AbstractStateManager
+{
+   protected void checkLoggedOnClientId(String clientID) throws JMSException
+   {
+      return;
+   }
+
+   protected DurableSubscription getDurableSubscription(DurableSubscriptionID sub) throws JMSException
+   {
+      throw new NotImplementedException("Durable subscriptions are not supported");
+   }
+
+   public Collection getDurableSubscriptionIdsForTopic(SpyTopic topic) throws JMSException
+   {
+      return Collections.EMPTY_SET;
+   }
+
+   protected String getPreconfClientId(String login, String passwd) throws JMSException
+   {
+      return null;
+   }
+
+   protected void removeDurableSubscription(DurableSubscription ds) throws JMSException
+   {
+      throw new NotImplementedException("Durable subscriptions are not supported");
+   }
+
+   protected void saveDurableSubscription(DurableSubscription ds) throws JMSException
+   {
+      throw new NotImplementedException("Durable subscriptions are not supported");
+   }
+
+   public StateManager getInstance()
+   {
+      return this;
+   }
+}




More information about the jboss-cvs-commits mailing list