@Override public String toString() { return super.toString() + ", name=" + name; } }
public void handleNotification(Notification note, Object handback) { System.out.println("Notification " + note.toString() + " received"); }
@Override public String toString() { return super.toString() + ", name=" + name; } }
@Override public String toString() { return super.toString() + ", name=" + name; } }
@Override public String toString() { return super.toString() + ", name=" + name; } }
@Override public String toString() { return super.toString() + ", name=" + name; } }
@Override public void handleNotification(Notification notification, Object handback) { assertNotNull(notification); String notifStr = notification.toString(); if (notifStr.contains("Warninglevel")) { ++warnigAlertCount; } if (notifStr.contains("Severelevel")) { ++severAlertCount; } }
/** Use of generic type form taking Class<T> is preferred. */ public static Serializable getAMXNotificationValue(final Notification notif, final String key) { final Map<String, Serializable> data = getAMXNotificationData(notif); if (data == null) { throw new IllegalArgumentException(notif.toString()); } if (!data.containsKey(key)) { throw new IllegalArgumentException("Value not found for " + key + " in " + notif); } return data.get(key); }
/** Use of generic type form taking Class<T> is preferred. */ public static Serializable getAMXNotificationValue(final Notification notif, final String key) { final Map<String, Serializable> data = getAMXNotificationData(notif); if (data == null) { throw new IllegalArgumentException(notif.toString()); } if (!data.containsKey(key)) { throw new IllegalArgumentException("Value not found for " + key + " in " + notif); } return data.get(key); }
/** * This is invoked when a JMX notification is received from an instance * Event Notifier MBean with which this MBean has registered as a * notification listener. If notifications are enabled, this resends the * notification without modification; otherwise, this does nothing. * * @param notification The notification object. * @param handback An object reference that was used when this MBean * registered as a listener with the instance Event Notifier MBean. In * this case, it is the instance name. */ public void handleNotification(Notification notification, Object handback) { mLog.log(Level.FINER, "Received notification from instance {0}: {1}", new Object[]{(String) handback, notification.toString()}); if ( mNotificationsEnabled ) { mLog.finer("Forwarding notification"); sendNotification(notification); } }
@Override public void handleNotification(Notification notification, Object handback) { assertNotNull(notification); Notification rn = notification; assertTrue(rn.getType().equals(ResourceNotification.REGION_CREATED) || rn.getType().equals(ResourceNotification.REGION_CLOSED)); getLogWriter().info( "<ExpectedString> Member Level Notifications" + rn.toString() + "</ExpectedString> "); }
/** * Set the notification to be used as the data source. Load the hashmap * with all of the notification contents. Note that the keys are used * as attribute tags in the mapping resource file * * @param n the notification to be used as data source at subsequent calls * of get() **/ public void prime(Notification n) { // Get fixed event payload and general info this.payload.put(MESSAGE_TAG, n.getMessage()); this.payload.put(SEQNO_TAG, new Long(n.getSequenceNumber())); this.payload.put(TSTAMP_TAG, new Long(n.getTimeStamp())); this.payload.put(TYPE_TAG, n.getType()); this.payload.put(ALL_TAG, n.toString()); this.payload.put(CLASS_TAG, n.getClass().getName()); // Check if event contains anything in the user field. If there is, an // attempt is made to interpret it as a hash map and copy it. Note // that previous content may be overwritten if the same keys as above // are used Object userData = n.getUserData(); if (userData instanceof Map) { // Copy all of the user data in the payload this.payload.putAll((Map)userData); } else { this.payload.put(USERDATA_TAG, userData); } } // prime
/** * Set the notification to be used as the data source. Load the hashmap * with all of the notification contents. Note that the keys are used * as attribute tags in the mapping resource file * * @param n the notification to be used as data source at subsequent calls * of get() **/ public void prime(Notification n) { // Get fixed event payload and general info this.payload.put(MESSAGE_TAG, n.getMessage()); this.payload.put(SEQNO_TAG, new Long(n.getSequenceNumber())); this.payload.put(TSTAMP_TAG, new Long(n.getTimeStamp())); this.payload.put(TYPE_TAG, n.getType()); this.payload.put(ALL_TAG, n.toString()); this.payload.put(CLASS_TAG, n.getClass().getName()); // Check if event contains anything in the user field. If there is, an // attempt is made to interpret it as a hash map and copy it. Note // that previous content may be overwritten if the same keys as above // are used Object userData = n.getUserData(); if (userData instanceof Map) { // Copy all of the user data in the payload this.payload.putAll((Map)userData); } else { this.payload.put(USERDATA_TAG, userData); } } // prime
@Override public void handleNotification(Notification notification, Object handback) { assertNotNull(notification); getLogWriter().info("Expected String :" + notification.toString()); }
@Override public void handleNotification(Notification notification, Object handback) { assertNotNull(notification); Notification rn = notification; getLogWriter().info( "<ExpectedString> Distributed System Notifications" + rn.toString() + "</ExpectedString> "); }
public void handleNotification(final Notification notifIn, final Object handback) { if (!(notifIn instanceof MBeanServerNotification)) { throw new IllegalArgumentException(notifIn.toString()); } final MBeanServerNotification notif = (MBeanServerNotification) notifIn; final ObjectName objectName = notif.getMBeanName(); final String type = notif.getType(); final boolean matchesFilter = (mRegUnregFilter == null) || JMXUtil.matchesPattern(mDefaultDomain, mRegUnregFilter, objectName); if (matchesFilter) { if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) { mbeanRegistered(objectName); } else if (type.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) { mbeanUnregistered(objectName); } } }
public void handleNotification(final Notification notifIn, final Object handback) { if (!(notifIn instanceof MBeanServerNotification)) { throw new IllegalArgumentException(notifIn.toString()); } final MBeanServerNotification notif = (MBeanServerNotification) notifIn; final ObjectName objectName = notif.getMBeanName(); final String type = notif.getType(); final boolean matchesFilter = (mRegUnregFilter == null) || JMXUtil.matchesPattern(mDefaultDomain, mRegUnregFilter, objectName); if (matchesFilter) { if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) { mbeanRegistered(objectName); } else if (type.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) { mbeanUnregistered(objectName); } } }
/** * * @param notif */ protected void sendNotification(final Notification notif) { try { if (modelMBean != null) { modelMBean.sendNotification(notif); } else { logger.info("Can't send notification " + notif.toString()); } } catch (RuntimeOperationsException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MBeanException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
notif.setUserData(userData); mLog.log(Level.FINER, "Sending notification: {0} sequence number {1}", new Object[]{notif.toString(), notif.getSequenceNumber()}); mExecSvc.execute(new Notify(this, notif)); return notif;
notif.setUserData(userData); mLog.log(Level.FINER, "Sending notification: {0} sequence number {1}", new Object[]{notif.toString(), notif.getSequenceNumber()}); mExecSvc.execute(new Notify(this, notif)); return notif;