热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javax.management.Notification.getUserData()方法的使用及代码示例

本文整理了Java中javax.management.Notification.getUserData()方法的一些代码示例,展示了Notification

本文整理了Java中javax.management.Notification.getUserData()方法的一些代码示例,展示了Notification.getUserData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.getUserData()方法的具体详情如下:
包路径:javax.management.Notification
类名称:Notification
方法名:getUserData

Notification.getUserData介绍

暂无

代码示例

代码示例来源:origin: log4j/log4j

public
void handleNotification(Notification notification, Object handback) {
cat.debug("Received notification: "+notification.getType());
registerAppenderMBean((Appender) notification.getUserData() );
}

代码示例来源:origin: aragozin/jvm-tools

@Override
public void handleNotification(Notification notification, Object handback) {
try {
GcTracker tracker = (GcTracker) handback;
CompositeData cdata = (CompositeData) notification.getUserData();
CompositeData gcInfo = (CompositeData) cdata.get("gcInfo");
tracker.processGcEvent(gcInfo);
} catch (JMException e) {
// ignore
} catch (IOException e) {
// ignore
}
}
}

代码示例来源:origin: groovy/groovy-core

private static Map buildOperationNotificationPacket(Notification note) {
Map result = new HashMap();
result.put("event", note.getType());
result.put("source", note.getSource());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
result.put("data", note.getUserData());
return result;
}
}

代码示例来源:origin: btraceio/btrace

String notifType = notif.getType();
if (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
CompositeData cd = (CompositeData) notif.getUserData();
final MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
String name = info.getPoolName();

代码示例来源:origin: apache/geode

public static void handleNotification(SystemMemberJmx member, Notification notification,
Object hb) {
if (RefreshNotificationType.SYSTEM_MEMBER_CONFIG.getType().equals(notification.getType())
&& ((ManagedResource) member).getMBeanName().equals(notification.getUserData())) {

代码示例来源:origin: apache/geode

&& getMBeanName().equals(notification.getUserData())
&& !adminDSJmx.isRmiClientCountZero()) {
try {

代码示例来源:origin: Graylog2/graylog2-server

@Override
public void handleNotification(javax.management.Notification notification, Object handback) {
if (GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION.equals(notification.getType())) {
final GcInfo gcInfo = GarbageCollectionNotificationInfo.from((CompositeData) notification.getUserData()).getGcInfo();
final Duration duration = Duration.milliseconds(gcInfo.getDuration());
if (duration.compareTo(gcWarningThreshold) > 0) {
LOG.warn("Last GC run with {} took longer than {} (last duration={})",
gc.getName(), gcWarningThreshold, duration);
final Notification systemNotification = notificationService.buildNow()
.addNode(nodeId.toString())
.addTimestamp(Tools.nowUTC())
.addSeverity(Notification.Severity.URGENT)
.addType(Notification.Type.GC_TOO_LONG)
.addDetail("gc_name", gc.getName())
.addDetail("gc_duration_ms", duration.toMilliseconds())
.addDetail("gc_threshold_ms", gcWarningThreshold.toMilliseconds())
.addDetail("gc_collection_count", gc.getCollectionCount())
.addDetail("gc_collection_time", gc.getCollectionTime());
if (!notificationService.publishIfFirst(systemNotification)) {
LOG.debug("Couldn't publish notification: {}", notification);
}
}
}
}
};

代码示例来源:origin: apache/log4j

public
void handleNotification(Notification notification, Object handback) {
cat.debug("Received notification: "+notification.getType());
registerAppenderMBean((Appender) notification.getUserData() );
}

代码示例来源:origin: prometheus/client_java

@Override
public synchronized void handleNotification(Notification notification, Object handback) {
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData) notification.getUserData());
GcInfo gcInfo = info.getGcInfo();
Map memoryUsageBeforeGc = gcInfo.getMemoryUsageBeforeGc();
Map memoryUsageAfterGc = gcInfo.getMemoryUsageAfterGc();
for (Map.Entry entry : memoryUsageBeforeGc.entrySet()) {
String memoryPool = entry.getKey();
long before = entry.getValue().getUsed();
long after = memoryUsageAfterGc.get(memoryPool).getUsed();
handleMemoryPool(memoryPool, before, after);
}
}

代码示例来源:origin: hcoles/pitest

private static void addMemoryWatchDog(final Reporter r) {
final NotificationListener listener = (notification, handback) -> {
final String type = notification.getType();
if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED)) {
final CompositeData cd = (CompositeData) notification.getUserData();
final MemoryNotificationInfo memInfo = MemoryNotificationInfo
.from(cd);
CommandLineMessage.report(memInfo.getPoolName()
+ " has exceeded the shutdown threshold : " + memInfo.getCount()
+ " times.\n" + memInfo.getUsage());
r.done(ExitCode.OUT_OF_MEMORY);
} else {
LOG.warning("Unknown notification: " + notification);
}
};
MemoryWatchdog.addWatchDogToAllPools(90, listener);
}

