use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleAsyncEventQueueRemoval.
/**
* Handles AsyncEventQueue Removal
*
* @param queue The AsyncEventQueue being removed
*/
public void handleAsyncEventQueueRemoval(AsyncEventQueue queue) throws ManagementException {
if (!isServiceInitialised("handleAsyncEventQueueRemoval")) {
return;
}
ObjectName asycnEventQueueMBeanName = MBeanJMXAdapter.getAsycnEventQueueMBeanName(internalCache.getDistributedSystem().getDistributedMember(), queue.getId());
AsyncEventQueueMBean bean;
try {
bean = (AsyncEventQueueMBean) service.getLocalAsyncEventQueueMXBean(queue.getId());
if (bean == null) {
return;
}
} catch (ManagementException e) {
// If no bean found its a NO-OP
if (logger.isDebugEnabled()) {
logger.debug(e.getMessage(), e);
}
return;
}
bean.stopMonitor();
service.unregisterMBean(asycnEventQueueMBeanName);
Notification notification = new Notification(JMXNotificationType.ASYNC_EVENT_QUEUE_CLOSED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.ASYNC_EVENT_QUEUE_CLOSED_PREFIX + queue.getId());
memberLevelNotifEmitter.sendNotification(notification);
}
use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleGatewaySenderCreation.
/**
* Handles GatewaySender creation
*
* @param sender the specific gateway sender
* @throws ManagementException
*/
public void handleGatewaySenderCreation(GatewaySender sender) throws ManagementException {
if (!isServiceInitialised("handleGatewaySenderCreation")) {
return;
}
GatewaySenderMBeanBridge bridge = new GatewaySenderMBeanBridge(sender);
GatewaySenderMXBean senderMBean = new GatewaySenderMBean(bridge);
ObjectName senderObjectName = MBeanJMXAdapter.getGatewaySenderMBeanName(internalCache.getDistributedSystem().getDistributedMember(), sender.getId());
ObjectName changedMBeanName = service.registerInternalMBean(senderMBean, senderObjectName);
service.federate(changedMBeanName, GatewaySenderMXBean.class, true);
Notification notification = new Notification(JMXNotificationType.GATEWAY_SENDER_CREATED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.GATEWAY_SENDER_CREATED_PREFIX);
memberLevelNotifEmitter.sendNotification(notification);
}
use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleCacheServerStop.
/**
* Assumption is its a cache server instance. For Gateway receiver there will be a separate method
*
* @param server cache server instance
*/
public void handleCacheServerStop(CacheServer server) {
if (!isServiceInitialised("handleCacheServerStop")) {
return;
}
CacheServerMBean mbean = (CacheServerMBean) service.getLocalCacheServerMXBean(server.getPort());
ClientMembershipListener listener = mbean.getBridge().getClientMembershipListener();
if (listener != null) {
ClientMembership.unregisterClientMembershipListener(listener);
}
mbean.stopMonitor();
ObjectName cacheServerMBeanName = MBeanJMXAdapter.getClientServiceMBeanName(server.getPort(), internalCache.getDistributedSystem().getDistributedMember());
service.unregisterMBean(cacheServerMBeanName);
Notification notification = new Notification(JMXNotificationType.CACHE_SERVER_STOPPED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.CACHE_SERVER_STOPPED_PREFIX);
memberLevelNotifEmitter.sendNotification(notification);
memberMBeanBridge.setCacheServer(false);
}
use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleSystemNotification.
/**
* Sends the alert with the Object source as member. This notification will get filtered out for
* particular alert level
*
* @param details
*/
public void handleSystemNotification(AlertDetails details) {
if (!isServiceInitialised("handleSystemNotification")) {
return;
}
if (service.isManager()) {
String systemSource = "DistributedSystem(" + service.getDistributedSystemMXBean().getDistributedSystemId() + ")";
Map<String, String> userData = prepareUserData(details);
Notification notification = new Notification(JMXNotificationType.SYSTEM_ALERT, systemSource, SequenceNumber.next(), details.getMsgTime().getTime(), details.getMsg());
notification.setUserData(userData);
service.handleNotification(notification);
}
}
use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleLocatorStart.
/**
* Handles management side call backs for a locator creation and start. Assumption is a cache will
* be created before hand.
*
* There is no corresponding handleStopLocator() method. Locator will close the cache whenever its
* stopped and it should also shutdown all the management services by closing the cache.
*
* @param locator instance of locator which is getting started
* @throws ManagementException
*/
public void handleLocatorStart(Locator locator) throws ManagementException {
if (!isServiceInitialised("handleLocatorCreation")) {
return;
}
ObjectName locatorMBeanName = MBeanJMXAdapter.getLocatorMBeanName(internalCache.getDistributedSystem().getDistributedMember());
LocatorMBeanBridge bridge = new LocatorMBeanBridge(locator);
LocatorMBean locatorMBean = new LocatorMBean(bridge);
ObjectName changedMBeanName = service.registerInternalMBean((LocatorMXBean) locatorMBean, locatorMBeanName);
service.federate(changedMBeanName, LocatorMXBean.class, true);
Notification notification = new Notification(JMXNotificationType.LOCATOR_STARTED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.LOCATOR_STARTED_PREFIX);
memberLevelNotifEmitter.sendNotification(notification);
}
Aggregations