当前位置: 首页>>代码示例>>Java>>正文


Java MBeanServerNotification类代码示例

本文整理汇总了Java中javax.management.MBeanServerNotification的典型用法代码示例。如果您正苦于以下问题:Java MBeanServerNotification类的具体用法?Java MBeanServerNotification怎么用?Java MBeanServerNotification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MBeanServerNotification类属于javax.management包,在下文中一共展示了MBeanServerNotification类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:DefaultMBeanServerInterceptor.java

示例2: createdNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ArrayNotificationBuffer.java

示例3: sendNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:DefaultMBeanServerInterceptor.java

示例4: handleNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * Handles creation and deletion of new "worker" threads.
 *
 * @param notification the notification
 * @param object the object
 */
@Override
public synchronized void handleNotification(Notification notification, Object object) {
  if (notification instanceof MBeanServerNotification
      && notification.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)
      || notification.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {

    ObjectName objectName = ((MBeanServerNotification) notification).getMBeanName();
    if ("RequestProcessor".equals(objectName.getKeyProperty("type"))) {
      ThreadPoolObjectName threadPoolObjectName = findPool(objectName.getKeyProperty("worker"));
      if (threadPoolObjectName != null) {
        if (notification.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
          threadPoolObjectName.getRequestProcessorNames().add(objectName);
        } else {
          threadPoolObjectName.getRequestProcessorNames().remove(objectName);
        }
      }
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:26,代码来源:ContainerListenerBean.java

示例5: snoopOnUnregister

import javax.management.MBeanServerNotification; //导入依赖的package包/类
private void snoopOnUnregister(NotificationResult nr) {
    Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
    if (delegateSet == null || delegateSet.isEmpty()) {
        return;
    }
    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : delegateSet) {
            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);
                    }
                }
            }
        }
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:24,代码来源:ServerNotifForwarder.java

示例6: handleNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
@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());
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:18,代码来源:JmxDumper.java

示例7: handleNotificationInAwtEventThread

import javax.management.MBeanServerNotification; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:24,代码来源:ClientGui.java

示例8: addMBeanServerDelegateListener

import javax.management.MBeanServerNotification; //导入依赖的package包/类
private void addMBeanServerDelegateListener() {
  
    _MBeanServerDelegateNotificationListener = new MBeanServerDelegateNotificationListener();
    NotificationFilterSupport filter = new NotificationFilterSupport();
    filter.enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
    filter.enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);

    try {
        _MBeanServerConnection.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME,
                _MBeanServerDelegateNotificationListener, filter, null);
    }
    catch (Exception e) {
    }

}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:16,代码来源:JmxConnection.java

示例9: handleNotification

import javax.management.MBeanServerNotification; //导入依赖的package包/类
@Override
public void handleNotification(Notification notification, Object handback) {
    if (notification instanceof MBeanServerNotification) {
        MBeanServerNotification mbeanNotification = (MBeanServerNotification) notification;
        String notificationType = mbeanNotification.getType();
        ObjectName objectName = mbeanNotification.getMBeanName();

        if (notificationType.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
            fireMBeanRegistered(objectName);
        }
        else if (notificationType.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
            fireMBeanUnregistered(objectName);
        }
    }
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:16,代码来源:JmxConnection.java

示例10: registerWithRepository

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:DefaultMBeanServerInterceptor.java

示例11: unregisterFromRepository

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:DefaultMBeanServerInterceptor.java

示例12: snoopOnUnregister

import javax.management.MBeanServerNotification; //导入依赖的package包/类
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);
                    }
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:ServerNotifForwarder.java

示例13: MBeanServerNotificationFilter

import javax.management.MBeanServerNotification; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:MBeanServerNotificationFilter.java

示例14: addListenerForMBeanRemovedNotif

import javax.management.MBeanServerNotification; //导入依赖的package包/类
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];
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:RMIConnector.java


注:本文中的javax.management.MBeanServerNotification类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。