List of usage examples for javax.management Notification Notification
public Notification(String type, Object source, long sequenceNumber, long timeStamp, String message)
From source file:de.iew.spring.integration.JmxTestServiceImpl.java
protected Notification buildNotification(String message) { String source = getClass().getName(); long timestamp = System.currentTimeMillis(); Notification notification = new Notification(JmxTestService.class.getName() + ".NOTIFICATION", source, notificationSequence++, timestamp, message); return notification; }
From source file:org.trpr.platform.core.impl.management.jmx.JMXNotificationDispatcher.java
/** * Sends the specified event details to an MBean Server by constructing a {@link javax.management.Notification} instance using the specified * event data.//from w w w. j a va 2s. com * @event the PlatformEvent whose data contents are sent to the MBean server */ public void dispatchPlatformEvent(PlatformEvent event) { String message = event.getEventMessage(); final Notification notification = new Notification(event.getClass().getName(), event.getEventSource(), event.getEntityIdentifier().getUniqueId(), event.getCreatedDate().getTimeInMillis(), getHostIP() + message); this.publisher.sendNotification(notification); this.eventNotificationCount++; }
From source file:com.heliosapm.tsdblite.metric.AppMetric.java
/** * Submits a new trace for this metric//from ww w . j av a 2 s . c om * @param trace The trace to apply */ public void submit(final Trace trace) { lastValue = trace.isDoubleType() ? trace.getDoubleValue() : trace.getLongValue(); lastSubmission = trace.getTimestampMs(); lastActivity = System.currentTimeMillis(); if (hasSubscribers()) { final long serial = notifSerial.incrementAndGet(); final Notification notif = new Notification(NOTIF_NEW_SUB, objectName, notifSerial.incrementAndGet(), lastSubmission, JSON.serializeToString(new SubNotif(objectName.toString(), trace.isDoubleType() ? trace.getDoubleValue() : trace.getLongValue(), lastSubmission, serial))); notif.setUserData(trace); sendNotification(notif); } }
From source file:org.trpr.platform.core.impl.management.jmx.JMXNotificationDispatcher.java
/** * Convenience method to dispatch Application and System exception details to the JMX sub-system * @param exception the Exception details to dispatch to JMX *///from ww w. j av a 2 s. c om public void dispatchException(Throwable exception, String source) { if (exception != null) { StringWriter writer = new StringWriter(); exception.printStackTrace(new PrintWriter(writer)); final Notification notification = new Notification(exception.getClass().getName(), source, exception.hashCode(), System.currentTimeMillis(), getHostIP() + exception.getMessage() + "\n" + writer.toString()); this.publisher.sendNotification(notification); this.exceptionNotificationCount++; } }
From source file:org.firstopen.singularity.cep.RuleService.java
/** * // www. ja v a 2 s. co m * <p> * Broadcasts a notification to the cluster partition. * * This example does * not ensure that a notification sequence number * is unique throughout the * partition. * </p> * * @param message * @throws InstanceNotFoundException * @throws MBeanException * @throws ReflectionException */ public void ruleChangeNotification(String message) { long now = System.currentTimeMillis(); Notification notification = new Notification("org.firstopen.singularity.rulechange", super.getServiceName(), now, now, message); sendNotification(notification); }
From source file:com.heliosapm.jmx.cache.CacheStatistics.java
/** * {@inheritDoc}//from w w w. j ava2s. c o m * @see com.google.common.cache.RemovalListener#onRemoval(com.google.common.cache.RemovalNotification) */ @Override public void onRemoval(RemovalNotification<Object, Object> removal) { final Notification notif = new Notification("cache.removal", objectName, sequence.incrementAndGet(), System.currentTimeMillis(), "Cache entry [" + removal.toString() + "] removed from cache [" + cacheName + "]. Cause:" + removal.getCause().name()); final JSONObject json = new JSONObject(); json.put("event", "cache.removal"); json.put("cacheName", cacheName); json.put("key", removal.getKey()); json.put("value", removal.getValue()); json.put("cause", removal.getCause().name()); notif.setUserData(json.toString()); sendNotification(notif); }
From source file:com.alibaba.dragoon.patrol.spring.DragoonMethodInterceptor.java
private Notification createAfterInvokeNotification(MethodInfo methodInfo) { Notification notification = new Notification("method.invokeAfter", methodStats.getNotificationSource(methodInfo), methodStats.createNotificationSequence(), System.currentTimeMillis(), methodInfo.getSignature()); return notification; }
From source file:com.alibaba.dragoon.patrol.spring.DragoonMethodInterceptor.java
private Notification createBeforeInvokeNotification(MethodInfo methodInfo, MethodInvocation invocation) { Notification notification = new Notification("method.invokeBefore", methodStats.getNotificationSource(methodInfo), methodStats.createNotificationSequence(), System.currentTimeMillis(), methodInfo.getSignature()); List<Object> args = new ArrayList<Object>(); for (int i = 0; i < invocation.getArguments().length; ++i) { Object arg = invocation.getArguments()[i]; if (arg == null) { args.add(null);/* ww w. j a v a2 s. c o m*/ } else { args.add(arg.toString()); } } notification.setUserData(args); return notification; }
From source file:org.apache.geode.management.internal.beans.ManagementAdapter.java
/** * Handles Region Creation. This is the call back which will create the specified RegionMXBean and * will send a notification on behalf of Member Mbean * //from w w w . j a v a 2 s .com * @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; } // Moving region creation operation inside a guarded block // After getting access to regionOpLock it again checks for region // destroy status 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); } }
From source file:org.apache.geode.management.internal.beans.ManagementAdapter.java
/** * Handles Disk Creation. Will create DiskStoreMXBean and will send a notification * /*from ww w.j av a 2s.com*/ * @param disk the disk store for which the call back is invoked */ public void handleDiskCreation(DiskStore disk) throws ManagementException { if (!isServiceInitialised("handleDiskCreation")) { return; } DiskStoreMBeanBridge bridge = new DiskStoreMBeanBridge(disk); DiskStoreMXBean diskStoreMBean = new DiskStoreMBean(bridge); ObjectName diskStoreMBeanName = MBeanJMXAdapter .getDiskStoreMBeanName(internalCache.getDistributedSystem().getDistributedMember(), disk.getName()); ObjectName changedMBeanName = service.registerInternalMBean(diskStoreMBean, diskStoreMBeanName); service.federate(changedMBeanName, DiskStoreMXBean.class, true); Notification notification = new Notification(JMXNotificationType.DISK_STORE_CREATED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.DISK_STORE_CREATED_PREFIX + disk.getName()); memberLevelNotifEmitter.sendNotification(notification); memberMBeanBridge.addDiskStore(disk); }