ModelMBeanNotificationBroadcaster

ModelMBeanNotificationBroadcaster (모델 MBean 알림 브로드캐스터 인터페이스)

ModelMBean이 반드시 구현해야 하는 인터페이스예요. 이 인터페이스의 구현은 모든 JMX 에이전트와 함께 제공되어야 해요. NotificationBroadcaster를 확장해요.

출처: Java API Reference

본문

모든 public 메서드에 MBeanExceptionRuntimeOperationsException을 던져 분산 통신(RMI, EJB 등)의 예외를 감싸게 해요.

주요 메서드는 다음과 같아요.

  • sendNotification(Notification) / sendNotification(String): 등록된 알림 리스너에 알림을 보내요. 문자열 버전은 jmx.modelmbean.generic 타입의 알림을 만들어요.
  • sendAttributeChangeNotification(AttributeChangeNotification) / sendAttributeChangeNotification(Attribute oldValue, Attribute newValue): 속성 변경 알림을 보내요.
  • addAttributeChangeNotificationListener(listener, attributeName, handback): NotificationListener를 구현하는 객체를 리스너로 등록해요. ModelMBean이 발행하는 attributeChangeNotification이 발생하면 이 객체의 handleNotification() 메서드가 호출돼요. 다른 알림은 이와 무관하게 별도로 등록해야 해요.
  • removeAttributeChangeNotificationListener(listener, attributeName): 속성 변경 알림 리스너를 제거해요. 리스너가 등록되지 않았거나 null이면 ListenerNotFoundException을 던져요.

더 알아보기 (Learn more)

Java 공식 API