[jboss-cvs] JBossAS SVN: r61583 - trunk/jbossmq/src/main/org/jboss/mq/pm/jdbc2.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 22 11:12:42 EDT 2007


Author: adrian at jboss.org
Date: 2007-03-22 11:12:42 -0400 (Thu, 22 Mar 2007)
New Revision: 61583

Modified:
   trunk/jbossmq/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
Log:
Port JBAS-3792 from JBoss-4.2

Modified: trunk/jbossmq/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java
===================================================================
--- trunk/jbossmq/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2007-03-22 15:12:17 UTC (rev 61582)
+++ trunk/jbossmq/src/main/org/jboss/mq/pm/jdbc2/PersistenceManager.java	2007-03-22 15:12:42 UTC (rev 61583)
@@ -1,24 +1,24 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.pm.jdbc2;
 
 import java.io.ByteArrayInputStream;
@@ -63,6 +63,7 @@
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.tm.TransactionManagerService;
 import org.jboss.tm.TransactionTimeoutConfiguration;
+import org.jboss.util.UnreachableStatementException;
 
 import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
 
@@ -78,7 +79,9 @@
 public class PersistenceManager extends ServiceMBeanSupport
    implements PersistenceManagerMBean, org.jboss.mq.pm.PersistenceManager, CacheStore
 {
-
+   /** FAQ about concurrency problems */
+   private static String CONCURRENCY_WARNING = "\nCommon reasons for missing messages are \n1) You have multiple JBossMQs running over the same database.\n2) You are using a replicating database that is not keeping up with replication.";
+   
    /////////////////////////////////////////////////////////////////////////////////
    //
    // TX state attibutes
@@ -1404,7 +1407,7 @@
                    {
                       if (rc != 1)
                          throw new SpyJMSException(
-                           "Could not mark the message as deleted in the database: update affected " + rc + " rows");
+                           "Could not mark the message as deleted in the database: update affected " + rc + " rows." + CONCURRENCY_WARNING);
 
                       log.warn("Remove operation worked after " +tries +" retries");
                    }
@@ -1499,20 +1502,16 @@
          rs = stmt.executeQuery();
          if (rs.next())
             return extractMessage(rs);
+         else
+            throw new SpyJMSException("Could not load message from storage: " + messageRef + " " + CONCURRENCY_WARNING);
 
-         return null;
-
       }
-      catch (IOException e)
+      catch (Exception e)
       {
          tms.setRollbackOnly();
-         throw new SpyJMSException("Could not load message : " + messageRef, e);
+         SpyJMSException.rethrowAsJMSException("Could not load message : " + messageRef, e);
+         throw new UnreachableStatementException();
       }
-      catch (SQLException e)
-      {
-         tms.setRollbackOnly();
-         throw new SpyJMSException("Could not load message : " + messageRef, e);
-      }
       finally
       {
          try
@@ -1670,6 +1669,7 @@
     * connection.  We, therefore, implement a retry loop wich is controled
     * by the ConnectionRetryAttempts attribute.  Submitted by terry at amicas.com
     *
+    * @return the connection
     * @exception SQLException if an error occurs.
     */
    protected Connection getConnection() throws SQLException




More information about the jboss-cvs-commits mailing list