activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1447 JDBC NodeManager to support JDBC HA Shared Store
Date Fri, 27 Oct 2017 17:28:37 GMT
ARTEMIS-1447 JDBC NodeManager to support JDBC HA Shared Store

It fixes the NPE on server start due to:
 - missing SqlProviderFactory
 - missing executor factory/scheduled pool (ie using exclusive scheduled pools)

It fixes the WARNINGS due to wrong slowness detection while renewing JdbcLeaseLock.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/33cab063
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/33cab063
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/33cab063

Branch: refs/heads/master
Commit: 33cab063eab6e45a594132e4a19d41da98ac70db
Parents: dc4681b
Author: Francesco Nigro <nigro.fra@gmail.com>
Authored: Fri Oct 27 17:43:29 2017 +0200
Committer: Justin Bertram <jbertram@apache.org>
Committed: Fri Oct 27 12:26:48 2017 -0500

----------------------------------------------------------------------
 .../server/impl/jdbc/ActiveMQScheduledLeaseLock.java    |  2 +-
 .../artemis/core/server/impl/jdbc/JdbcNodeManager.java  | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/33cab063/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
index 30db629..89762dc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
@@ -92,7 +92,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent
implem
       }
       //logic to detect slowness of DB and/or the scheduled executor service
       detectAndReportRenewSlowness(lockName, lastRenewStart, renewStart, renewPeriodMillis,
lock.expirationMillis());
-      this.lastLockRenewStart = lastRenewStart;
+      this.lastLockRenewStart = renewStart;
    }
 
    private static void detectAndReportRenewSlowness(String lockName,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/33cab063/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManager.java
index f4baeea..8cb852d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManager.java
@@ -28,6 +28,8 @@ import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
 import org.apache.activemq.artemis.core.server.ActivateCallback;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.NodeManager;
+import org.apache.activemq.artemis.jdbc.store.drivers.JDBCUtils;
+import org.apache.activemq.artemis.jdbc.store.sql.GenericSQLProvider;
 import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.UUID;
@@ -56,11 +58,13 @@ public final class JdbcNodeManager extends NodeManager {
                                       ExecutorFactory executorFactory,
                                       IOCriticalErrorListener ioCriticalErrorListener) {
       if (configuration.getDataSource() != null) {
+         final SQLProvider.Factory sqlProviderFactory = configuration.getSqlProviderFactory()
== null ? new GenericSQLProvider.Factory() : configuration.getSqlProviderFactory();
          final String brokerId = java.util.UUID.randomUUID().toString();
-         return usingDataSource(brokerId, configuration.getJdbcLockExpirationMillis(), configuration.getJdbcLockRenewPeriodMillis(),
configuration.getJdbcLockAcquisitionTimeoutMillis(), configuration.getDataSource(), configuration.getSqlProviderFactory().create(configuration.getNodeManagerStoreTableName(),
SQLProvider.DatabaseStoreType.NODE_MANAGER), scheduledExecutorService, executorFactory, ioCriticalErrorListener);
+         return usingDataSource(brokerId, configuration.getJdbcLockExpirationMillis(), configuration.getJdbcLockRenewPeriodMillis(),
configuration.getJdbcLockAcquisitionTimeoutMillis(), configuration.getDataSource(), sqlProviderFactory.create(configuration.getNodeManagerStoreTableName(),
SQLProvider.DatabaseStoreType.NODE_MANAGER), scheduledExecutorService, executorFactory, ioCriticalErrorListener);
       } else {
+         final SQLProvider sqlProvider = JDBCUtils.getSQLProvider(configuration.getJdbcDriverClassName(),
configuration.getNodeManagerStoreTableName(), SQLProvider.DatabaseStoreType.NODE_MANAGER);
          final String brokerId = java.util.UUID.randomUUID().toString();
-         return usingConnectionUrl(brokerId, configuration.getJdbcLockExpirationMillis(),
configuration.getJdbcLockRenewPeriodMillis(), configuration.getJdbcLockAcquisitionTimeoutMillis(),
configuration.getJdbcConnectionUrl(), configuration.getJdbcDriverClassName(), configuration.getSqlProviderFactory().create(configuration.getNodeManagerStoreTableName(),
SQLProvider.DatabaseStoreType.NODE_MANAGER), scheduledExecutorService, executorFactory, ioCriticalErrorListener);
+         return usingConnectionUrl(brokerId, configuration.getJdbcLockExpirationMillis(),
configuration.getJdbcLockRenewPeriodMillis(), configuration.getJdbcLockAcquisitionTimeoutMillis(),
configuration.getJdbcConnectionUrl(), configuration.getJdbcDriverClassName(), sqlProvider,
scheduledExecutorService, executorFactory, ioCriticalErrorListener);
       }
    }
 
@@ -101,8 +105,8 @@ public final class JdbcNodeManager extends NodeManager {
       this.lockRenewPeriodMillis = lockRenewPeriodMillis;
       this.pauser = LeaseLock.Pauser.sleep(Math.min(this.lockRenewPeriodMillis, MAX_PAUSE_MILLIS),
TimeUnit.MILLISECONDS);
       this.sharedStateManager = sharedStateManager;
-      this.scheduledLiveLock = ScheduledLeaseLock.of(scheduledExecutorService, executorFactory.getExecutor(),
"live", this.sharedStateManager.liveLock(), lockRenewPeriodMillis, ioCriticalErrorListener);
-      this.scheduledBackupLock = ScheduledLeaseLock.of(scheduledExecutorService, executorFactory.getExecutor(),
"backup", this.sharedStateManager.backupLock(), lockRenewPeriodMillis, ioCriticalErrorListener);
+      this.scheduledLiveLock = ScheduledLeaseLock.of(scheduledExecutorService, executorFactory
!= null ? executorFactory.getExecutor() : null, "live", this.sharedStateManager.liveLock(),
lockRenewPeriodMillis, ioCriticalErrorListener);
+      this.scheduledBackupLock = ScheduledLeaseLock.of(scheduledExecutorService, executorFactory
!= null ? executorFactory.getExecutor() : null, "backup", this.sharedStateManager.backupLock(),
lockRenewPeriodMillis, ioCriticalErrorListener);
       this.ioCriticalErrorListener = ioCriticalErrorListener;
    }
 


Mime
View raw message