Class/Object

io.github.andrebeat.pool

ExpiringPool

Related Docs: object ExpiringPool | package pool

Permalink

class ExpiringPool[A <: AnyRef] extends ArrayBlockingQueuePool[A]

An object pool that creates the objects as needed until a maximum number of objects has been created and automatically evicts objects after they have been idle for a given amount of time.

Linear Supertypes
ArrayBlockingQueuePool[A], Pool[A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ExpiringPool
  2. ArrayBlockingQueuePool
  3. Pool
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ExpiringPool(capacity: Int, referenceType: ReferenceType, maxIdleTime: Duration, _factory: () ⇒ A, _reset: (A) ⇒ Unit, _dispose: (A) ⇒ Unit, _healthCheck: (A) ⇒ Boolean)

    Permalink

Type Members

  1. final class ExpiringItem extends Item

    Permalink
    Attributes
    protected
  2. abstract class Item extends AnyRef

    Permalink
    Attributes
    protected
    Definition Classes
    ArrayBlockingQueuePool

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def acquire(): Lease[A]

    Permalink

    Acquire a lease for an object blocking if none is available.

    Acquire a lease for an object blocking if none is available.

    returns

    a lease for an object from this pool.

    Definition Classes
    ArrayBlockingQueuePoolPool
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val capacity: Int

    Permalink

    Returns the capacity of the pool, i.e.

    Returns the capacity of the pool, i.e. the maximum number of objects the pool can hold.

    returns

    the capacity of the pool.

    Definition Classes
    ArrayBlockingQueuePoolPool
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def destroy(a: A): Unit

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ArrayBlockingQueuePool
    Annotations
    @inline()
  9. def dispose(a: A): Unit

    Permalink

    Object "destructor".

    Object "destructor". This method is called whenever the object is evicted from the pool. For example, when doing connection pooling it is necessary to close the connection whenever it is evicted (i.e. permanently removed) from the pool.

    Attributes
    protected[this]
    Definition Classes
    ExpiringPoolPool
    Annotations
    @inline()
  10. final def drain(): Unit

    Permalink

    Drains the object pool, i.e.

    Drains the object pool, i.e. evicts every object currently pooled.

    Definition Classes
    ArrayBlockingQueuePoolPool
    Annotations
    @tailrec()
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  13. def factory(): A

    Permalink

    Factory method for creating new objects.

    Factory method for creating new objects.

    returns

    a new object.

    Attributes
    protected[this]
    Definition Classes
    ExpiringPoolPool
    Annotations
    @inline()
  14. final def fill(): Unit

    Permalink

    Fills the object pool by creating (and pooling) new objects until the number of live objects reaches the pool capacity.

    Fills the object pool by creating (and pooling) new objects until the number of live objects reaches the pool capacity.

    Definition Classes
    ArrayBlockingQueuePoolPool
    Annotations
    @tailrec()
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. def healthCheck(a: A): Boolean

    Permalink

    An health check that is performed on an object before its leased from the pool.

    An health check that is performed on an object before its leased from the pool. If the health check passes the object is successfully leased. Otherwise, the object is destroyed (and a new one is fetched or created)

    Attributes
    protected[this]
    Definition Classes
    ExpiringPoolPool
    Annotations
    @inline()
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. val items: ArrayBlockingQueue[Item]

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ArrayBlockingQueuePool
  21. def leased(): Int

    Permalink

    Returns the number of leased objects.

    Returns the number of leased objects.

    The value returned by this method is only accurate when the referenceType is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.

    returns

    the number of leased objects.

    Definition Classes
    Pool
  22. def live(): Int

    Permalink

    Returns the number of live objects, i.e.

    Returns the number of live objects, i.e. the number of currently pooled objects plus leased objects.

    The value returned by this method is only accurate when the referenceType is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.

    returns

    the number of live objects.

    Definition Classes
    ArrayBlockingQueuePoolPool
  23. val maxIdleTime: Duration

    Permalink
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def newItem(a: A): ExpiringItem

    Permalink
    Attributes
    protected[this]
    Definition Classes
    ExpiringPoolArrayBlockingQueuePool
    Annotations
    @inline()
  26. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. val referenceType: ReferenceType

    Permalink

    Returns the io.github.andrebeat.pool.ReferenceType of the objects stored in the pool.

    Returns the io.github.andrebeat.pool.ReferenceType of the objects stored in the pool.

    Definition Classes
    ArrayBlockingQueuePoolPool
  29. def reset(a: A): Unit

    Permalink

    Resets the internal state of object.

    Resets the internal state of object. This method is called on an object whenever it is added/released back to the pool. For example, if pooling an object like a java.nio.ByteBuffer it might make sense to call its reset() method whenever the object is released to the pool, so that its future users do not observe the internal state introduced by previous ones.

    Attributes
    protected[this]
    Definition Classes
    ExpiringPoolPool
    Annotations
    @inline()
  30. def size(): Int

    Permalink

    Returns the number of objects in the pool.

    Returns the number of objects in the pool.

    The value returned by this method is only accurate when the referenceType is io.github.andrebeat.pool.ReferenceType.Strong, since GC-based eviction is checked only when trying to acquire an object.

    returns

    the number of objects in the pool.

    Definition Classes
    ArrayBlockingQueuePoolPool
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  33. def tryAcquire(atMost: Duration): Option[Lease[A]]

    Permalink

    Try to acquire a lease for an object blocking at most until the given duration.

    Try to acquire a lease for an object blocking at most until the given duration.

    atMost

    maximum wait time for the lease to be available.

    returns

    a lease for an object from this pool if available until the given duration, None otherwise.

    Definition Classes
    ArrayBlockingQueuePoolPool
  34. def tryAcquire(): Option[Lease[A]]

    Permalink

    Try to acquire a lease for an object without blocking.

    Try to acquire a lease for an object without blocking.

    returns

    a lease for an object from this pool if available, None otherwise.

    Definition Classes
    ArrayBlockingQueuePoolPool
  35. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ArrayBlockingQueuePool[A]

Inherited from Pool[A]

Inherited from AnyRef

Inherited from Any

Ungrouped