diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-06-28 16:46:12 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-06-28 16:46:12 +0000 |
| commit | 07c285f662e8f60d4e8aca247b65b77ca5df4587 (patch) | |
| tree | 7fe15262589c0fe5206e02a5e9336c6288f004e0 /qpid/java/broker-plugins/experimental | |
| parent | bb45ec03f95ffdfa6c0163067dcb75af8b64ceb5 (diff) | |
| download | qpid-python-07c285f662e8f60d4e8aca247b65b77ca5df4587.tar.gz | |
QPID-3998, QPID-3999, QPID-4093: add new management plugins for jmx/rest/webui functionality, partial merge from the java-config-and-management branch at r1355039
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1355072 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/experimental')
6 files changed, 0 insertions, 316 deletions
diff --git a/qpid/java/broker-plugins/experimental/shutdown/MANIFEST.MF b/qpid/java/broker-plugins/experimental/shutdown/MANIFEST.MF deleted file mode 100644 index 0bd0a835e4..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Experimental Shutdown -Bundle-Description: Experimental Qpid Broker Shutdown Plugin -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Bundle-DocURL: http://qpid.apache.org/ -Bundle-SymbolicName: broker-plugins-experimental-shutdown;singleton:=true -Bundle-Version: 1.0.0 -Bundle-Activator: org.apache.qpid.shutdown.Activator -Import-Package: javax.management;resolution:=optional, - org.apache.log4j, - org.osgi.framework, - org.apache.qpid.server.management -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Bundle-ActivationPolicy: lazy - diff --git a/qpid/java/broker-plugins/experimental/shutdown/build.xml b/qpid/java/broker-plugins/experimental/shutdown/build.xml deleted file mode 100644 index 96f97ee437..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/build.xml +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<project name="AMQ Broker Shutdown Plugin" default="build"> - <property name="module.depends" value="common broker management/common broker-plugins"/> - <property name="module.test.depends" value="test broker/test management/common client systests"/> - <property name="module.manifest" value="MANIFEST.MF"/> - <property name="module.plugin" value="true"/> - - <import file="../../../module.xml"/> - - <target name="bundle" depends="bundle-tasks"/> - -</project> diff --git a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Activator.java b/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Activator.java deleted file mode 100644 index 2b7fa33784..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Activator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.shutdown; - - -import org.apache.log4j.Logger; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator -{ - private static final Logger _logger = Logger.getLogger(Activator.class); - - private Shutdown _shutdown = null; - - /** @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ - public void start(BundleContext ctx) throws Exception { - _shutdown = new Shutdown(); - if (ctx != null) - { - ctx.registerService(ShutdownMBean.class.getName(), _shutdown, null); - } - - _shutdown.register(); - - _logger.info("Shutdown plugin MBean registered"); - } - - /** @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ - public void stop(BundleContext ctx) throws Exception - { - if (_shutdown != null) - { - _shutdown.unregister(); - _shutdown = null; - } - - _logger.info("Shutdown plugin MBean unregistered"); - } -} diff --git a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Shutdown.java b/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Shutdown.java deleted file mode 100644 index cef4a42b64..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/Shutdown.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.shutdown; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import javax.management.NotCompliantMBeanException; - -import org.apache.log4j.Logger; -import org.apache.qpid.server.management.DefaultManagedObject; - -/** - * Implementation of the JMX broker shutdown plugin. - */ -public class Shutdown extends DefaultManagedObject implements ShutdownMBean -{ - - private static final Logger _logger = Logger.getLogger(Shutdown.class); - - private static final String FORMAT = "yyyy/MM/dd HH:mm:ss"; - private static final int THREAD_COUNT = 1; - private static final ScheduledExecutorService EXECUTOR = new ScheduledThreadPoolExecutor(THREAD_COUNT); - - private final Runnable _shutdown = new SystemExiter(); - - public Shutdown() throws NotCompliantMBeanException - { - super(ShutdownMBean.class, ShutdownMBean.TYPE); - } - - /** @see ShutdownMBean#shutdown() */ - public void shutdown() - { - _logger.info("Shutting down at user's request"); - shutdownBroker(0); - } - - /** @see ShutdownMBean#shutdown(long) */ - public void shutdown(final long delay) - { - if (delay < 0) - { - _logger.info("Shutting down at user's request"); - shutdownBroker(0); - } - else - { - _logger.info("Scheduled broker shutdown after " + delay + "ms"); - shutdownBroker(delay); - } - } - - /** @see ShutdownMBean#shutdownAt(String) */ - public void shutdownAt(final String when) - { - Date date; - DateFormat df = new SimpleDateFormat(FORMAT); - try - { - date = df.parse(when); - } - catch (ParseException e) - { - _logger.error("Invalid date \"" + when + "\": expecting " + FORMAT, e); - return; - } - _logger.info("Scheduled broker shutdown at " + when); - long now = System.currentTimeMillis(); - long time = date.getTime(); - if (time > now) - { - shutdownBroker(time - now); - } - else - { - shutdownBroker(0); - } - } - - /** - * Submits the {@link SystemExiter} job to shutdown the broker. - */ - private void shutdownBroker(long delay) - { - EXECUTOR.schedule(_shutdown, delay, TimeUnit.MILLISECONDS); - } - - /** - * Shutting down the system in another thread to avoid JMX exceptions being thrown. - */ - class SystemExiter implements Runnable - { - public void run() - { - System.exit(0); - } - } - - /** - * @see org.apache.qpid.server.management.ManagedObject#getObjectInstanceName() - */ - @Override - public String getObjectInstanceName() - { - return "Shutdown"; - } -} diff --git a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/ShutdownMBean.java b/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/ShutdownMBean.java deleted file mode 100644 index 5c54fb3e21..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/org/apache/qpid/shutdown/ShutdownMBean.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.shutdown; - -import javax.management.MBeanOperationInfo; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -/** - * Shutdown plugin JMX MBean interface. - * - * Shuts the Qpid broker down via JMX. - */ -public interface ShutdownMBean -{ - static final String TYPE = "Shutdown"; - - /** - * Broker will be shut down immediately. - */ - @MBeanOperation(name="shutdown", description="Shut down immediately", impact = MBeanOperationInfo.ACTION) - public void shutdown(); - - /** - * Broker will be shutdown after the specified delay - * - * @param delay the number of ms to wait - */ - @MBeanOperation(name="shutdown", description="Shutdown after the specified delay (ms)", impact = MBeanOperationInfo.ACTION) - public void shutdown(@MBeanOperationParameter(name="when", description="delay (ms)")long delay); - - /** - * Broker will be shutdown at the specified date and time. - * - * @param when the date and time to shutdown - */ - @MBeanOperation(name="shutdownAt", description="Shutdown at the specified date and time (yyyy/MM/dd HH:mm:ss)", impact = MBeanOperationInfo.ACTION) - public void shutdownAt(@MBeanOperationParameter(name="when", description="shutdown date/time (yyyy/MM/dd HH:mm:ss)")String when); -} diff --git a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/shutdown.bnd b/qpid/java/broker-plugins/experimental/shutdown/src/main/java/shutdown.bnd deleted file mode 100755 index 60af4b89e8..0000000000 --- a/qpid/java/broker-plugins/experimental/shutdown/src/main/java/shutdown.bnd +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -ver: 0.17.0 - -Bundle-SymbolicName: qpid-shutdown-plugin -Bundle-Version: ${ver} -Export-Package: *;version=${ver} -Bundle-RequiredExecutionEnvironment: J2SE-1.5 |
