Java 8 NotificationBroadcasterSupport - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NotificationBroadcasterSupport class.

This code example shows how to use the following methods:sendNotification
            String type = event.getClass().getSimpleName();
            String message = event.toString();
            Notification notification = new Notification(type, source, counter.getAndIncrement(), message);
 
            LOG.trace("Broadcasting JMX notification: {}", notification);
            notificationBroadcaster.sendNotification(notification);
        } 
    } 
 
    public boolean isEnabled(EventObject event) {
        return true; 
    } 
 
    protected void doStart() throws Exception {
        counter.set(0);
    } 
 
    protected void doStop() throws Exception {
        // noop 
    } 
5
CodeRank
This code example shows how to use the following methods:
    private volatile long messages;
    private volatile long skippedMessages;
    // 
 
    public JMXActorMonitor(String name) {
        super(ActorMXBean.class, true, new NotificationBroadcasterSupport());
        this.name = beanName(name);
        LOG.info("Starting monitor {}: {}", name, this.name);
        lastCollectTime = nanoTime();
        refresh(); 
        registerMBean(); 
    } 
 
    private static String beanName(String name) {
        return "co.paralleluniverse:type=quasar,monitor=actor,name=" + name;
    } 
 
    @Override 
    public void setActor(ActorRef actor) {
        if (actor == null && this.actor == null)
5
CodeRank
This code example shows how to use the following methods:
    protected static ConcurrentHashMap<String,SlowQueryReportJmxMBean> mbeans =
        new ConcurrentHashMap<String,SlowQueryReportJmxMBean>();
 
 
    //==============================JMX STUFF======================== 
    protected volatile NotificationBroadcasterSupport notifier = new NotificationBroadcasterSupport();
 
    @Override 
    public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException {
        notifier.addNotificationListener(listener, filter, handback);
    } 
 
 
    @Override 
    public MBeanNotificationInfo[] getNotificationInfo() {
        return notifier.getNotificationInfo();
    } 
 
    @Override 
    public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
5
CodeRank
This code example shows how to use the following methods:
    private final MBeanInfo mbeanInfo;
 
    /** 
     * The broadcaster for notifications 
     */ 
    private final NotificationBroadcasterSupport notificationBroadcaster = new NotificationBroadcasterSupport();
    private final LifecycleBridge lifecycleBridge;
 
    public MBeanGBeanBridge(Kernel kernel, AbstractName abstractName, ObjectName objectName, MBeanInfo mbeanInfo) {
        this.kernel = kernel;
        this.abstractName = abstractName;
        this.pattern = new AbstractNameQuery(abstractName);
        this.mbeanInfo = mbeanInfo;
        this.objectName = objectName;
        lifecycleBridge = new LifecycleBridge(abstractName, objectName, notificationBroadcaster);
    } 
 
    public ObjectName getObjectName() {
        return objectName;
    } 
5
CodeRank
This code example shows how to use the following methods:
  private Vector vAttributes = new Vector();
  private String dClassName = this.getClass().getName();
  private String dDescription =
     "This MBean acts as a management facade for org.apache.log4j.Hierarchy."; 
 
  private NotificationBroadcasterSupport nbs = new NotificationBroadcasterSupport();
 
 
  private LoggerRepository hierarchy;
 
  private static Logger log = Logger.getLogger(HierarchyDynamicMBean.class);
 
  public HierarchyDynamicMBean() { 
    hierarchy = LogManager.getLoggerRepository();
    buildDynamicMBeanInfo(); 
  } 
 
  private 
  void buildDynamicMBeanInfo() { 
    Constructor[] constructors = this.getClass().getConstructors();
4
CodeRank
This code example shows how to use the following methods:
 * @version 0.1 
 */ 
public abstract class AMQManagedObject extends DefaultManagedObject 
                                       implements NotificationBroadcaster
{ 
    private final NotificationBroadcasterSupport _broadcaster = new NotificationBroadcasterSupport();
 
    private AtomicLong _notificationSequenceNumber = new AtomicLong();
 
    protected AMQManagedObject(Class<?> managementInterface, String typeName, ManagedObjectRegistry registry)
        throws NotCompliantMBeanException
    { 
        super(managementInterface, typeName, registry);
        // CurrentActor will be defined as these objects are created during 
        // broker startup. 
 
    } 
 
    // notification broadcaster implementation 
 
4
CodeRank
This code example shows how to use the following methods:sleep, addNotificationListener, setNotifyHigh, setNotifyLow, setThresholds
    /** 
     * Update the gauge and check for notifications 
     */ 
    public int gaugeMonitorNotification() throws Exception {
 
        GaugeMonitor gaugeMonitor = new GaugeMonitor();
        try { 
            // Create a new GaugeMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new GaugeMonitor MBean"); 
            ObjectName gaugeMonitorName = new ObjectName(
                            domain + ":type=" + GaugeMonitor.class.getName());
            server.registerMBean(gaugeMonitor, gaugeMonitorName);
 
            echo(">>> ADD a listener to the GaugeMonitor"); 
            gaugeMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

3
CodeRank
This code example shows how to use the following methods:sleep, addNotificationListener, setNotifyHigh, setNotifyLow, setThresholds
    /** 
     * Update the gauge and check for notifications 
     */ 
    public int gaugeMonitorNotification() throws Exception {
 
        GaugeMonitor gaugeMonitor = new GaugeMonitor();
        try { 
            // Create a new GaugeMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new GaugeMonitor MBean"); 
            ObjectName gaugeMonitorName = new ObjectName(
                            domain + ":type=" + GaugeMonitor.class.getName());
            server.registerMBean(gaugeMonitor, gaugeMonitorName);
 
            echo(">>> ADD a listener to the GaugeMonitor"); 
            gaugeMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

3
CodeRank
This code example shows how to use the following methods:
    private boolean timerStarted;
    private int timerPeriod = 5000;
    private final Timer timer = new Timer();
 
    public PeriodicMonitor(Class mbeanInterface, String name) {
        super(mbeanInterface, true, new NotificationBroadcasterSupport());
        this.name = name;
        this.lastCollectTime = System.currentTimeMillis();
        this.monitored = null;
    } 
 
    @Override 
    public void afterPropertiesSet() throws Exception {
        collectAndResetCounters1(); 
        registerMBean(); 
    } 
 
    @Override 
    public void destroy() throws Exception {
        unregisterMBean(); 
3
CodeRank
This code example shows how to use the following methods:removeNotificationListener
See Code Examples for Java 8 NotificationBroadcasterSupport Methods: