类javax.management.MBeanServerNotification源码实例Demo

下面列出了怎么用javax.management.MBeanServerNotification的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
private void createdNotification(MBeanServerNotification n) {
    final String shouldEqual =
        MBeanServerNotification.REGISTRATION_NOTIFICATION;
    if (!n.getType().equals(shouldEqual)) {
        logger.warning("createNotification", "bad type: " + n.getType());
        return;
    }

    ObjectName name = n.getMBeanName();
    if (logger.debugOn())
        logger.debug("createdNotification", "for: " + name);

    synchronized (this) {
        if (createdDuringQuery != null) {
            createdDuringQuery.add(name);
            return;
        }
    }

    if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
        addBufferListener(name);
        if (isDisposed())
            removeBufferListener(name);
    }
}
 
源代码3 项目: logging-log4j2   文件: ClientGui.java
private void handleNotificationInAwtEventThread(final Notification notif, final Object paramObject) {
    if (StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE.equals(notif.getType())) {
        if (!(paramObject instanceof ObjectName)) {
            handle("Invalid notification object type", new ClassCastException(paramObject.getClass().getName()));
            return;
        }
        final ObjectName param = (ObjectName) paramObject;
        final JTextArea text = statusLogTextAreaMap.get(param);
        if (text != null) {
            text.append(notif.getMessage() + '\n');
        }
        return;
    }
    if (notif instanceof MBeanServerNotification) {
        final MBeanServerNotification mbsn = (MBeanServerNotification) notif;
        final ObjectName mbeanName = mbsn.getMBeanName();
        if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notif.getType())) {
            onMBeanRegistered(mbeanName);
        } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notif.getType())) {
            onMBeanUnregistered(mbeanName);
        }
    }
}
 
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
源代码5 项目: hottub   文件: DefaultMBeanServerInterceptor.java
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
源代码6 项目: helix   文件: JmxDumper.java
@Override
public void handleNotification(Notification notification, Object handback) {
  MBeanServerNotification mbs = (MBeanServerNotification) notification;
  if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType())) {
    // System.out.println("Adding mbean " + mbs.getMBeanName());
    _logger.info("Adding mbean " + mbs.getMBeanName());
    if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
      addMBean(mbs.getMBeanName());
    }
  } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType())) {
    // System.out.println("Removing mbean " + mbs.getMBeanName());
    _logger.info("Removing mbean " + mbs.getMBeanName());
    if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
      removeMBean(mbs.getMBeanName());
    }
  }
}
 
源代码7 项目: jdk8u-jdk   文件: DefaultMBeanServerInterceptor.java
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
源代码8 项目: jdk8u-jdk   文件: DefaultMBeanServerInterceptor.java
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
源代码9 项目: openjdk-8   文件: ArrayNotificationBuffer.java
private void createdNotification(MBeanServerNotification n) {
    final String shouldEqual =
        MBeanServerNotification.REGISTRATION_NOTIFICATION;
    if (!n.getType().equals(shouldEqual)) {
        logger.warning("createNotification", "bad type: " + n.getType());
        return;
    }

    ObjectName name = n.getMBeanName();
    if (logger.debugOn())
        logger.debug("createdNotification", "for: " + name);

    synchronized (this) {
        if (createdDuringQuery != null) {
            createdDuringQuery.add(name);
            return;
        }
    }

    if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
        addBufferListener(name);
        if (isDisposed())
            removeBufferListener(name);
    }
}
 
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
源代码11 项目: jdk8u-jdk   文件: ArrayNotificationBuffer.java
private void createdNotification(MBeanServerNotification n) {
    final String shouldEqual =
        MBeanServerNotification.REGISTRATION_NOTIFICATION;
    if (!n.getType().equals(shouldEqual)) {
        logger.warning("createNotification", "bad type: " + n.getType());
        return;
    }

    ObjectName name = n.getMBeanName();
    if (logger.debugOn())
        logger.debug("createdNotification", "for: " + name);

    synchronized (this) {
        if (createdDuringQuery != null) {
            createdDuringQuery.add(name);
            return;
        }
    }

    if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
        addBufferListener(name);
        if (isDisposed())
            removeBufferListener(name);
    }
}
 
源代码12 项目: jdk8u-jdk   文件: ArrayNotificationBuffer.java
private void createdNotification(MBeanServerNotification n) {
    final String shouldEqual =
        MBeanServerNotification.REGISTRATION_NOTIFICATION;
    if (!n.getType().equals(shouldEqual)) {
        logger.warning("createNotification", "bad type: " + n.getType());
        return;
    }

    ObjectName name = n.getMBeanName();
    if (logger.debugOn())
        logger.debug("createdNotification", "for: " + name);

    synchronized (this) {
        if (createdDuringQuery != null) {
            createdDuringQuery.add(name);
            return;
        }
    }

    if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
        addBufferListener(name);
        if (isDisposed())
            removeBufferListener(name);
    }
}
 
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "sendNotification", NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
private void createdNotification(MBeanServerNotification n) {
    final String shouldEqual =
        MBeanServerNotification.REGISTRATION_NOTIFICATION;
    if (!n.getType().equals(shouldEqual)) {
        logger.warning("createNotification", "bad type: " + n.getType());
        return;
    }

    ObjectName name = n.getMBeanName();
    if (logger.debugOn())
        logger.debug("createdNotification", "for: " + name);

    synchronized (this) {
        if (createdDuringQuery != null) {
            createdDuringQuery.add(name);
            return;
        }
    }

    if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
        addBufferListener(name);
        if (isDisposed())
            removeBufferListener(name);
    }
}
 
/**
 * Sends an MBeanServerNotifications with the specified type for the
 * MBean with the specified ObjectName
 */
private void sendNotification(String NotifType, ObjectName name) {

    // ------------------------------
    // ------------------------------

    // ---------------------
    // Create notification
    // ---------------------
    MBeanServerNotification notif = new MBeanServerNotification(
        NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

    if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
        MBEANSERVER_LOGGER.log(Level.TRACE, NotifType + " " + name);
    }

    delegate.sendNotification(notif);
}
 
/**
 * Removes a MBean in the repository,
 * sends MBeanServerNotification.UNREGISTRATION_NOTIFICATION,
 * returns ResourceContext for special resources such as ClassLoaders
 * or JMXNamespaces, or null. For regular MBean this method returns
 * ResourceContext.NONE.
 *
 * @return a ResourceContext for special resources such as ClassLoaders
 *         or JMXNamespaces.
 */
private ResourceContext unregisterFromRepository(
        final Object resource,
        final DynamicMBean object,
        final ObjectName logicalName)
        throws InstanceNotFoundException {

    // Creates a registration context, if needed.
    //
    final ResourceContext context =
            makeResourceContextFor(resource, logicalName);


    repository.remove(logicalName, context);

    // ---------------------
    // Send deletion event
    // ---------------------
    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "unregisterMBean", "Send delete notification of object " +
                logicalName.getCanonicalName());
    }

    sendNotification(MBeanServerNotification.UNREGISTRATION_NOTIFICATION,
            logicalName);
    return context;
}
 
源代码17 项目: jdk8u_jdk   文件: DefaultMBeanServerInterceptor.java
/**
 * Adds a MBean in the repository,
 * sends MBeanServerNotification.REGISTRATION_NOTIFICATION,
 * returns ResourceContext for special resources such as ClassLoaders
 * or JMXNamespaces. For regular MBean this method returns
 * ResourceContext.NONE.
 * @return a ResourceContext for special resources such as ClassLoaders
 *         or JMXNamespaces.
 */
private ResourceContext registerWithRepository(
        final Object resource,
        final DynamicMBean object,
        final ObjectName logicalName)
        throws InstanceAlreadyExistsException,
        MBeanRegistrationException {

    // Creates a registration context, if needed.
    //
    final ResourceContext context =
            makeResourceContextFor(resource, logicalName);


    repository.addMBean(object, logicalName, context);
    // May throw InstanceAlreadyExistsException

    // ---------------------
    // Send create event
    // ---------------------
    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "addObject", "Send create notification of object " +
                logicalName.getCanonicalName());
    }

    sendNotification(
            MBeanServerNotification.REGISTRATION_NOTIFICATION,
            logicalName);

    return context;
}
 
源代码18 项目: hottub   文件: MBeanServerNotificationFilter.java
/**
 * Creates a filter selecting all MBeanServerNotification notifications for
 * all ObjectNames.
 */
public MBeanServerNotificationFilter() {

    super();
    RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");

    enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
    enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);

    RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");
    return;
}
 
源代码19 项目: jdk1.8-source-analysis   文件: RMIConnector.java
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
 
源代码20 项目: jdk8u_jdk   文件: ServerNotifForwarder.java
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
源代码21 项目: dragonwell8_jdk   文件: ServerNotifForwarder.java
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
源代码22 项目: hottub   文件: ServerNotifForwarder.java
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
/**
 * Creates a filter selecting all MBeanServerNotification notifications for
 * all ObjectNames.
 */
public MBeanServerNotificationFilter() {

    super();
    RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");

    enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
    enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);

    RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");
    return;
}
 
源代码24 项目: jdk8u-dev-jdk   文件: RMIConnector.java
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
 
源代码25 项目: jdk8u-jdk   文件: RMIConnector.java
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
 
/**
 * Adds a MBean in the repository,
 * sends MBeanServerNotification.REGISTRATION_NOTIFICATION,
 * returns ResourceContext for special resources such as ClassLoaders
 * or JMXNamespaces. For regular MBean this method returns
 * ResourceContext.NONE.
 * @return a ResourceContext for special resources such as ClassLoaders
 *         or JMXNamespaces.
 */
private ResourceContext registerWithRepository(
        final Object resource,
        final DynamicMBean object,
        final ObjectName logicalName)
        throws InstanceAlreadyExistsException,
        MBeanRegistrationException {

    // Creates a registration context, if needed.
    //
    final ResourceContext context =
            makeResourceContextFor(resource, logicalName);


    repository.addMBean(object, logicalName, context);
    // May throw InstanceAlreadyExistsException

    // ---------------------
    // Send create event
    // ---------------------
    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER,
                DefaultMBeanServerInterceptor.class.getName(),
                "addObject", "Send create notification of object " +
                logicalName.getCanonicalName());
    }

    sendNotification(
            MBeanServerNotification.REGISTRATION_NOTIFICATION,
            logicalName);

    return context;
}
 
源代码27 项目: jdk8u_jdk   文件: RMIConnector.java
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
    NotificationFilterSupport clientFilter =
            new NotificationFilterSupport();
    clientFilter.enableType(
            MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
    MarshalledObject<NotificationFilter> sFilter =
        new MarshalledObject<NotificationFilter>(clientFilter);

    Integer[] listenerIDs;
    final ObjectName[] names =
        new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
    final MarshalledObject<NotificationFilter>[] filters =
        Util.cast(new MarshalledObject<?>[] {sFilter});
    final Subject[] subjects = new Subject[] {null};
    try {
        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);

    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        listenerIDs =
                connection.addNotificationListeners(names,
                filters,
                subjects);
    }
    return listenerIDs[0];
}
 
/**
 * Creates a filter selecting all MBeanServerNotification notifications for
 * all ObjectNames.
 */
public MBeanServerNotificationFilter() {

    super();
    RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");

    enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
    enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);

    RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
            "MBeanServerNotificationFilter");
    return;
}
 
源代码29 项目: jdk8u-jdk   文件: OldMBeanServerTest.java
public void unregisterMBean(ObjectName name)
throws InstanceNotFoundException, MBeanRegistrationException {

    forbidJMImpl(name);

    DynamicMBean mbean = getMBean(name);
    if (mbean == null)
        throw new InstanceNotFoundException(name.toString());

    MBeanRegistration reg = mbeanRegistration(mbean);
    try {
        reg.preDeregister();
    } catch (Exception e) {
        throw new MBeanRegistrationException(e);
    }
    if (!mbeans.remove(name, mbean))
        throw new InstanceNotFoundException(name.toString());
        // This is incorrect because we've invoked preDeregister

    Object userMBean = getUserMBean(mbean);
    if (userMBean instanceof ClassLoader)
        clr.removeLoader((ClassLoader) userMBean);

    Notification n = new MBeanServerNotification(
            MBeanServerNotification.REGISTRATION_NOTIFICATION,
            MBeanServerDelegate.DELEGATE_NAME,
            0,
            name);
    delegate.sendNotification(n);

    reg.postDeregister();
}
 
源代码30 项目: TencentKona-8   文件: IdleTimeoutTest.java
public void handleNotification(Notification n,
                               Object h) {
    MBeanServerNotification mbsn =
        (MBeanServerNotification) n;
    System.out.println(listenerName + " got notification: "
                       + mbsn.getMBeanName());
    synchronized (listenerCount) {
        listenerCount[0]++;
        listenerCount.notify();
    }
}
 
 类所在包
 同包方法