[jboss-cvs] JBoss Messaging SVN: r3021 - trunk/src/main/org/jboss/messaging/core/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 21 12:24:12 EDT 2007
Author: timfox
Date: 2007-08-21 12:24:12 -0400 (Tue, 21 Aug 2007)
New Revision: 3021
Modified:
trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
Log:
fixed bug in paging
Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2007-08-21 15:46:38 UTC (rev 3020)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2007-08-21 16:24:12 UTC (rev 3021)
@@ -504,7 +504,7 @@
// ===============================
//Used to page NP messages or P messages in a non recoverable queue
- public void pageReferences(long channelID, List references, boolean page) throws Exception
+ public synchronized void pageReferences(long channelID, List references, boolean page) throws Exception
{
Connection conn = null;
PreparedStatement psInsertReference = null;
@@ -527,8 +527,8 @@
psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
- boolean added = false;
-
+ boolean insertsInBatch = false;
+
while (iter.hasNext())
{
//We may need to persist the message itself
@@ -577,7 +577,19 @@
{
storeMessage(m, psInsertMessage);
- added = true;
+ if (usingBatchUpdates)
+ {
+ psInsertMessage.addBatch();
+
+ insertsInBatch = true;
+ }
+ else
+ {
+ int rows = executeWithRetry(psInsertMessage);
+
+ if (trace) { log.trace("Inserted " + rows + " rows"); }
+ }
+ m.setPersisted(true);
}
}
finally
@@ -588,21 +600,6 @@
}
}
}
-
- if (added)
- {
- if (usingBatchUpdates)
- {
- psInsertMessage.addBatch();
- }
- else
- {
- int rows = executeWithRetry(psInsertMessage);
-
- if (trace) { log.trace("Inserted " + rows + " rows"); }
- }
- m.setPersisted(true);
- }
}
if (usingBatchUpdates)
@@ -611,7 +608,7 @@
if (trace) { logBatchUpdate(getSQLStatement("INSERT_MESSAGE_REF"), rowsReference, "inserted"); }
- if (added)
+ if (insertsInBatch)
{
int[] rowsMessage = executeWithRetryBatch(psInsertMessage);
More information about the jboss-cvs-commits
mailing list