1 Reply Latest reply on May 4, 2009 10:16 PM by alrubinger

    JBBOOT - Event listener and ServerInitializer APIs

    jaikiran

      Moving the email discussion with ALR, to the forum:

      "jaikiran" wrote:
      > Hi Andrew,
      >
      >
      > I was working on the JBBOOT-54 and had a few related questions:
      >
      > 1) In MCServer (impl-mc) what is the right time to expect the Kernel within the MC to be "set". Right now i see that it's being set during doStart() which is too late if someone wants to register to kernel events. I have this failing testcase (not committed) http://pastebin.com/m3979391c This fails because the kernel is not set.



      "ALR" wrote:

      Yep, I moved the bootstrap.run() and setup of the Kernel into the
      initialize() method of AbstractMcServerBase.

      Commits: http://fisheye.jboss.org/changelog/JBossAS/?cs=87976


      "jaikiran" wrote:

      > 2) I am bad (just learning more) at generics, this is more of a "is there a better way to do this" question - The LifecycleEventHandler has the following API:
      >
      > public void handleEvent(Server<MCServer, MCServerConfig> server, LifecycleState state) throws LifecycleEventException
      >
      > Assuming that the client registers a event handler for a MCServer event http://pastebin.com/m298f9c41is there a better was to work on a MCServer in the handleEvent method instead of doing a cast (line 26 in pastebin)? More importantly are there chances of getting a different type of server (i believe not, else it would be a bug), when the event handler was registered for MCServer?


      "ALR" wrote:

      The Lifecycle Event Handling API was stupid, because there's no need to
      pass the server back into handleEvent(). So I removed this. Event
      handlers that need to get at the server or Kernel (or whatever) can make
      that an implementation detail supplied in the ctor, like:

      http://fisheye.jboss.org/browse/JBossAS/projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/lifecycle/AbstractKernelEventLifecycleEventHandler.java?r=87976
      Regarding your question about the generics, clearly they're wrong. And the same pattern is used in ServerInitializer. So I've got to revisit this and keep type safety (ideas welcome).


      "jaikiran" wrote:
      > P.S: Is there an appropriate forum (user/dev) where we could discuss such questions?


      "ALR" wrote:

      Sure, we can abuse Design of POJO Server. Mind posting your questions and my responses there?