1 Reply Latest reply on Aug 20, 2004 3:26 PM by sebersole

    Embedded Hibernate service question: redeploying SessionFact

    ivelin.ivanov

      [Steve]
      NM, apparently ServiceMBeanSupport itself has those capabilities...



      --------------------------------------------------------------------------------
      From: Steve Ebersole
      Sent: Wed 8/18/2004 10:25 PM
      To: Alexey Loubyansky; 'Christian Bauer'; 'Gavin King'
      Cc: Ivelin Ivanov
      Subject: RE: jboss - hibernate


      You mention possibly extending the NotificationBroadcasterSupport base class. The original code already extended a JBoss base class ServiceMBeanSupport. Is there a JBoss-specific abstract class supporting the NotificationEmitter interface?


      --------------------------------------------------------------------------------
      From: Alexey Loubyansky
      Sent: Wed 8/18/2004 11:56 AM
      To: Steve Ebersole; 'Christian Bauer'; 'Gavin King'
      Cc: Ivelin Ivanov
      Subject: RE: jboss - hibernate


      Hi Steve,

      if you want to emit notifications from an MBean, the MBean should implement javax.management.NotificationBroadcaster or NotificationEmitter (the javadocs says "This interface should be used in preference to NotificationBroadcaster.")
      There is also javax.management.NotificationBroadcasterSupport which you can extend or just delegate method calls to.

      rebuild operation is needed in fact. Maybe even when you change an attribute this should be reflected on the MBean's status so that you can see that properties changed but the session factory was not rebuilt.
      Let me know if you need help coding this stuff.

      alex


      --------------------------------------------------------------------------------

      From: Steve Ebersole
      Sent: Wednesday, August 18, 2004 7:14 PM
      To: Alexey Loubyansky; 'Christian Bauer'; 'Gavin King'
      Cc: Ivelin Ivanov
      Subject: RE: jboss - hibernate


      Ok, so I am getting ready to expend some more time on this. But I need some help with MBean stuff from those of you more versed in JBoss itself.

      First, changes in a lot of the attributes exposed through the MBean would require the SessionFactory to be rebuilt in order to take effect. Currently, the only way to accomplish that rebuilding is to start/stop the service. Is that pretty typical? Should we also add a "rebuild" managed operation? If so, I would guess that that operation should then generate a specific event; does that then go through the normal NotificationListener mechanisms?

      In reference to the lifecycle notifications for the MBean, I'll go ahead and code the appropriate listeners. Someone with more experience here might want to double check these after I am done.

        • 1. Re: Embedded Hibernate service question: redeploying Session
          sebersole

          Currently, when an interceptor is configured, the MBean is looked up and its state is checked and if "ready" is registered with the SessionContext; if not ready, a listener is registered to wait for it to become ready (the listener trhown away afterwards). We know we also need to add support for ongoing "state changes".

          Now really the only events we really care about are 1) a SessionFactory being (re)built; 2) SessionFactory being destroyed. Essentially I am thinking of changing the logic that looks at the MBean's state and instead make it driven by typed events (i.e., SessionFactoryBuiltEvent and SessionFactoryDestroyedEvent).

          Thouoghts?