6 Replies Latest reply on Dec 19, 2008 7:59 AM by kukeltje

    what are the active tokens

    tbee

      I have a parent which has forked two childeren. At a certain moment the two childeren are each in some state and the parent is waiting in the fork. This means -for me- I have to two active token and one suspended.

      Some time later the childeren have joined and the parent is active again. This means -for me- I have to one active token.

      I would like to be able to determine all active tokens. I used to do this by scanning all tokens and removing all tokens that had a node of class "StartState", "Fork", "Join", "EndState".

      That worked ok, but for some reason I now get Nodes that have a class "enhancedByCGLIB" and cannot use that anymore.

      Is there any other way to determine if a token is active?

      Methods like isSuspended, isLocked or hasActiveChildren don't work (the last not because one of the childs at some time will enter the Join state and thus is not active anymore, but it never hasActiveChildren).

        • 1. Re: what are the active tokens
          kukeltje

           

          That worked ok, but for some reason I now get Nodes that have a class "enhancedByCGLIB" and cannot use that anymore.


          Standard hibernate proxy issue... search the web on how to get the real implementation (sorry, I have no link at hand, each time I forget to put it in my bookmarks)

          After that, you can use all methods on it.


          • 2. Re: what are the active tokens
            tbee

             

            "kukeltjeStandard hibernate proxy issue... search the web on how to get the real implementation (sorry, I have no link at hand, each time I forget to put it in my bookmarks) [/quote wrote:


            Yes, I figured that out by now :-) The only solutions I find using the classname and substringing it, but with a name like:

            Node$$EnhancerByCGLIB$$561ff92b

            That won't work; it's a node, yes, what node?


            • 3. Re: what are the active tokens
              tbee

              if (lNode instanceof HibernateProxy)
              {
              lNode = (Node) ((HibernateProxy)lNode).getHibernateLazyInitializer().getImplementation();
              }

              • 4. Re: what are the active tokens
                kukeltje

                Yep that was it... Does it work now?

                • 5. Re: what are the active tokens
                  tbee

                   

                  "kukeltje" wrote:
                  Yep that was it... Does it work now?



                  Yup!

                  • 6. Re: what are the active tokens
                    kukeltje

                    I immediately created a small testcase locally so I will not forget it anymore ;-)