本文整理汇总了Java中javax.management.Notification.setUserData方法的典型用法代码示例。如果您正苦于以下问题:Java Notification.setUserData方法的具体用法?Java Notification.setUserData怎么用?Java Notification.setUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.Notification
的用法示例。
在下文中一共展示了Notification.setUserData方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGCNotification
import javax.management.Notification; //导入方法依赖的package包/类
void createGCNotification(long timestamp,
String gcName,
String gcAction,
String gcCause,
GcInfo gcInfo) {
if (!hasListeners()) {
return;
}
Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
getObjectName(),
getNextSeqNumber(),
timestamp,
gcName);
GarbageCollectionNotificationInfo info =
new GarbageCollectionNotificationInfo(gcName,
gcAction,
gcCause,
gcInfo);
CompositeData cd =
GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
notif.setUserData(cd);
sendNotification(notif);
}
示例2: createNotification
import javax.management.Notification; //导入方法依赖的package包/类
static void createNotification(String notifType,
String poolName,
MemoryUsage usage,
long count) {
MemoryImpl mbean = (MemoryImpl) ManagementFactory.getMemoryMXBean();
if (!mbean.hasListeners()) {
// if no listener is registered.
return;
}
long timestamp = System.currentTimeMillis();
String msg = getNotifMsg(notifType);
Notification notif = new Notification(notifType,
mbean.getObjectName(),
getNextSeqNumber(),
timestamp,
msg);
MemoryNotificationInfo info =
new MemoryNotificationInfo(poolName,
usage,
count);
CompositeData cd =
MemoryNotifInfoCompositeData.toCompositeData(info);
notif.setUserData(cd);
mbean.sendNotification(notif);
}
示例3: handleRegionLoss
import javax.management.Notification; //导入方法依赖的package包/类
/**
* Implementation should handle loss of region by extracting the details from the given event
* object and sending the {@link SystemMemberJmx#NOTIF_REGION_LOST} notification to the connected
* JMX Clients. Region Path is set as User Data in Notification. Additionally, it also clears the
* ManagedResources created for the region that is lost.
*
* @param event event object corresponding to the loss of a region
*/
public void handleRegionLoss(SystemMemberRegionEvent event) {
SystemMemberCacheJmxImpl cacheResource = this.managedSystemMemberCache;
if (cacheResource != null) {
ManagedResource cleanedUp = cacheResource.cleanupRegionResources(event.getRegionPath());
if (cleanedUp != null) {
MBeanUtil.unregisterMBean(cleanedUp);
}
}
Notification notification = new Notification(NOTIF_REGION_LOST, this.modelMBean,
Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));
notification.setUserData(event.getRegionPath());
Helper.sendNotification(this, notification);
}
示例4: handleSystemNotification
import javax.management.Notification; //导入方法依赖的package包/类
/**
* 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);
}
}
示例5: createGCNotification
import javax.management.Notification; //导入方法依赖的package包/类
protected void createGCNotification(long timestamp,
String gcName,
String gcAction,
String gcCause,
GcInfo gcInfo) {
if (!hasListeners()) {
return;
}
Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
getObjectName(),
getNextSeqNumber(),
timestamp,
gcName);
GarbageCollectionNotificationInfo info =
new GarbageCollectionNotificationInfo(gcName,
gcAction,
gcCause,
gcInfo);
CompositeData cd =
GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
notif.setUserData(cd);
sendNotification(notif);
}
示例6: flagChanged
import javax.management.Notification; //导入方法依赖的package包/类
@Override
public void flagChanged(T changedValue) {
Notification notification = new Notification(
flagName,
source,
eventCounter++,
changedValue.toString());
notification.setUserData(flag.getFlag());
nbs.sendNotification(notification);
}
示例7: sendNotification
import javax.management.Notification; //导入方法依赖的package包/类
/**
* sendNotification
*
* @param eventType
* @param data
* @param msg
*/
public void sendNotification(String eventType, Object data, String msg) {
Notification notif = new Notification(eventType, this, sequenceNumber
.incrementAndGet(), System.currentTimeMillis(), msg);
if (data != null) {
notif.setUserData(data);
}
emitter.sendNotification(notif);
}
示例8: sendNotification
import javax.management.Notification; //导入方法依赖的package包/类
/**
* sendNotification
*
* @param eventType
* @param data
* @param msg
*/
public void sendNotification(String eventType, Object data, String msg) {
Notification notif = new Notification(eventType, this, sequenceNumber
.incrementAndGet(), System.currentTimeMillis(), msg);
if (data != null) {
notif.setUserData(data);
}
emitter.sendNotification(notif);
}
示例9: handleRegionCreate
import javax.management.Notification; //导入方法依赖的package包/类
/**
* Implementation handles creation of region by extracting the details from the given event object
* and sending the {@link SystemMemberJmx#NOTIF_REGION_CREATED} notification to the connected JMX
* Clients. Region Path is set as User Data in Notification.
*
* @param event event object corresponding to the creation of a region
*/
public void handleRegionCreate(SystemMemberRegionEvent event) {
Notification notification = new Notification(NOTIF_REGION_CREATED, this.modelMBean,
Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));
notification.setUserData(event.getRegionPath());
Helper.sendNotification(this, notification);
}
示例10: createDiagnosticFrameworkNotification
import javax.management.Notification; //导入方法依赖的package包/类
private void createDiagnosticFrameworkNotification() {
if (!hasListeners()) {
return;
}
ObjectName on = null;
try {
on = ObjectName.getInstance(PlatformMBeanProviderImpl.DIAGNOSTIC_COMMAND_MBEAN_NAME);
} catch (MalformedObjectNameException e) { }
Notification notif = new Notification("jmx.mbean.info.changed",
on,
getNextSeqNumber());
notif.setUserData(getMBeanInfo());
sendNotification(notif);
}
示例11: doSendNotif
import javax.management.Notification; //导入方法依赖的package包/类
private synchronized void doSendNotif(String source, String msg, String userData) {
Notification notif = new Notification(SS7_EVENT + "-" + source, "TesterHost", ++sequenceNumber,
System.currentTimeMillis(), msg);
notif.setUserData(userData);
this.sendNotification(notif);
}
示例12: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
@Override
public void handleNotification(Notification notification, Object handback) {
NotificationKey key = new NotificationKey(name);
notification.setUserData(memberSource);
repo.putEntryInLocalNotificationRegion(key, notification);
}