ConnectionPool
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
- Graph
-
- Supertypes
-
trait Connectionclass SingleThreadedAsyncObjectPool[T]trait AsyncObjectPool[T]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Always returns an empty map.
Always returns an empty map.
Attributes
Closes the pool, you should discard the object.
Closes the pool, you should discard the object.
Attributes
Picks one connection and executes an (asynchronous) function on it within a transaction block. If the function completes successfully, the transaction is committed, otherwise it is aborted. Either way, the connection is returned to the pool on completion.
Picks one connection and executes an (asynchronous) function on it within a transaction block. If the function completes successfully, the transaction is committed, otherwise it is aborted. Either way, the connection is returned to the pool on completion.
Value parameters
- f
-
operation to execute on a connection
Attributes
- Returns
-
result of f, conditional on transaction operations succeeding
- Definition Classes
Checks whether we are still connected to the database.
Checks whether we are still connected to the database.
Attributes
Picks one connection and runs this query against it. The query should be stateless, it should not start transactions and should not leave anything to be cleaned up in the future. The behavior of this object is undefined if you start a transaction from this method.
Picks one connection and runs this query against it. The query should be stateless, it should not start transactions and should not leave anything to be cleaned up in the future. The behavior of this object is undefined if you start a transaction from this method.
Attributes
Picks one connection and runs this query against it. The query should be stateless, it should not start transactions and should not leave anything to be cleaned up in the future. The behavior of this object is undefined if you start a transaction from this method.
Picks one connection and runs this query against it. The query should be stateless, it should not start transactions and should not leave anything to be cleaned up in the future. The behavior of this object is undefined if you start a transaction from this method.
Attributes
Inherited methods
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
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.
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
Called by the garbage collector on the receiver object when there are no more references to the object.
Called by the garbage collector on the receiver object when there are no more references to the object.
The details of when and if the finalize
method is invoked, as well as the interaction between finalize
and non-local returns and exceptions, are all platform dependent.
Attributes
- Note
-
not specified by SLS as a member of AnyRef
- Definition Classes
-
SingleThreadedAsyncObjectPool -> Object
- Inherited from:
- SingleThreadedAsyncObjectPool
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.
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
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.
Attributes
- Inherited from:
- SingleThreadedAsyncObjectPool
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 parameters
- f
-
function that uses the object
Attributes
- Returns
-
f wrapped with take and giveBack
- Inherited from:
- AsyncObjectPool