Class Pool.MonoEntry

  • Enclosing class:
    Pool<T>

    private class Pool.MonoEntry
    extends Pool.Entry

    A Pool entry that holds metadata and a pooled object, that can only be acquired concurrently at most once, and can be acquired/released multiple times.

    • Field Detail

      • state

        private final java.util.concurrent.atomic.AtomicInteger state
    • Constructor Detail

      • MonoEntry

        private MonoEntry()
    • Method Detail

      • tryEnable

        protected boolean tryEnable​(boolean acquire)
        Description copied from class: Pool.Entry

        Tries to enable, and possible also acquire, this Entry.

        Specified by:
        tryEnable in class Pool.Entry
        Parameters:
        acquire - whether to also acquire this Entry
        Returns:
        whether this Entry was enabled
      • tryAcquire

        boolean tryAcquire()
        Description copied from class: Pool.Entry

        Tries to acquire this Entry.

        Specified by:
        tryAcquire in class Pool.Entry
        Returns:
        whether this Entry was acquired
      • tryRemove

        boolean tryRemove()
        Description copied from class: Pool.Entry

        Tries to remove the entry by marking it as closed.

        Specified by:
        tryRemove in class Pool.Entry
        Returns:
        whether the entry can be removed from the containing pool
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in class Pool.Entry
        Returns:
        whether this Entry is closed
      • isReserved

        public boolean isReserved()
        Specified by:
        isReserved in class Pool.Entry
        Returns:
        whether this Entry is reserved
      • isIdle

        public boolean isIdle()
        Specified by:
        isIdle in class Pool.Entry
        Returns:
        whether this Entry is idle
      • isInUse

        public boolean isInUse()
        Specified by:
        isInUse in class Pool.Entry
        Returns:
        whether this entry is in use.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object