use of org.xwiki.observation.remote.RemoteEventException in project xwiki-platform by xwiki.
the class JGroupsNetworkAdapter method stopChannel.
@Override
public void stopChannel(String channelId) throws RemoteEventException {
JChannel channel = this.channels.get(channelId);
if (channel == null) {
throw new RemoteEventException(MessageFormat.format("Channel [{0}] is not started", channelId));
}
channel.close();
this.channels.remove(channelId);
// Unregister the channel from the JMX Server
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
JmxConfigurator.unregister(channel, mbs, channel.getClusterName());
} catch (Exception e) {
this.logger.warn("Failed to unregister channel [" + channelId + "] from the JMX Server", e);
}
this.logger.info("Channel [{}] stopped", channelId);
}
use of org.xwiki.observation.remote.RemoteEventException in project xwiki-platform by xwiki.
the class DefaultRemoteObservationManager method initialize.
@Override
public void initialize() throws InitializationException {
try {
String networkAdapterHint = this.configuration.getNetworkAdapter();
this.networkAdapter = this.componentManager.getInstance(NetworkAdapter.class, networkAdapterHint);
} catch (ComponentLookupException e) {
throw new InitializationException("Failed to initialize network adapter [" + this.configuration.getNetworkAdapter() + "]", e);
}
// Start configured channels and register them against the JMX server
for (String channelId : this.configuration.getChannels()) {
try {
startChannel(channelId);
} catch (RemoteEventException e) {
this.logger.error("Failed to start channel [" + channelId + "]", e);
}
}
}
use of org.xwiki.observation.remote.RemoteEventException in project xwiki-platform by xwiki.
the class JGroupsNetworkAdapter method startChannel.
@Override
public void startChannel(String channelId) throws RemoteEventException {
if (this.channels.containsKey(channelId)) {
throw new RemoteEventException(MessageFormat.format("Channel [{0}] already started", channelId));
}
JChannel channel;
try {
channel = createChannel(channelId);
channel.connect("event");
this.channels.put(channelId, channel);
} catch (Exception e) {
throw new RemoteEventException("Failed to create channel [" + channelId + "]", e);
}
// Register the channel against the JMX Server
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
JmxConfigurator.registerChannel(channel, mbs, channel.getClusterName());
} catch (Exception e) {
this.logger.warn("Failed to register channel [" + channelId + "] against the JMX Server", e);
}
this.logger.info("Channel [{}] started", channelId);
}
Aggregations