Class

com.github.mauricio.async.db.pool

PartitionedConnectionPool

Related Doc: package pool

Permalink

class PartitionedConnectionPool[T <: Connection] extends PartitionedAsyncObjectPool[T] with Connection

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. PartitionedConnectionPool
  2. Connection
  3. PartitionedAsyncObjectPool
  4. AsyncObjectPool
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PartitionedConnectionPool(factory: ObjectFactory[T], configuration: PoolConfiguration, numberOfPartitions: Int, executionContext: ExecutionContext = ...)

    Permalink

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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def availables: Traversable[T]

    Permalink
    Definition Classes
    PartitionedAsyncObjectPool
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def close: Future[PartitionedAsyncObjectPool[T]]

    Permalink

    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
    PartitionedAsyncObjectPoolAsyncObjectPool
  8. def connect: Future[Connection]

    Permalink

    Connects this object to the database.

    Connects this object to the database. Connection objects are not necessarily created with a connection to the database so you might have to call this method to be able to run queries against it.

    Definition Classes
    PartitionedConnectionPoolConnection
  9. def disconnect: Future[Connection]

    Permalink

    Disconnects this object.

    Disconnects this object. You should discard this object after calling this method. No more queries will be accepted.

    Definition Classes
    PartitionedConnectionPoolConnection
  10. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. def giveBack(item: T): Future[PartitionedAsyncObjectPool[T]]

    Permalink

    Returns an object taken from the pool back to it.

    Returns an object taken from the pool back to it. This object will become available for another client to use. If the object is invalid or can not be reused for some reason the scala.concurrent.Future returned will contain the error that prevented this object of being added back to the pool. The object is then discarded from the pool.

    Definition Classes
    PartitionedAsyncObjectPoolAsyncObjectPool
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. def inTransaction[A](f: (Connection) ⇒ Future[A])(implicit context: ExecutionContext = executionContext): Future[A]

    Permalink

    Executes an (asynchronous) function within a transaction block.

    Executes an (asynchronous) function within a transaction block. If the function completes successfully, the transaction is committed, otherwise it is aborted.

    f

    operation to execute on this connection

    returns

    result of f, conditional on transaction operations succeeding

    Definition Classes
    PartitionedConnectionPoolConnection
  17. def inUse: Traversable[T]

    Permalink
    Definition Classes
    PartitionedAsyncObjectPool
  18. def isClosed: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    PartitionedAsyncObjectPool
  19. def isConnected: Boolean

    Permalink

    Checks whether we are still connected to the database.

    Checks whether we are still connected to the database.

    Definition Classes
    PartitionedConnectionPoolConnection
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  24. def queued: Traversable[Promise[T]]

    Permalink
    Definition Classes
    PartitionedAsyncObjectPool
  25. def sendPreparedStatement(query: String, values: Seq[Any] = List()): Future[QueryResult]

    Permalink

    Sends a prepared statement to the database.

    Sends a prepared statement to the database. Prepared statements are special statements that are pre-compiled by the database to run faster, they also allow you to avoid SQL injection attacks by not having to concatenate strings from possibly unsafe sources (like users) and sending them directy to the database.

    When sending a prepared statement, you can insert ? signs in your statement and then provide values at the method call 'values' parameter, as in:

    connection.sendPreparedStatement( "SELECT * FROM users WHERE users.login = ?", Array( "john-doe" ) )

    As you are using the ? as the placeholder for the value, you don't have to perform any kind of manipulation to the value, just provide it as is and the database will clean it up. You must provide as many parameters as you have provided placeholders, so, if your query is as "INSERT INTO users (login,email) VALUES (?,?)" you have to provide an array with at least two values, as in:

    Array("john-doe", "[email protected]")

    You can still use this method if your statement doesn't take any parameters, the default is an empty collection.

    Definition Classes
    PartitionedConnectionPoolConnection
  26. def sendQuery(query: String): Future[QueryResult]

    Permalink

    Sends a statement to the database.

    Sends a statement to the database. The statement can be anything your database can execute. Not all statements will return a collection of rows, so check the returned object if there are rows available.

    Definition Classes
    PartitionedConnectionPoolConnection
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def take: Future[T]

    Permalink

    Returns an object from the pool to the callee with the returned future.

    Returns an object from the pool to the callee with the returned future. If the pool can not create or enqueue requests it will fill the returned scala.concurrent.Future with an com.github.mauricio.async.db.pool.PoolExhaustedException.

    returns

    future that will eventually return a usable pool object.

    Definition Classes
    PartitionedAsyncObjectPoolAsyncObjectPool
  29. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  30. def use[A](f: (T) ⇒ Future[A])(implicit executionContext: ExecutionContext): Future[A]

    Permalink

    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
  31. final def wait(): Unit

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

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

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

Inherited from Connection

Inherited from PartitionedAsyncObjectPool[T]

Inherited from AsyncObjectPool[T]

Inherited from AnyRef

Inherited from Any

Ungrouped