Class CmsAsyncJoinHandler


  • public class CmsAsyncJoinHandler
    extends java.lang.Object
    Helper class used to perform an action when multiple asynchronous tasks have finished.

    To use this, first, for every action, add a token which uniquely identifies the action. Remove the corresponding token when the action is finished. When all tokens are removed, the final action will be executed.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<java.lang.Object> m_tokens
      The set of tokens.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsAsyncJoinHandler​(java.lang.Runnable joinAction)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTokens​(java.lang.Object... tokens)
      Adds tokens.
      void removeToken​(java.lang.Object token)
      Removes a token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_tokens

        protected java.util.Set<java.lang.Object> m_tokens
        The set of tokens.
    • Constructor Detail

      • CmsAsyncJoinHandler

        public CmsAsyncJoinHandler​(java.lang.Runnable joinAction)
        Creates a new instance.

        Parameters:
        joinAction - the final action to execute
    • Method Detail

      • addTokens

        public void addTokens​(java.lang.Object... tokens)
        Adds tokens.

        Parameters:
        tokens - the tokens to add
      • removeToken

        public void removeToken​(java.lang.Object token)
        Removes a token.

        When all tokens have been removed, the final action is executed.

        Parameters:
        token - the token to remove