代码示例来源:origin: spring-projects/spring-integration

@Test //INT-2275
public void publishStringMessageWithinChain() throws Exception {
assertNotNull(
this.beanFactory.getBean(
"chainWithJmxNotificationPublishing$child."
+ "jmx-notification-publishing-channel-adapter-within-chain.handler",
MessageHandler.class));
assertNull(listener.lastNotification);
Message message = MessageBuilder.withPayload("XYZ")
.setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
publishingWithinChainChannel.send(message);
assertNotNull(listener.lastNotification);
Notification notification = listener.lastNotification;
assertEquals("XYZ", notification.getMessage());
assertEquals("test.type", notification.getType());
assertNull(notification.getUserData());
Set names = server
.queryNames(new ObjectName("*:type=MessageHandler," + "name=\"chainWithJmxNotificationPublishing$child."
+ "jmx-notification-publishing-channel-adapter-within-chain\",*"), null);
assertEquals(1, names.size());
names = server
.queryNames(new ObjectName("*:type=MessageChannel,"
+ "name=org.springframework.integration.test.anon,source=anonymous,*"), null);
assertEquals(1, names.size());
}

代码示例来源:origin: spring-projects/spring-integration

@Test
public void publishUserData() throws Exception {
assertNull(listener.lastNotification);
TestData data = new TestData();
Message message = MessageBuilder.withPayload(data)
.setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
channel.send(message);
assertNotNull(listener.lastNotification);
Notification notification = listener.lastNotification;
assertNull(notification.getMessage());
assertEquals(data, notification.getUserData());
assertEquals("test.type", notification.getType());
}

代码示例来源:origin: spring-projects/spring-integration

@Test
public void publishStringMessage() throws Exception {
adviceCalled = 0;
assertNull(listener.lastNotification);
Message message = MessageBuilder.withPayload("XYZ")
.setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
channel.send(message);
assertNotNull(listener.lastNotification);
Notification notification = listener.lastNotification;
assertEquals("XYZ", notification.getMessage());
assertEquals("test.type", notification.getType());
assertNull(notification.getUserData());
assertEquals(1, adviceCalled);
}

代码示例来源:origin: Netflix/spectator

@Override public void handleNotification(Notification notification, Object ref) {
final String type = notification.getType();
if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
CompositeData cd = (CompositeData) notification.getUserData();
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
processGcEvent(info);
}
}
}

代码示例来源:origin: org.apache.activemq/activemq-all

public
void handleNotification(Notification notification, Object handback) {
cat.debug("Received notification: "+notification.getType());
registerAppenderMBean((Appender) notification.getUserData() );
}

代码示例来源:origin: com.netflix.spectator/spectator-ext-gc

@Override public void handleNotification(Notification notification, Object ref) {
final String type = notification.getType();
if (type.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
CompositeData cd = (CompositeData) notification.getUserData();
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
processGcEvent(info);
}
}
}

代码示例来源:origin: org.codehaus.groovy/groovy-jmx

private static Map buildOperationNotificationPacket(Notification note) {
Map result = new HashMap();
result.put("event", note.getType());
result.put("source", note.getSource());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
result.put("data", note.getUserData());
return result;
}
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

public
void handleNotification(Notification notification, Object handback) {
cat.debug("Received notification: "+notification.getType());
registerAppenderMBean((Appender) notification.getUserData() );
}

代码示例来源:origin: apache-log4j/log4j

public
void handleNotification(Notification notification, Object handback) {
cat.debug("Received notification: "+notification.getType());
registerAppenderMBean((Appender) notification.getUserData() );
}

代码示例来源:origin: mx4j/mx4j-tools

protected void onSerialize(SerializationContext context, Notification notification) throws IOException
{
context.serialize(CLASS_NAME_QNAME, null, notification.getType());
context.serialize(SOURCE_QNAME, null, notification.getSource());
context.serialize(SEQUENCE_NUMBER_QNAME, null, new Long(notification.getSequenceNumber()));
context.serialize(TIMESTAMP_QNAME, null, new Long(notification.getTimeStamp()));
context.serialize(MESSAGE_QNAME, null, notification.getMessage());
context.serialize(USER_DATA_QNAME, null, notification.getUserData());
}

推荐阅读
author-avatar
小攸罗曼史
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有