activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r669733 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Date Thu, 19 Jun 2008 22:45:13 GMT
Author: rajdavies
Date: Thu Jun 19 15:45:13 2008
New Revision: 669733

URL: http://svn.apache.org/viewvc?rev=669733&view=rev
Log:
Apply patch for https://issues.apache.org/activemq/browse/AMQ-1244

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=669733&r1=669732&r2=669733&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Thu Jun 19 15:45:13 2008
@@ -80,6 +80,7 @@
     private long lockKeepAlivePeriod = 1000*30;
     private DatabaseLocker databaseLocker;
     private boolean createTablesOnStartup = true;
+    private DataSource lockDataSource;
 
     public JDBCPersistenceAdapter() {
     }
@@ -267,6 +268,24 @@
         }
         return databaseLocker;
     }
+    
+    public DataSource getLockDataSource() throws IOException {
+        if (lockDataSource == null) {
+            lockDataSource = getDataSource();
+            if (lockDataSource == null) {
+                throw new IllegalArgumentException(
+                        "No dataSource property has been configured");
+            }
+        } else {
+            LOG.info("Using a separate dataSource for locking: "
+                    + lockDataSource);
+        }
+        return lockDataSource;
+    }
+    
+    public void setLockDataSource(DataSource dataSource) {
+        this.lockDataSource = dataSource;
+    }
 
     /**
      * Sets the database locker strategy to use to lock the database on startup
@@ -481,7 +500,7 @@
     }
 
     protected DatabaseLocker createDatabaseLocker() throws IOException {
-        return new DefaultDatabaseLocker(getDataSource(), getStatements());
+        return new DefaultDatabaseLocker(getLockDataSource(), getStatements());
     }
 
     public void setBrokerName(String brokerName) {



Mime
View raw message