use of javax.management.Notification in project cassandra by apache.
the class JMXProgressSupport method progress.
@Override
public void progress(String tag, ProgressEvent event) {
Notification notification = new Notification("progress", tag, notificationSerialNumber.getAndIncrement(), System.currentTimeMillis(), event.getMessage());
Map<String, Integer> userData = new HashMap<>();
userData.put("type", event.getType().ordinal());
userData.put("progressCount", event.getProgressCount());
userData.put("total", event.getTotal());
notification.setUserData(userData);
broadcaster.sendNotification(notification);
}
use of javax.management.Notification in project cassandra by apache.
the class StreamEventJMXNotifier method onSuccess.
public void onSuccess(StreamState result) {
Notification notif = new Notification(StreamEvent.class.getCanonicalName() + ".success", StreamManagerMBean.OBJECT_NAME, seq.getAndIncrement());
notif.setUserData(StreamStateCompositeData.toCompositeData(result));
sendNotification(notif);
}
use of javax.management.Notification in project tomcat by apache.
the class ConnectionPool method notify.
/**
* Return true if the notification was sent successfully, false otherwise.
* @param type The notification type
* @param message The message
* @return true if the notification succeeded
*/
public boolean notify(final String type, String message) {
try {
Notification n = new Notification(type, this, sequence.incrementAndGet(), System.currentTimeMillis(), "[" + type + "] " + message);
sendNotification(n);
for (NotificationListener listener : listeners) {
listener.handleNotification(n, this);
}
return true;
} catch (Exception x) {
if (log.isDebugEnabled()) {
log.debug("Notify failed. Type=" + type + "; Message=" + message, x);
}
return false;
}
}
use of javax.management.Notification in project tomcat by apache.
the class StandardWrapper method startInternal.
// ------------------------------------------------------ Lifecycle Methods
/**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
// Send j2ee.state.starting notification
if (this.getObjectName() != null) {
Notification notification = new Notification("j2ee.state.starting", this.getObjectName(), sequenceNumber++);
broadcaster.sendNotification(notification);
}
// Start up this component
super.startInternal();
setAvailable(0L);
// Send j2ee.state.running notification
if (this.getObjectName() != null) {
Notification notification = new Notification("j2ee.state.running", this.getObjectName(), sequenceNumber++);
broadcaster.sendNotification(notification);
}
}
use of javax.management.Notification in project groovy-core by groovy.
the class JmxEventEmitter method send.
/**
* Called to broadcast message on MBeanServer event bus. Internally, it calls
* NotificationBroadCasterSupport.sendNotification() method to dispatch the event.
*
* @param data - a data object sent as part of the event parameter.
* @return a sequence number associated with the emitted event.
*/
public long send(Object data) {
long seq = NumberSequencer.getNextSequence();
Notification note = new Notification(this.getEvent(), this, seq, System.currentTimeMillis(), "Event notification " + this.getEvent());
note.setUserData(data);
super.sendNotification(note);
return seq;
}
Aggregations