Class Token


  • public class Token
    extends java.lang.Object
    A token is initially available can be acquired once. The thread safe implementation allows multiple threads to try to acquire the token and guarantees that one and only one thread will get the token.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean acquired
      True, if the token is acquired.
    • Constructor Summary

      Constructors 
      Constructor Description
      Token()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acquire()
      Try to acquire the token.
      • Methods inherited from class java.lang.Object

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

      • acquired

        protected boolean acquired
        True, if the token is acquired.
    • Constructor Detail

      • Token

        public Token()
    • Method Detail

      • acquire

        public boolean acquire()
        Try to acquire the token.
        Returns:
        True, if the token was acquired by the caller.