use of javax.management.Notification in project geode by apache.
the class ManagementAdapter method handleRegionCreation.
/**
* Handles Region Creation. This is the call back which will create the specified RegionMXBean and
* will send a notification on behalf of Member Mbean
*
* @param region the region for which the call back is invoked
*/
public <K, V> void handleRegionCreation(Region<K, V> region) throws ManagementException {
if (!isServiceInitialised("handleRegionCreation")) {
return;
}
synchronized (regionOpLock) {
LocalRegion localRegion = (LocalRegion) region;
if (localRegion.isDestroyed()) {
return;
}
// Bridge is responsible for extracting data from GemFire Layer
RegionMBeanBridge<K, V> bridge = RegionMBeanBridge.getInstance(region);
RegionMXBean regionMBean = new RegionMBean<>(bridge);
ObjectName regionMBeanName = MBeanJMXAdapter.getRegionMBeanName(internalCache.getDistributedSystem().getDistributedMember(), region.getFullPath());
ObjectName changedMBeanName = service.registerInternalMBean(regionMBean, regionMBeanName);
service.federate(changedMBeanName, RegionMXBean.class, true);
Notification notification = new Notification(JMXNotificationType.REGION_CREATED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.REGION_CREATED_PREFIX + region.getFullPath());
memberLevelNotifEmitter.sendNotification(notification);
memberMBeanBridge.addRegion(region);
}
}
use of javax.management.Notification in project geode by apache.
the class DistributedSystemDUnitTest method addAlertListener.
private void addAlertListener(final VM managerVM) {
managerVM.invoke("addAlertListener", () -> {
AlertNotificationListener listener = AlertNotificationListener.getInstance();
listener.resetCount();
NotificationFilter notificationFilter = (Notification notification) -> notification.getType().equals(JMXNotificationType.SYSTEM_ALERT);
getPlatformMBeanServer().addNotificationListener(getDistributedSystemName(), listener, notificationFilter, null);
});
}
use of javax.management.Notification in project karaf by apache.
the class FeaturesServiceMBeanImpl method getFeaturesListener.
public FeaturesListener getFeaturesListener() {
return new FeaturesListener() {
public void featureEvent(FeatureEvent event) {
if (!event.isReplay()) {
Notification notification = new Notification(FEATURE_EVENT_TYPE, objectName, sequenceNumber++);
notification.setUserData(new JmxFeatureEvent(event).asCompositeData());
sendNotification(notification);
}
}
public void repositoryEvent(RepositoryEvent event) {
if (!event.isReplay()) {
Notification notification = new Notification(REPOSITORY_EVENT_TYPE, objectName, sequenceNumber++);
notification.setUserData(new JmxRepositoryEvent(event).asCompositeData());
sendNotification(notification);
}
}
};
}
use of javax.management.Notification in project logging-log4j2 by apache.
the class LoggerContextAdmin method propertyChange.
@Override
public void propertyChange(final PropertyChangeEvent evt) {
if (!LoggerContext.PROPERTY_CONFIG.equals(evt.getPropertyName())) {
return;
}
final Notification notif = new Notification(NOTIF_TYPE_RECONFIGURED, getObjectName(), nextSeqNo(), now(), null);
sendNotification(notif);
}
use of javax.management.Notification in project jdk8u_jdk by JetBrains.
the class RequiredModelMBean method sendNotification.
public void sendNotification(String ntfyText) throws MBeanException, RuntimeOperationsException {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(), "sendNotification(String)", "Entry");
}
if (ntfyText == null)
throw new RuntimeOperationsException(new IllegalArgumentException("notification message must not " + "be null"), "Exception occurred trying to send a text notification " + "from a ModelMBean");
Notification myNtfyObj = new Notification("jmx.modelmbean.generic", this, 1, ntfyText);
sendNotification(myNtfyObj);
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(), "sendNotification(String)", "Notification sent");
MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(), "sendNotification(String)", "Exit");
}
}
Aggregations