use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class NettyAcceptor method stop.
@Override
public synchronized void stop() {
if (channelClazz == null) {
return;
}
if (protocolHandler != null) {
protocolHandler.close();
}
if (batchFlusherFuture != null) {
batchFlusherFuture.cancel(false);
flusher.cancel();
flusher = null;
batchFlusherFuture = null;
}
// serverChannelGroup has been unbound in pause()
if (serverChannelGroup != null) {
serverChannelGroup.close().awaitUninterruptibly();
}
if (channelGroup != null) {
ChannelGroupFuture future = channelGroup.close().awaitUninterruptibly();
if (!future.isSuccess()) {
ActiveMQServerLogger.LOGGER.nettyChannelGroupError();
for (Channel channel : future.group()) {
if (channel.isActive()) {
ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, channel.remoteAddress());
}
}
}
}
// Shutdown the EventLoopGroup if no new task was added for 100ms or if
// 3000ms elapsed.
eventLoopGroup.shutdownGracefully(100, 3000, TimeUnit.MILLISECONDS);
eventLoopGroup = null;
channelClazz = null;
for (Connection connection : connections.values()) {
listener.connectionDestroyed(connection.getID());
}
connections.clear();
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(NettyAcceptorFactory.class.getName()));
props.putSimpleStringProperty(new SimpleString("host"), new SimpleString(host));
props.putIntProperty(new SimpleString("port"), port);
Notification notification = new Notification(null, CoreNotificationType.ACCEPTOR_STOPPED, props);
try {
notificationService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.failedToSendNotification(e);
}
}
paused = false;
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class BridgeImpl method pause.
@Override
public void pause() throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("Bridge " + this.name + " being paused");
}
executor.execute(new PauseRunnable());
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STOPPED, props);
try {
notificationService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.notificationBridgeStoppedError(e);
}
}
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class BridgeImpl method start.
@Override
public synchronized void start() throws Exception {
if (started) {
return;
}
started = true;
stopping = false;
activate();
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STARTED, props);
notificationService.sendNotification(notification);
}
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class BroadcastGroupImpl method stop.
@Override
public synchronized void stop() {
if (!started) {
return;
}
if (future != null) {
future.cancel(false);
}
try {
endpoint.close(true);
} catch (Exception e1) {
ActiveMQServerLogger.LOGGER.broadcastGroupClosed(e1);
}
started = false;
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.BROADCAST_GROUP_STOPPED, props);
try {
notificationService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.broadcastGroupClosed(e);
}
}
}
use of org.apache.activemq.artemis.core.server.management.Notification in project activemq-artemis by apache.
the class ClusterConnectionImpl method activate.
private synchronized void activate() throws Exception {
if (!started) {
return;
}
if (logger.isDebugEnabled()) {
logger.debug("Activating cluster connection nodeID=" + nodeManager.getNodeId() + " for server=" + this.server);
}
liveNotifier = new LiveNotifier();
liveNotifier.updateAsLive();
liveNotifier.schedule();
serverLocator = clusterConnector.createServerLocator();
if (serverLocator != null) {
if (!useDuplicateDetection) {
logger.debug("DuplicateDetection is disabled, sending clustered messages blocked");
}
final TopologyMember currentMember = topology.getMember(manager.getNodeId());
if (currentMember == null) {
// sanity check only
throw new IllegalStateException("InternalError! The ClusterConnection doesn't know about its own node = " + this);
}
serverLocator.setNodeID(nodeManager.getNodeId().toString());
serverLocator.setIdentity("(main-ClusterConnection::" + server.toString() + ")");
serverLocator.setReconnectAttempts(0);
serverLocator.setClusterConnection(true);
serverLocator.setClusterTransportConfiguration(connector);
serverLocator.setInitialConnectAttempts(-1);
serverLocator.setClientFailureCheckPeriod(clientFailureCheckPeriod);
serverLocator.setConnectionTTL(connectionTTL);
serverLocator.setConfirmationWindowSize(confirmationWindowSize);
// if not using duplicate detection, we will send blocked
serverLocator.setBlockOnDurableSend(!useDuplicateDetection);
serverLocator.setBlockOnNonDurableSend(!useDuplicateDetection);
serverLocator.setCallTimeout(callTimeout);
serverLocator.setCallFailoverTimeout(callFailoverTimeout);
serverLocator.setProducerWindowSize(producerWindowSize);
if (retryInterval > 0) {
this.serverLocator.setRetryInterval(retryInterval);
}
serverLocator.setAfterConnectionInternalListener(this);
serverLocator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(serverLocator));
serverLocator.start(server.getExecutorFactory().getExecutor());
}
if (managementService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STARTED, props);
logger.debug("sending notification: " + notification);
managementService.sendNotification(notification);
}
// we add as a listener after we have sent the cluster start notif as the listener may start sending notifs before
addClusterTopologyListener(this);
}
Aggregations