Package javax.management

Examples of javax.management.AttributeChangeNotification


                    };
                    manager.start();
                    while(true) {
                        final Notification n = queue.poll(10,TimeUnit.SECONDS);
                        if (n == null) break;
                        final AttributeChangeNotification at =
                                (AttributeChangeNotification) n;
                        if (RUNNING == ScanState.valueOf((String)at.getNewValue()))
                            break;
                        else {
                            System.err.println("New state: "+(String)at.getNewValue()
                            +" isn't "+RUNNING);
                        }
                    }
                    assertContained(EnumSet.of(SCHEDULED,RUNNING,COMPLETED),
                            proxy.getState());
View Full Code Here


                    notification.getType());
            assertEquals(AttributeChangeNotification.class,
                    notification.getClass());
            assertEquals(ScanManager.SCAN_MANAGER_NAME,
                    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

      public void handleNotification(Notification msg, Object handback)
      {
         if (msg instanceof AttributeChangeNotification)
         {
            AttributeChangeNotification change = (AttributeChangeNotification) msg;
            String attrName = change.getAttributeName();
            Object newValue = change.getNewValue();
            if ("State".equals(attrName) && newValue != null && newValue instanceof Integer)
            {
               notifications.add((Integer) newValue);
            }
         }
View Full Code Here

     * @throws RuntimeOperationsException
     */
    public void sendAttributeChangeNotification(Attribute oldAttr, Attribute newAttr) throws MBeanException,
            RuntimeOperationsException {
        if (!oldAttr.equals(newAttr)) {
            AttributeChangeNotification notification = new AttributeChangeNotification(objectName, 1, ((new Date())
                    .getTime()), "AttributeChange", oldAttr.getName(), (((newAttr.getValue()).getClass()).toString()),
                    oldAttr.getValue(), newAttr.getValue());
            sendAttributeChangeNotification(notification);
        }
    }
View Full Code Here

    public void instrumentUpdated(Instrument inst) {
    }

    public void updateInstrument(Instrument inst) {
            String name = inst.getName().toString();
            Notification n = new AttributeChangeNotification(this,
                    sequenceNumber ++,
                    System.currentTimeMillis(),
                    name + " updated",
                    name,
                    inst.getTypeString(),
View Full Code Here

  public synchronized void setStatus(String newStatus)
  {// based on http://download.oracle.com/javase/1.5.0/docs/guide/jmx/tutorial/essential.html#wp1053200
    String oldStatus = currentStatus;
    currentStatus=newStatus;
       Notification n =
              new AttributeChangeNotification(this,
                sequenceNumber++,
                System.currentTimeMillis(),
                "New status",
                "Status",
                "String",
View Full Code Here

    public void instrumentUpdated(Instrument inst) {
    }

    public void updateInstrument(Instrument inst) {
            String name = inst.getName().toString();
            Notification n = new AttributeChangeNotification(this,
                    sequenceNumber ++,
                    System.currentTimeMillis(),
                    name + " updated",
                    name,
                    inst.getTypeString(),
View Full Code Here

    public void instrumentUpdated(Instrument inst) {
    }

    public void updateInstrument(Instrument inst) {
            String name = inst.getName().toString();
            Notification n = new AttributeChangeNotification(this,
                    sequenceNumber ++,
                    System.currentTimeMillis(),
                    name + " updated",
                    name,
                    inst.getTypeString(),
View Full Code Here

  public synchronized void setStatus(String newStatus)
  {// based on http://download.oracle.com/javase/1.5.0/docs/guide/jmx/tutorial/essential.html#wp1053200
    String oldStatus = currentStatus;
    currentStatus=newStatus;
       Notification n =
              new AttributeChangeNotification(this,
                sequenceNumber++,
                System.currentTimeMillis(),
                "New status",
                "Status",
                "String",
View Full Code Here

  public synchronized void setStatus(String newStatus)
  {// based on http://download.oracle.com/javase/1.5.0/docs/guide/jmx/tutorial/essential.html#wp1053200
    String oldStatus = currentStatus;
    currentStatus=newStatus;
       Notification n =
              new AttributeChangeNotification(this,
                sequenceNumber++,
                System.currentTimeMillis(),
                "New status",
                "Status",
                "String",
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.