Package javax.management

Examples of javax.management.AttributeChangeNotification


            }
            return;
         }
         else if(notification instanceof AttributeChangeNotification)
         {
            AttributeChangeNotification ch = (AttributeChangeNotification) notification;
            if(ch.getAttributeName().equals("State") && hasActions())
            {
               MBeanServerLocator server = (MBeanServerLocator) o;
               Object src = ch.getSource();
               if(src instanceof ObjectName)
               {
                  ObjectName obj = (ObjectName) src;
                  // indicate the state changed
                  fireStateChange(new MBeanLocator(server, obj), ((Integer) ch.getOldValue()).intValue(), ((Integer) ch.getNewValue()).intValue());
                  return;
               }
               else if(src instanceof MBeanLocator)
               {
                  fireNotification((MBeanLocator) src, notification, o);
View Full Code Here


            .append(oldState).append(" (").append(oldStateString)
            .append(") to ").append(newState).append(" (")
            .append(newStateString).append(").").toString();

        notifCount++;
        AttributeChangeNotification notif =
            new AttributeChangeNotification(this,    // source
                         notifCount,                 // sequence number
                         System.currentTimeMillis(), // time stamp
                         message,                    // message
                         "State",                    // attribute name
                         "int",                      // attribute type
View Full Code Here

    public Object ping (Object pong)
    {
        Notification notification = new Notification("pong",objectName,System.currentTimeMillis());
        broadcaster.sendNotification(notification);
            log.debug("ping called: "+pong+", sending notification: "+notification+" for objectName: "+objectName);
        Notification stateChange = new AttributeChangeNotification(objectName,System.currentTimeMillis(),System.currentTimeMillis(),"State Changed","State",Integer.class.getName(),new Integer(1),new Integer(2));
        broadcaster.sendNotification(stateChange);
        return pong;
    }
View Full Code Here

   {
      log.info("handleNotification: " + notif);
     
      if (notif instanceof AttributeChangeNotification)
      {
         AttributeChangeNotification avc = (AttributeChangeNotification)notif;
        
         if (avc.getAttributeName().equals("Attr1"))
         {
            Boolean newValue = (Boolean)avc.getNewValue();
           
            if (Boolean.TRUE.equals(newValue))
               this.gotAttr1AVC = true;
         }
      }
View Full Code Here

      assertEquals("method not invoked as expected", this.haServiceMBeanSupportTester.invocationStack.pop(), "sendNotificationToLocalListeners");
   }
  
   public void testSendLifecycleNotifications()
   {
      Notification notification = new AttributeChangeNotification(this.haServiceMBeanSupportTester, 1, System.currentTimeMillis(), "test", "State", "java.lang.Integer", new Integer(0), new Integer(1));
      
      this.haServiceMBeanSupportTester.setSendRemoteLifecycleNotifications(false);
      
      this.haServiceMBeanSupportTester.sendNotification( notification );
      
View Full Code Here

      .append(oldState).append(" (").append(oldStateString)
      .append(") to ").append(newState).append(" (")
      .append(newStateString).append(").").toString();

  notifCount++;
  AttributeChangeNotification notif =
      new AttributeChangeNotification(this,    // source
             notifCount,               // sequence number
       System.currentTimeMillis(), // time stamp
       message,         // message
       "State",         // attribute name
       "int",           // attribute type
View Full Code Here

  if (newVal != null)
      className = newVal.getClass().getName();   
  if (oldVal != null)
      className = oldVal.getClass().getName();
 
  AttributeChangeNotification myNtfyObj = new
      AttributeChangeNotification(this,
          1,
          ((new Date()).getTime()),
          "AttributeChangeDetected",
          inOldVal.getName(),
View Full Code Here

    private void queueStateChangedNotification(
                    long sequence,
                    long time,
                    ScanState old,
                    ScanState current) {
        final AttributeChangeNotification n =
                new AttributeChangeNotification(SCAN_MANAGER_NAME,sequence,time,
                "ScanManager State changed to "+current,"State",
                ScanState.class.getName(),old.toString(),current.toString());
        // Queue the notification. We have created an unlimited queue, so
        // this method should always succeed.
        try {
View Full Code Here

    //
    private final void setStateAndNotify(ScanState desired) {
        final ScanState old = state;
        if (old == desired) return;
        state = desired;
        final AttributeChangeNotification n =
                new AttributeChangeNotification(this,
                getNextSeqNumber(),System.currentTimeMillis(),
                "state change","State",ScanState.class.getName(),
                String.valueOf(old),String.valueOf(desired));
        broadcaster.sendNotification(n);
    }
View Full Code Here

                    notification.getType());
            assertEquals(AttributeChangeNotification.class,
                    notification.getClass());
            assertEquals(getObjectName(proxy),
                    notification.getSource());
            AttributeChangeNotification acn =
                    (AttributeChangeNotification)notification;
            assertEquals("State",acn.getAttributeName());
            assertEquals(ScanState.class.getName(),acn.getAttributeType());
            assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
            assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
            emitter.removeNotificationListener(listener,filter,handback);
        } finally {
            try {
                op.cancel();
            } catch (Exception x) {
View Full Code Here

TOP

Related Classes of javax.management.AttributeChangeNotification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.