ContainerListenerBean.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:psi-probe 作者:
/**
 * 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);
        }
      }
    }
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号