javax.management.AttributeChangeNotification.<init>()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(35)

本文整理了Java中javax.management.AttributeChangeNotification.<init>()方法的一些代码示例,展示了AttributeChangeNotification.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeChangeNotification.<init>()方法的具体详情如下:
包路径:javax.management.AttributeChangeNotification
类名称:AttributeChangeNotification
方法名:<init>

AttributeChangeNotification.<init>介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

/**
   * Helper for sending out state change notifications
   */
  private void sendStateChangeNotification(int oldState, int newState, String msg, Throwable t) {
    long now = System.currentTimeMillis();
    AttributeChangeNotification stateChangeNotification = new AttributeChangeNotification(this,
        getNextNotificationSequenceNumber(), now, msg, "State", "java.lang.Integer", new Integer(oldState),
        new Integer(newState));
    stateChangeNotification.setUserData(t);
    sendNotification(stateChangeNotification);
  }
}

代码示例来源:origin: apache/geode

@Override
public void sendAttributeChangeNotification(Attribute oldAttribute, Attribute newAttribute)
  throws MBeanException, RuntimeOperationsException {
 if (oldAttribute == null || newAttribute == null)
  throw new RuntimeOperationsException(new IllegalArgumentException(
    "Attribute cannot be null."));
 if (!oldAttribute.getName().equals(newAttribute.getName()))
  throw new RuntimeOperationsException(new IllegalArgumentException(
    "Attribute names cannot be different."));
 // TODO: the source must be the object name of the MBean if the listener was registered through
 // MBeanServer
 Object oldValue = oldAttribute.getValue();
 AttributeChangeNotification n = new AttributeChangeNotification(this, 1,
   System.currentTimeMillis(), "Attribute value changed", oldAttribute.getName(),
   oldValue == null ? null : oldValue.getClass().getName(), oldValue, newAttribute.getValue());
 sendAttributeChangeNotification(n);
}

代码示例来源:origin: spring-projects/spring-framework

public void testSendAttributeChangeNotification() throws Exception {
  StubSpringModelMBean mbean = new StubSpringModelMBean();
  Notification notification = new AttributeChangeNotification(mbean, 1872, System.currentTimeMillis(), "Shall we break for some tea?", "agree", "java.lang.Boolean", Boolean.FALSE, Boolean.TRUE);
  ObjectName objectName = createObjectName();
  NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
  publisher.sendNotification(notification);
  assertNotNull(mbean.getActualNotification());
  assertTrue(mbean.getActualNotification() instanceof AttributeChangeNotification);
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is not being set to the ObjectName of the associated MBean.", objectName, mbean.getActualNotification().getSource());
}

代码示例来源:origin: spring-projects/spring-framework

public void testSendAttributeChangeNotificationWhereSourceIsNotTheManagedResource() throws Exception {
  StubSpringModelMBean mbean = new StubSpringModelMBean();
  Notification notification = new AttributeChangeNotification(this, 1872, System.currentTimeMillis(), "Shall we break for some tea?", "agree", "java.lang.Boolean", Boolean.FALSE, Boolean.TRUE);
  ObjectName objectName = createObjectName();
  NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
  publisher.sendNotification(notification);
  assertNotNull(mbean.getActualNotification());
  assertTrue(mbean.getActualNotification() instanceof AttributeChangeNotification);
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is *wrongly* being set to the ObjectName of the associated MBean.", this, mbean.getActualNotification().getSource());
}

代码示例来源:origin: mercyblitz/segmentfault-lessons

@Override
public void setData(String data) {
  String oldData = this.data;
  this.data = data;
  Notification notification = new AttributeChangeNotification(this,
      sequenceNumber.incrementAndGet(),
      System.currentTimeMillis(),
      "Data has been changed from " + oldData + " to " + data,
      "data",
      String.class.getName(),
      oldData,
      data
  );
  sendNotification(notification);
}

代码示例来源:origin: org.jacorb/jacorb-services

public void sendAttributeChanged(String name, Object oldValue, Object newValue)
  {
    broadCaster_.sendNotification(new AttributeChangeNotification(delegate_,
        ++notificationSequence_, 
        System.currentTimeMillis(), 
        "Attribute value changed",
        name, 
        oldValue == null ? null : oldValue.getClass().getName(), 
        oldValue, 
        newValue));
  }
}

代码示例来源:origin: org.jboss.jbossts/jbossjta

private void generateNotification(String message) {
  AttributeChangeNotification acn = new AttributeChangeNotification(this, 0, 0, message,
    "storeName", "String", "oldValue", "newValue");
  sendNotification(acn);
}

代码示例来源:origin: org.easybatch/easybatch-core

void notifyJobReportUpdate() {
  Notification notification = new AttributeChangeNotification(
      this,
      sequenceNumber++,
      new Date().getTime(),
      "job report updated",
      "JobReport",
      JobReport.class.getName(),
      null, //no need for old value
      jobReport);
  sendNotification(notification);
}

代码示例来源:origin: org.jboss.narayana.jts/narayana-jts-idlj

