热门标签 | 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());
}

推荐阅读
  • 1Lock与ReadWriteLock1.1LockpublicinterfaceLock{voidlock();voidlockInterruptibl ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • 线上问题:JavaBean赋值基础类型抛出异常
    1问题复现1.1问题实体(JavaBean规范)赋值时,抛出异常。1.2原因使用基础类型定义属性,当使用null给属 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 怀疑是每次都在新建文件,具体代码如下 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 本文讨论了clone的fork与pthread_create创建线程的不同之处。进程是一个指令执行流及其执行环境,其执行环境是一个系统资源的集合。在调用系统调用fork创建一个进程时,子进程只是完全复制父进程的资源,这样得到的子进程独立于父进程,具有良好的并发性。但是二者之间的通讯需要通过专门的通讯机制,另外通过fork创建子进程系统开销很大。因此,在某些情况下,使用clone或pthread_create创建线程可能更加高效。 ... [详细]
  • 深入理解Kafka服务端请求队列中请求的处理
    本文深入分析了Kafka服务端请求队列中请求的处理过程,详细介绍了请求的封装和放入请求队列的过程,以及处理请求的线程池的创建和容量设置。通过场景分析、图示说明和源码分析,帮助读者更好地理解Kafka服务端的工作原理。 ... [详细]
  • 深入理解Java虚拟机的并发编程与性能优化
    本文主要介绍了Java内存模型与线程的相关概念,探讨了并发编程在服务端应用中的重要性。同时,介绍了Java语言和虚拟机提供的工具,帮助开发人员处理并发方面的问题,提高程序的并发能力和性能优化。文章指出,充分利用计算机处理器的能力和协调线程之间的并发操作是提高服务端程序性能的关键。 ... [详细]
  • packagecom.huawei.it.citools.utils;importjava.io.File;importjava.io.IOException;importjava ... [详细]
  • 介绍怎样在IntellijIdea中通过创建mavenproject配置MapReduce的编程环境。一、软件环境我使用的软件版本号例如以下:IntellijIdea2017.1M ... [详细]
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社区 版权所有