diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-05-08 13:14:05 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-05-08 13:14:05 +0000 |
| commit | 14ffecc29a8393f54c9d4f6f3bce6ee3276cf381 (patch) | |
| tree | 8d3b879c9c74fa132f7cfba8e474bb72a781dece /qpid/tools/src/java | |
| parent | 54243c16cf78f1d82c642335deaa01aa9a1b341e (diff) | |
| download | qpid-python-14ffecc29a8393f54c9d4f6f3bce6ee3276cf381.tar.gz | |
QPID-5754 : [Java Broker] Make state change operations methods rather than calls to setDesiredState
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1593264 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/tools/src/java')
2 files changed, 6 insertions, 30 deletions
diff --git a/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/QmfManagementPluginImpl.java b/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/QmfManagementPluginImpl.java index 63260be6be..d7ea0971d4 100644 --- a/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/QmfManagementPluginImpl.java +++ b/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/QmfManagementPluginImpl.java @@ -36,6 +36,7 @@ import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.ManagedAttributeField; import org.apache.qpid.server.model.ManagedObjectFactoryConstructor; import org.apache.qpid.server.model.State; +import org.apache.qpid.server.model.StateTransition; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.model.adapter.AbstractPluginAdapter; @@ -122,33 +123,6 @@ public class QmfManagementPluginImpl extends AbstractPluginAdapter<QmfManagement _defaultVirtualHost = _broker.getDefaultVirtualHost(); } - /** - * Set the state of the Plugin, I believe that this is called from the BrokerAdapter object when it - * has its own state set to State.ACTIVE or State.STOPPED. - * When State.ACTIVE is set this calls the start() method to startup the Plugin, when State.STOPPED - * is set this calls the stop() method to shutdown the Plugin. - * @param desiredState the desired state of the Plugin (either State.ACTIVE or State.STOPPED). - * @return true if a valid state has been set, otherwise false. - */ - @Override // From org.apache.qpid.server.model.adapter.AbstractAdapter - protected boolean setState(State desiredState) - { - if (desiredState == State.ACTIVE) - { - start(); - return true; - } - else if (desiredState == State.STOPPED) - { - stop(); - return true; - } - else - { - _log.info("QmfManagementPlugin.setState() received invalid desiredState {}", desiredState); - return false; - } - } /** * Start the Plugin. Note that we bind the QMF Connection the the default Virtual Host, this is important @@ -159,7 +133,8 @@ public class QmfManagementPluginImpl extends AbstractPluginAdapter<QmfManagement * as these don't exist by default on the Java Broker, however we have to check if they already exist * as attempting to add an Exchange that already exists will cause IllegalArgumentException. */ - private void start() + @StateTransition( currentState = State.UNINITIALIZED, desiredState = State.ACTIVE ) + private void doStart() { // Log "QMF2 Management Startup" message. getBroker().getEventLogger().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME)); @@ -232,7 +207,8 @@ public class QmfManagementPluginImpl extends AbstractPluginAdapter<QmfManagement /** * Stop the Plugin, closing the QMF Connection and logging "QMF2 Management Stopped". */ - private void stop() + @StateTransition( currentState = State.ACTIVE, desiredState = State.STOPPED ) + private void doStop() { // When the Plugin state gets set to STOPPED we close the QMF Connection. if (_agent != null) diff --git a/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/agentdata/Broker.java b/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/agentdata/Broker.java index f33a07ecdd..10e92a70ad 100644 --- a/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/agentdata/Broker.java +++ b/qpid/tools/src/java/qpid-broker-plugins-management-qmf2/src/main/java/org/apache/qpid/server/qmf2/agentdata/Broker.java @@ -650,7 +650,7 @@ System.out.println("properties = " + properties); Queue queue = nameParser.getQueue(); if (queue != null) { - queue.delete(); + queue.deleteAndReturnCount(); } } else if (type.equals("binding")) // delete binding. |