private void generateNotification(String message) {
  AttributeChangeNotification acn = new AttributeChangeNotification(this, 0, 0, message,
    "storeName", "String", "oldValue", "newValue");
  sendNotification(acn);
}

代码示例来源:origin: org.terracotta/terracotta-ee

protected void sendNotification(String msg, String attr, String type, Object oldVal, Object newVal) {
  sendNotification(new AttributeChangeNotification(this, sequenceNumber.getAndIncrement(),
                           System.currentTimeMillis(), msg, attr, type, oldVal, newVal));
 }
}

代码示例来源:origin: org.jboss.jbossts.arjunacore/arjunacore

private void generateNotification(String message) {
  AttributeChangeNotification acn = new AttributeChangeNotification(this, 0, 0, message,
    "storeName", "String", "oldValue", "newValue");
  sendNotification(acn);
}

代码示例来源:origin: org.opendaylight.netvirt/bgpmanager-impl

public void setClearAlarmObject(ArrayList<String> clearAlarmObject) {
  this.clearAlarmObject = clearAlarmObject;
  Notification n = new AttributeChangeNotification(this,
      sequenceNumber++, System.currentTimeMillis(),
      "clear alarm object notified ", "clearAlarmObject", "ArrayList",
      "", this.clearAlarmObject);
  sendNotification(n);
}

代码示例来源:origin: itesla/ipst

@Override
public void onStatesWithActionsUpdate(ContingencyStatesActionsSynthesis statesActions) {
  LOGGER.info("onStatesWithActionsUpdate received " + statesActions.getClass().getName());
  if (enableJmx) {
    sendNotification(new AttributeChangeNotification(this, notificationIndex.getAndIncrement(),
        System.currentTimeMillis(), "StateActions", STATES_ACTIONS_ATTRIBUTE,
        statesActions.getClass().getName(), null, statesActions));
  }
}

代码示例来源:origin: jbosstm/narayana

private void generateNotification(String message) {
  AttributeChangeNotification acn = new AttributeChangeNotification(this, 0, 0, message,
    "storeName", "String", "oldValue", "newValue");
  sendNotification(acn);
}

代码示例来源:origin: co.paralleluniverse/galaxy

private void notifyAttributeChange(String message, String attrName) {
  try {
    Object newValue = this.getAttribute(attrName);
    Notification n = new AttributeChangeNotification(this, notificationSequenceNumber++, System.currentTimeMillis(), message, attrName, null, null, newValue);
    sendNotification(n);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}

代码示例来源:origin: co.paralleluniverse/galaxy

public void refresh() {
  collectAndResetCounters1();
  //Notification n = new AttributeChangeNotification(this, notificationSequenceNumber++, System.currentTimeMillis(), "CacheInfo changed", "PerfInfo", newValue.getClass().getName(), null, newValue);
  Notification n = new AttributeChangeNotification(this, notificationSequenceNumber++, System.currentTimeMillis(), "Info changed", "", null, null, null);
  sendNotification(n);
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

public void sendNotificationToMe(String name) {
 long sequence = sequenceNumber++;
 Notification n = new AttributeChangeNotification(this, sequenceNumber, System.currentTimeMillis(),
   name, "A", "long", sequence, sequenceNumber);
 n.setSource(RemoteTestModule.getMyVmid());
 sendNotification(n);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.event

private void removeAndNotify(QueueMBeanHolder queueMBeanHolder) {
  String[] oldQueue = getQueueNames();
  remove(queueMBeanHolder);
  names = null;
  this.sendNotification(new AttributeChangeNotification(this, sequence
      .incrementAndGet(), System.currentTimeMillis(), "Queue "
      + queueMBeanHolder.name + " removed ", "queueNames",
      "String[]", oldQueue, getQueueNames()));
}

代码示例来源:origin: org.wildfly.core/wildfly-server

@Override
public synchronized void setRunningState(RunningState oldState, RunningState newState) {
  if(oldState == null || oldState == newState || this.runningState == newState) {
    return;
  }
  this.runningState = newState;
  AttributeChangeNotification notification = new AttributeChangeNotification(objectName, sequence.getAndIncrement(),
      System.currentTimeMillis(),
      ServerLogger.ROOT_LOGGER.jmxAttributeChange(RUNNING_STATE, oldState.toString(), newState.toString()),
      RUNNING_STATE, String.class.getName(), oldState.toString(), newState.toString());
  sendNotification(notification);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.event

private void updateQueueMBean(QueueStatusEvent e) {
  QueueMBeanHolder queueMBeanHolder = queues.get(e.getQueue().getName());
  if (queueMBeanHolder != null) {
    String[] oldQueue = getQueueNames();
    names = null;
    this.sendNotification(new AttributeChangeNotification(this,
        sequence.incrementAndGet(), System.currentTimeMillis(),
        "Queue " + e.getQueue().getName() + " updated ",
        "queueNames", "String[]", oldQueue, getQueueNames()));
  }
}

相关文章