activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1439933 - /activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
Date Tue, 29 Jan 2013 15:27:02 GMT
Author: gtully
Date: Tue Jan 29 15:27:01 2013
New Revision: 1439933

URL: http://svn.apache.org/viewvc?rev=1439933&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-1870 - have maxRows implement a limit, policyentry
max page size can be used to extend the scan, https://issues.apache.org/jira/browse/AMQ-3557

Modified:
    activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java

Modified: activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java?rev=1439933&r1=1439932&r2=1439933&view=diff
==============================================================================
--- activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
(original)
+++ activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
Tue Jan 29 15:27:01 2013
@@ -61,12 +61,11 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultJDBCAdapter implements JDBCAdapter {
     private static final Logger LOG = LoggerFactory.getLogger(DefaultJDBCAdapter.class);
-    public static final int MAX_ROWS = BaseDestination.MAX_PAGE_SIZE;
+    public static final int MAX_ROWS = org.apache.activemq.ActiveMQPrefetchPolicy.MAX_PREFETCH_SIZE;
     protected Statements statements;
     protected boolean batchStatments = true;
     protected boolean prioritizedMessages;
     protected ReadWriteLock cleanupExclusiveLock = new ReentrantReadWriteLock();
-    // needs to be min twice the prefetch for a durable sub and large enough for selector
range
     protected int maxRows = MAX_ROWS;
 
     protected void setBinaryData(PreparedStatement s, int index, byte data[]) throws SQLException
{
@@ -573,7 +572,7 @@ public class DefaultJDBCAdapter implemen
         cleanupExclusiveLock.readLock().lock();
         try {
             s = c.getConnection().prepareStatement(this.statements.getFindDurableSubMessagesStatement());
-            s.setMaxRows(Math.max(maxReturned * 2, maxRows));
+            s.setMaxRows(Math.min(maxReturned * 2, maxRows));
             s.setString(1, destination.getQualifiedName());
             s.setString(2, clientId);
             s.setString(3, subscriptionName);
@@ -608,7 +607,7 @@ public class DefaultJDBCAdapter implemen
         cleanupExclusiveLock.readLock().lock();
         try {
             s = c.getConnection().prepareStatement(this.statements.getFindDurableSubMessagesByPriorityStatement());
-            s.setMaxRows(Math.max(maxReturned * 2, maxRows));
+            s.setMaxRows(Math.min(maxReturned * 2, maxRows));
             s.setString(1, destination.getQualifiedName());
             s.setString(2, clientId);
             s.setString(3, subscriptionName);
@@ -918,6 +917,9 @@ public class DefaultJDBCAdapter implemen
         return maxRows;
     }
 
+    /**
+     * the max value for statement maxRows, used to limit jdbc queries
+     */
     public void setMaxRows(int maxRows) {
         this.maxRows = maxRows;
     }



Mime
View raw message