[jboss-cvs] jboss-jms/src/main/org/jboss/messaging/core/plugin ...
Timothy Fox
tim.fox at jboss.com
Mon Jul 17 13:14:48 EDT 2006
User: timfox
Date: 06/07/17 13:14:48
Modified: src/main/org/jboss/messaging/core/plugin
JDBCPersistenceManager.java MessageHolder.java
SimpleMessageReference.java
Log:
Many changes including implementation of prefetch, SEDAisation of server, changing of recovery
Revision Changes Path
1.31 +35 -7 jboss-jms/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JDBCPersistenceManager.java
===================================================================
RCS file: /cvsroot/jboss/jboss-jms/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- JDBCPersistenceManager.java 24 Jun 2006 09:05:38 -0000 1.30
+++ JDBCPersistenceManager.java 17 Jul 2006 17:14:48 -0000 1.31
@@ -467,6 +467,8 @@
PreparedStatement ps = null;
TransactionWrapper wrap = new TransactionWrapper();
+ final int MAX_TRIES = 25;
+
try
{
conn = ds.getConnection();
@@ -479,6 +481,12 @@
ps.setLong(3, channelID);
+ int tries = 0;
+
+ while (true)
+ {
+ try
+ {
int rows = ps.executeUpdate();
if (trace)
@@ -487,6 +495,26 @@
new Long(orderStart), new Long(orderEnd))
+ " updated " + rows + " rows");
}
+ if (tries > 0)
+ {
+ log.warn("Update worked after retry");
+ }
+ break;
+ }
+ catch (SQLException e)
+ {
+ log.warn("SQLException caught - assuming deadlock detected, try:" + (tries + 1), e);
+ tries++;
+ if (tries == MAX_TRIES)
+ {
+ log.error("Retried " + tries + " times, now giving up");
+ throw new IllegalStateException("Failed to update references");
+ }
+ log.warn("Trying again after a pause");
+ //Now we wait for a random amount of time to minimise risk of deadlock
+ Thread.sleep((long)(Math.random() * 500));
+ }
+ }
}
catch (Exception e)
{
1.9 +5 -2 jboss-jms/src/main/org/jboss/messaging/core/plugin/MessageHolder.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MessageHolder.java
===================================================================
RCS file: /cvsroot/jboss/jboss-jms/src/main/org/jboss/messaging/core/plugin/MessageHolder.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- MessageHolder.java 22 Mar 2006 10:23:34 -0000 1.8
+++ MessageHolder.java 17 Jul 2006 17:14:48 -0000 1.9
@@ -22,6 +22,7 @@
package org.jboss.messaging.core.plugin;
+import org.jboss.logging.Logger;
import org.jboss.messaging.core.Message;
/**
@@ -35,6 +36,8 @@
*/
class MessageHolder
{
+ private static final Logger log = Logger.getLogger(MessageHolder.class);
+
/*
* The number of channels *currently in memory* that hold a reference to the message
* We need this so we know when to evict the message from the store (when it reaches zero)
1.6 +25 -18 jboss-jms/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SimpleMessageReference.java
===================================================================
RCS file: /cvsroot/jboss/jboss-jms/src/main/org/jboss/messaging/core/plugin/SimpleMessageReference.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- SimpleMessageReference.java 22 Mar 2006 10:23:34 -0000 1.5
+++ SimpleMessageReference.java 17 Jul 2006 17:14:48 -0000 1.6
@@ -56,7 +56,7 @@
private MessageHolder holder;
- private int deliveryCount;
+ //private int deliveryCount;
private long ordering;
@@ -144,24 +144,31 @@
return holder.getInMemoryChannelCount();
}
- public int getDeliveryCount()
- {
- return deliveryCount;
- }
-
- public void incrementDeliveryCount()
- {
- deliveryCount++;
- }
+ //These are all handled in RoutableSupport
- public void setDeliveryCount(int deliveryCount)
- {
- this.deliveryCount = deliveryCount;
- if (deliveryCount > 0)
- {
- this.redelivered = true;
- }
- }
+// public int getDeliveryCount()
+// {
+// return deliveryCount;
+// }
+//
+// public void incrementDeliveryCount()
+// {
+// deliveryCount++;
+// }
+//
+// public void decrementDeliveryCount()
+// {
+// deliveryCount--;
+// }
+//
+// public void setDeliveryCount(int deliveryCount)
+// {
+// this.deliveryCount = deliveryCount;
+// if (deliveryCount > 0)
+// {
+// this.redelivered = true;
+// }
+// }
public long getOrdering()
{
More information about the jboss-cvs-commits
mailing list