com.github.mauricio.async.db.pool
SingleThreadedAsyncObjectPool
Companion object SingleThreadedAsyncObjectPool
class SingleThreadedAsyncObjectPool[T] extends AsyncObjectPool[T]
Implements an com.github.mauricio.async.db.pool.AsyncObjectPool using a single thread from a fixed executor service as an event loop to cause all calls to be sequential.
Once you are done with this object remember to call it's close method to clean up the thread pool and it's objects as this might prevent your application from ending.
- T
type of the object this pool holds
- Alphabetic
- By Inheritance
- SingleThreadedAsyncObjectPool
- AsyncObjectPool
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new SingleThreadedAsyncObjectPool(factory: ObjectFactory[T], configuration: PoolConfiguration)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def availables: Iterable[T]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close: Future[AsyncObjectPool[T]]
Closes this pool and future calls to **take** will cause the scala.concurrent.Future to raise an com.github.mauricio.async.db.pool.PoolAlreadyTerminatedException.
Closes this pool and future calls to **take** will cause the scala.concurrent.Future to raise an com.github.mauricio.async.db.pool.PoolAlreadyTerminatedException.
- Definition Classes
- SingleThreadedAsyncObjectPool → AsyncObjectPool
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Definition Classes
- SingleThreadedAsyncObjectPool → AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def giveBack(item: T): Future[AsyncObjectPool[T]]
Returns an object to the pool.
Returns an object to the pool. The object is validated before being added to the collection of available objects to make sure we have a usable object. If the object isn't valid it's discarded.
- Definition Classes
- SingleThreadedAsyncObjectPool → AsyncObjectPool
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def inUse: Iterable[T]
- def isClosed: Boolean
- def isFull: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def queued: Iterable[Promise[T]]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def take: Future[T]
Asks for an object from the pool, this object should be returned to the pool when not in use anymore.
Asks for an object from the pool, this object should be returned to the pool when not in use anymore.
- Definition Classes
- SingleThreadedAsyncObjectPool → AsyncObjectPool
- def toString(): String
- Definition Classes
- AnyRef → Any
- def use[A](f: (T) => Future[A])(implicit executionContext: ExecutionContext): Future[A]
Retrieve and use an object from the pool for a single computation, returning it when the operation completes.
Retrieve and use an object from the pool for a single computation, returning it when the operation completes.
- f
function that uses the object
- returns
f wrapped with take and giveBack
- Definition Classes
- AsyncObjectPool
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()