Class AgentBuilder.CircularityLock.Global

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.locks.Lock lock
      The lock to hold.
      private long time
      The time to wait for the lock.
      private java.util.concurrent.TimeUnit timeUnit
      The time's time unit.
    • Constructor Summary

      Constructors 
      Constructor Description
      Global()
      Creates a new global circularity lock that does not wait for a release.
      Global​(long time, java.util.concurrent.TimeUnit timeUnit)
      Creates a new global circularity lock.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acquire()
      Attempts to acquire a circularity lock.
      void release()
      Releases the circularity lock if it is currently acquired.
      • Methods inherited from class java.lang.Object

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

      • lock

        private final java.util.concurrent.locks.Lock lock
        The lock to hold.
      • time

        private final long time
        The time to wait for the lock.
      • timeUnit

        private final java.util.concurrent.TimeUnit timeUnit
        The time's time unit.
    • Constructor Detail

      • Global

        public Global()
        Creates a new global circularity lock that does not wait for a release.
      • Global

        public Global​(long time,
                      java.util.concurrent.TimeUnit timeUnit)
        Creates a new global circularity lock.
        Parameters:
        time - The time to wait for the lock.
        timeUnit - The time's time unit.
    • Method Detail

      • acquire

        public boolean acquire()
        Attempts to acquire a circularity lock.
        Specified by:
        acquire in interface AgentBuilder.CircularityLock
        Returns:
        true if the lock was acquired successfully, false if it is already hold.