11 Replies Latest reply on Feb 16, 2006 3:51 PM by Adrian Brock

    ServiceMBeanSupport and ordering, multiple starts

    Elias Ross Master

      I'm a little bothered by how ServiceMBeanSupport doesn't provide any synchronization guarantees and the fact that startService() may be called twice.

      I've been looking at the code. It seems fairly simple to guarantee "only once" behavior by using a SynchronizedInt.

      At the transition points, you would do simply have to do this:

       protected void jbossInternalStart() throws Exception
       if (!state.commit(CREATED, STARTING))

      You can also create a matrix/list of the valid transitions rather than try to codify it in so many "if" statements in different methods.

      Any thoughts? I'd like to clean this up if you don't mind.