[Jboss-cvs] JBossAS SVN: r56936 - in branches/MC_VDF_WORK: system/src/main/org/jboss/system/server/profileservice system-jmx/src/main/org/jboss/system/server/jmx
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 18 09:23:24 EDT 2006
Author: adrian at jboss.org
Date: 2006-09-18 09:23:19 -0400 (Mon, 18 Sep 2006)
New Revision: 56936
Modified:
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
Log:
Make the startup notification stuff work and move the stop
notification to ServerImpl for symmetry.
Modified: branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java 2006-09-18 13:21:08 UTC (rev 56935)
+++ branches/MC_VDF_WORK/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java 2006-09-18 13:23:19 UTC (rev 56936)
@@ -750,7 +750,11 @@
public void shutdown()
{
- log.info("JBoss SHUTDOWN: Undeploying all packages");
+ // Send a notification that mbeanServer stop is initiated
+ log.info("JBoss SHUTDOWN");
+ Notification msg = new Notification(Server.STOP_NOTIFICATION_TYPE, this, 2);
+ sendNotification(msg);
+ log.info("Undeploying all packages");
shutdownDeployments();
log.debug("Shutting down Microcontainer");
Modified: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2006-09-18 13:21:08 UTC (rev 56935)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2006-09-18 13:23:19 UTC (rev 56936)
@@ -35,19 +35,16 @@
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
-import javax.management.Notification;
+import javax.management.NotificationEmitter;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import org.jboss.kernel.Kernel;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
import org.jboss.logging.JBossJDKLogManager;
import org.jboss.mx.loading.RepositoryClassLoader;
import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
import org.jboss.mx.util.JMXExceptionDecoder;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.mx.util.ObjectNameFactory;
@@ -69,7 +66,7 @@
* @version $Revision:$
*/
public class JMXKernel extends JBossObject
- implements JMXKernelMBean
+ implements JMXKernelMBean, NotificationEmitter
{
private final static ObjectName DEFAULT_LOADER_NAME =
ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
@@ -82,8 +79,8 @@
private ServerConfigImplMBean serverConfigMBean;
/** The kernel */
private Kernel kernel;
- /** The NotificationBroadcaster implementation delegate */
- private JBossNotificationBroadcasterSupport broadcasterSupport;
+ /** The serverImpl cast as an emitter */
+ private NotificationEmitter notificationEmitter;
/** The bootstrap UCL class loader ObjectName */
private ObjectName bootstrapUCLName;
@@ -98,6 +95,7 @@
public void setServerImpl(Server serverImpl)
{
this.serverImpl = serverImpl;
+ this.notificationEmitter = (NotificationEmitter) serverImpl;
}
public ServiceControllerMBean getServiceController()
@@ -121,8 +119,6 @@
public void start() throws Exception
{
- long start = System.currentTimeMillis();
-
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
// Create the MBeanServer
String builder = System.getProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY,
@@ -182,13 +178,6 @@
log.info("Legacy JMX core initialized");
started = true;
- long end = System.currentTimeMillis();
-
- // Send a notification that the startup is complete
- broadcasterSupport = new JBossNotificationBroadcasterSupport();
- Notification msg = new Notification(Server.START_NOTIFICATION_TYPE, this, 1);
- msg.setUserData(new Long(end - start));
- sendNotification(msg);
}
finally
{
@@ -229,29 +218,24 @@
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
{
- broadcasterSupport.addNotificationListener(listener, filter, handback);
+ notificationEmitter.addNotificationListener(listener, filter, handback);
}
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
{
- broadcasterSupport.removeNotificationListener(listener);
+ notificationEmitter.removeNotificationListener(listener);
}
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
throws ListenerNotFoundException
{
- broadcasterSupport.removeNotificationListener(listener, filter, handback);
+ notificationEmitter.removeNotificationListener(listener, filter, handback);
}
public MBeanNotificationInfo[] getNotificationInfo()
{
- return broadcasterSupport.getNotificationInfo();
+ return notificationEmitter.getNotificationInfo();
}
-
- public void sendNotification(Notification notification)
- {
- broadcasterSupport.sendNotification(notification);
- }
// ServerImplMBean delegation
public void init(Properties props) throws Exception
@@ -374,10 +358,6 @@
else
isInShutdown = true;
- // Send a notification that mbeanServer stop is initiated
- Notification msg = new Notification(Server.STOP_NOTIFICATION_TYPE, this, 2);
- sendNotification(msg);
-
// ServiceController.shutdown()
log.debug("Shutting down all services");
shutdownServices();
@@ -442,6 +422,9 @@
/**
* Initialize the boot libraries.
+ *
+ * @return the classloader
+ * @throws Exception for any error
*/
private RepositoryClassLoader initBootLibraries() throws Exception
{
@@ -497,6 +480,11 @@
/**
* Instantiate and register a service for the given classname into the MBean mbeanServer.
+ *
+ * @param classname the mbean class name
+ * @param name the obejct name
+ * @return the object name
+ * @throws Exception for any error
*/
private ObjectName createMBean(final String classname, String name)
throws Exception
More information about the jboss-cvs-commits
mailing list