SingleThreadedAsyncObjectPool

class SingleThreadedAsyncObjectPool[T](factory: ObjectFactory[T], configuration: PoolConfiguration) 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.

Type Params
T

type of the object this pool holds

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def availables: Iterable[T]
def close: Future[AsyncObjectPool[T]]
override
def finalize(): Unit
Definition Classes
Object
def giveBack(item: T): Future[AsyncObjectPool[T]]

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.

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.

def inUse: Iterable[T]
def isClosed: Boolean
def isFull: Boolean
def queued: Iterable[Promise[T]]
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.

Inherited methods

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.

Value Params
f

function that uses the object

Returns

f wrapped with take and giveBack

Inherited from
AsyncObjectPool