Methods Summary |
---|
private void | addParentDependency(javax.management.ObjectName on)
//di.mbeans.add(on);
// this is done so that we can get dependency error messages.
// and this is the only reason this is done.
// if you don't put add to the top DI mbean list, then no dependency
// error message is printed out if there is one.
DeploymentInfo parent = di;
while (parent.parent != null)
{
parent = parent.parent;
}
parent.mbeans.add(on);
|
public void | install(java.lang.String name, DependencyPolicy dependencies, java.lang.Object service)
if (!(service instanceof ServiceMBeanSupport) && !(service instanceof DynamicMBean))
{
log.info("creating wrapper delegate for: " + service.getClass().getName());
// create mbean delegate.
if (service instanceof StatelessContainer)
{
service = new StatelessDelegateWrapper(service);
}
else if (service instanceof StatefulContainer)
{
service = new StatefulDelegateWrapper(service);
}
else if (service instanceof MDB)
{
service = new MdbDelegateWrapper(service);
}
else
{
service = new ServiceDelegateWrapper(service);
}
}
JmxDependencyPolicy policy = (JmxDependencyPolicy)dependencies;
try
{
log.info("installing MBean: " + name + " with dependencies:");
for (Object obj : policy.getDependencies())
{
log.info("\t" + obj);
}
ObjectName on = new ObjectName(name);
if(policy.getDependencies().contains(on))
throw new IllegalStateException("circular dependencies detected");
server.registerMBean(service, on);
addParentDependency(on);
serviceController.create(on, policy.getDependencies());
serviceController.start(on);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
|
public void | installMBean(javax.management.ObjectName on, DependencyPolicy dependencies, java.lang.Object service)
JmxDependencyPolicy policy = (JmxDependencyPolicy)dependencies;
try
{
server.registerMBean(service, on);
addParentDependency(on);
serviceController.create(on, policy.getDependencies());
serviceController.start(on);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
|
private void | removeParentDependency(javax.management.ObjectName on)
DeploymentInfo parent = di;
while (parent.parent != null)
{
parent = parent.parent;
}
parent.mbeans.remove(on);
|
public void | setMbeanServer(javax.management.MBeanServer server)
this.server = server;
|
public void | uninstall(java.lang.String name)
ObjectName on;
try
{
on = new ObjectName(name);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
uninstallMBean(on);
|
public void | uninstallMBean(javax.management.ObjectName on)
try
{
serviceController.stop(on);
serviceController.destroy(on);
serviceController.remove(on);
removeParentDependency(on);
if(server.isRegistered(on))
server.unregisterMBean(on);
else
log.warn(on + " is not registered");
}
catch (Exception e)
{
throw new RuntimeException(e);
}
|