final String mcastAddr = resolvedOp.get(MULTICAST_ADDRESS).isDefined() ? resolvedOp.get(MULTICAST_ADDRESS).asString() : null;
final int mcastPort = resolvedOp.get(MULTICAST_PORT).isDefined() ? resolvedOp.get(MULTICAST_PORT).asInt() : 0;
try {
InetAddress mcastInet = mcastAddr == null ? null : InetAddress.getByName(mcastAddr);
final SocketBindingService service = new SocketBindingService(name, port, fixedPort, mcastInet, mcastPort);
final ServiceBuilder<SocketBinding> builder = serviceTarget.addService(SocketBinding.JBOSS_BINDING_NAME.append(name), service);
if (intf != null) {
builder.addDependency(NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(intf), NetworkInterfaceBinding.class, service.getInterfaceBinding());
}
builder.addDependency(SocketBindingManager.SOCKET_BINDING_MANAGER, SocketBindingManager.class, service.getSocketBindings())
.setInitialMode(Mode.ON_DEMAND)
.install();
resultHandler.handleResultComplete();
} catch (UnknownHostException e) {