本文整理匯總了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);
}