On 07/23/2013 07:14 PM, George Vagenas wrote:
For the Mobicent SIP Servlet project that is build on top of AS7, we
have some CLI operations to list available SIP Servlet application, to
gracefuly stop the context and the server. These operations work fine
when the server runs in standalone mode using the command:
/subsystem=sip:listSipAppplications
But when running in domain mode the command should be (sip subsystem
belongs to the default profile) :
/profile=default/subsystem=sip:listSipAppplications
But then we get an NPE because the context that the operation executes
is not a normal server:
I assume you mean the SipApplicationDispatcher is null in the domain?
This would be expected, since the domain controller does not start any
subsystem services.
@Override
public void execute(OperationContext context, ModelNode operation)
throws OperationFailedException {
ModelNode result = context.getResult();
result.get("AppName").setEmptyList();
if(context.isNormalServer()){
SipApplicationDispatcher sipApplicationDispatcher =
StaticServiceHolder.sipStandardService.getSipApplicationDispatcher();
Iterator<SipContext> sipApps =
sipApplicationDispatcher.findSipApplications();
while(sipApps.hasNext()){
result.get("AppName").add(sipApps.next().getApplicationName());
}
} else {
throw new OperationFailedException(new ModelNode().set("Operation
available only a Server"));
}
context.completeStep();
}
Is there a way we can specify a server node that the operation should
execute?
No, not at the subsystem level. If you just allow the operation to
complete in the domain, the domain controller should push out this
operation to each server associated with this profile.
Also, in standalone mode, we gracefuly shutdown the server and the
contexts running using the following:
protected void shutdownServer() throws MalformedObjectNameException,
NullPointerException, InstanceNotFoundException, MBeanException,
ReflectionException, IOException{
MBeanServerConnection mbeanServerConnection =
ManagementFactory.getPlatformMBeanServer();
ObjectName mbeanName = new ObjectName("jboss.as:management-root=server");
Object[] args = {false};
String[] sigs = {"java.lang.Boolean"};
mbeanServerConnection.invoke(mbeanName, "shutdown", args, sigs);
}
And this one fails when server runs in domain mode.
Any ideas?
Again assuming you are trying to execute this operation on the server
directly - this is expected since the lifecycle is controlled by the
host-controller and the model on the server is set to read-only.
Emanuel