com.github.mauricio.async.db.pool

Members list

Type members

Classlikes

trait AsyncObjectPool[T]

Defines the common interface for async object pools. These are pools that do not block clients trying to acquire a resource from it. Different than the usual synchronous pool, you must return objects back to it manually since it's impossible for the pool to know when the object is ready to be given back.

Defines the common interface for async object pools. These are pools that do not block clients trying to acquire a resource from it. Different than the usual synchronous pool, you must return objects back to it manually since it's impossible for the pool to know when the object is ready to be given back.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ConnectionPool[T <: Connection](factory: ObjectFactory[T], configuration: PoolConfiguration, executionContext: ExecutionContext) extends SingleThreadedAsyncObjectPool[T], Connection

Pool specialized in database connections that also simplifies connection handling by implementing the com.github.mauricio.async.db.Connection trait and saving clients from having to implement the "give back" part of pool management. This lets you do your job without having to worry about managing and giving back connection objects to the pool.

Pool specialized in database connections that also simplifies connection handling by implementing the com.github.mauricio.async.db.Connection trait and saving clients from having to implement the "give back" part of pool management. This lets you do your job without having to worry about managing and giving back connection objects to the pool.

The downside of this is that you should not start transactions or any kind of long running process in this object as the object will be sent back to the pool right after executing a query. If you need to start transactions you will have to take an object from the pool, do it and then give it back manually.

Attributes

Supertypes
trait Connection
trait AsyncObjectPool[T]
class Object
trait Matchable
class Any
Show all
trait ObjectFactory[T]

Definition for objects that can be used as a factory for com.github.mauricio.async.db.pool.AsyncObjectPool objects.

Definition for objects that can be used as a factory for com.github.mauricio.async.db.pool.AsyncObjectPool objects.

Type parameters

T

the kind of object this factory produces.

Attributes

Supertypes
class Object
trait Matchable
class Any
class PartitionedAsyncObjectPool[T](factory: ObjectFactory[T], configuration: PoolConfiguration, numberOfPartitions: Int) extends AsyncObjectPool[T]

Attributes

Supertypes
trait AsyncObjectPool[T]
class Object
trait Matchable
class Any
Known subtypes
class PartitionedConnectionPool[T <: Connection](factory: ObjectFactory[T], configuration: PoolConfiguration, numberOfPartitions: Int, executionContext: ExecutionContext) extends PartitionedAsyncObjectPool[T], Connection

Attributes

Supertypes
trait Connection
trait AsyncObjectPool[T]
class Object
trait Matchable
class Any
Show all
class PoolAlreadyTerminatedException extends IllegalStateException

Thrown when the pool has already been closed.

Thrown when the pool has already been closed.

Attributes

Supertypes
class IllegalStateException
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PoolConfiguration(maxObjects: Int, maxIdle: Long, maxQueueSize: Int, validationInterval: Long)

Defines specific pieces of a pool's behavior.

Defines specific pieces of a pool's behavior.

Value parameters

maxIdle

number of milliseconds for which the objects are going to be kept as idle (not in use by clients of the pool)

maxObjects

how many objects this pool will hold

maxQueueSize

when there are no more objects, the pool can queue up requests to serve later then there are objects available, this is the maximum number of enqueued requests

validationInterval

pools will use this value as the timer period to validate idle objects.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class PoolExhaustedException(message: String) extends IllegalStateException

Raised when a pool has reached it's limit of available objects.

Raised when a pool has reached it's limit of available objects.

Attributes

Supertypes
class IllegalStateException
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
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.

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 parameters

T

type of the object this pool holds

Attributes

Companion
object
Supertypes
trait AsyncObjectPool[T]
class Object
trait Matchable
class Any
Known subtypes
class ConnectionPool[T]

Attributes

Supertypes
class Object
trait Matchable
class Any