[jboss-dev-forums] [Design of POJO Server] - Re: ServiceControllerContext.target is null via @JMX

alesj do-not-reply at jboss.com
Fri Aug 8 07:41:53 EDT 2008


This would probably do the trick.
Legit enough?


  | Index: src/main/org/jboss/system/ServiceController.java
  | ===================================================================
  | --- src/main/org/jboss/system/ServiceController.java    (revision 76752)
  | +++ src/main/org/jboss/system/ServiceController.java    (working copy)
  | @@ -327,12 +327,12 @@
  |        register(serviceName, depends, true);
  |     }
  | 
  | -   public void register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLifecycle)  throws Excep
  | +   public ServiceControllerContext register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLife
  |     {
  |        if (serviceName == null)
  |        {
  |           log.warn("Ignoring request to register null service: ", new Exception("STACKTRACE"));
  | -         return;
  | +         return null;
  |        }
  | 
  |        log.debug("Registering service " + serviceName);
  | @@ -348,13 +348,14 @@
  |        {
  |           doInstall(controller, context);
  |           doChange(controller, context, ControllerState.CONFIGURED, "configure");
  | +         return context;
  |        }
  |        catch (Throwable t)
  |        {
  |           // Something went wrong
  |           safelyRemoveAnyRegisteredContext(context);
  | 
  | -         DeploymentException.rethrowAsDeploymentException("Error during register: " + serviceName, t);
  | +         throw DeploymentException.rethrowAsDeploymentException("Error during register: " + serviceName, t);
  |        }
  |     }
  | 
  | Index: src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java
  | ===================================================================
  | --- src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java    (revision 76752)
  | +++ src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java    (working copy)
  | @@ -23,7 +23,6 @@
  | 
  |  import java.util.HashMap;
  |  import java.util.Map;
  | -
  |  import javax.management.MBeanServer;
  |  import javax.management.ObjectName;
  |  import javax.management.StandardMBean;
  | @@ -34,6 +33,7 @@
  |  import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
  |  import org.jboss.logging.Logger;
  |  import org.jboss.mx.server.ServerConstants;
  | +import org.jboss.system.microcontainer.ServiceControllerContext;
  | 
  |  /**
  |   * ServiceControllerLifecycleCallback.
  | @@ -102,7 +102,9 @@
  |        {
  |           // Don't include the lifecycle callouts unless we know the MBean implementation
  |           // wants them and supports "double invocation"
  | -         getServiceController().register(objectName, null, false);
  | +         ServiceControllerContext scc = getServiceController().register(objectName, null, false);
  | +         if (scc != null)
  | +            scc.setTarget(context.getTarget());
  |        }
  |        catch (Exception e)
  |        {
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169570#4169570

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169570



More information about the jboss-dev-forums mailing list