From 1e57a8e70aab06c38c79c9f1f532f7b0490a564b Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Thu, 22 Feb 2018 12:42:18 -0600 Subject: [PATCH] ARTEMIS-1697 give ActivateCallback default methods --- .../jms/server/impl/JMSServerManagerImpl.java | 5 ----- .../artemis/core/server/ActivateCallback.java | 12 ++++++++---- .../core/server/impl/FileLockNodeManager.java | 12 ------------ .../artemis/core/server/impl/InVMNodeManager.java | 12 ------------ .../core/server/impl/jdbc/JdbcNodeManager.java | 12 ------------ .../management/impl/ManagementServiceImpl.java | 12 ------------ .../integration/discovery/DiscoveryBaseTest.java | 15 --------------- 7 files changed, 8 insertions(+), 72 deletions(-) diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index 69d4b90bc5..0e608807c2 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -168,11 +168,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback // ActivateCallback implementation ------------------------------------- - @Override - public void preActivate() { - - } - @Override public synchronized void activated() { if (!startCalled) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActivateCallback.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActivateCallback.java index 9841d67a01..f3d38203de 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActivateCallback.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActivateCallback.java @@ -21,21 +21,25 @@ public interface ActivateCallback { /* * this is called before any services are started when the server first initialised */ - void preActivate(); + default void preActivate() { + } /* * this is called after most of the services have been started but before any cluster resources or JMS resources have been */ - void activated(); + default void activated() { + } /* * this is called when the server is stopping, after any network resources and clients are closed but before the rest * of the resources */ - void deActivate(); + default void deActivate() { + } /* * this is called when all resources have been started including any JMS resources */ - void activationComplete(); + default void activationComplete() { + } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java index ad0292ce98..73156eee74 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java @@ -170,18 +170,6 @@ public class FileLockNodeManager extends NodeManager { ActiveMQServerLogger.LOGGER.obtainedLiveLock(); return new ActivateCallback() { - @Override - public void preActivate() { - } - - @Override - public void activated() { - } - - @Override - public void deActivate() { - } - @Override public void activationComplete() { try { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java index 63fac28b31..2719d66c21 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java @@ -108,18 +108,6 @@ public final class InVMNodeManager extends NodeManager { state = FAILING_BACK; liveLock.acquire(); return new ActivateCallback() { - @Override - public void preActivate() { - } - - @Override - public void activated() { - } - - @Override - public void deActivate() { - } - @Override public void activationComplete() { try { 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 2360df6346..4ed45a6528 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 @@ -350,18 +350,6 @@ public final class JdbcNodeManager extends NodeManager { ActiveMQServerLogger.LOGGER.obtainedLiveLock(); return new ActivateCallback() { - @Override - public void preActivate() { - } - - @Override - public void activated() { - } - - @Override - public void deActivate() { - } - @Override public void activationComplete() { try { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index 24a30bfb14..48b96c8263 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -547,10 +547,6 @@ public class ManagementServiceImpl implements ManagementService { * bridges won't be able to connect. */ messagingServer.registerActivateCallback(new ActivateCallback() { - @Override - public void preActivate() { - } - @Override public void activated() { try { @@ -559,14 +555,6 @@ public class ManagementServiceImpl implements ManagementService { ActiveMQServerLogger.LOGGER.unableToCreateManagementNotificationAddress(managementNotificationAddress, e); } } - - @Override - public void deActivate() { - } - - @Override - public void activationComplete() { - } }); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java index bfef53cb01..17128c7931 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java @@ -195,21 +195,6 @@ public class DiscoveryBaseTest extends ActiveMQTestBase { @Override public ActivateCallback startLiveNode() throws Exception { return new ActivateCallback() { - @Override - public void preActivate() { - } - - @Override - public void activated() { - } - - @Override - public void deActivate() { - } - - @Override - public void activationComplete() { - } }; }