Trait

com.github.mauricio.async.db.pool

ObjectFactory

Related Doc: package pool

Permalink

trait ObjectFactory[T] extends AnyRef

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

T

the kind of object this factory produces.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ObjectFactory
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def create: T

    Permalink

    Creates a valid object to be used in the pool.

    Creates a valid object to be used in the pool. This method can block if necessary to make sure a correctly built is created.

  2. abstract def destroy(item: T): Unit

    Permalink

    This method should "close" and release all resources acquired by the pooled object.

    This method should "close" and release all resources acquired by the pooled object. This object will not be used anymore so any cleanup necessary to remove it from memory should be made in this method. Implementors should not raise an exception under any circumstances, the factory should log and clean up the exception itself.

  3. abstract def validate(item: T): Try[T]

    Permalink

    Validates that an object can still be used for it's purpose.

    Validates that an object can still be used for it's purpose. This method should test the object to make sure it's still valid for clients to use. If you have a database connection, test if you are still connected, if you're accessing a file system, make sure you can still see and change the file.

    You decide how fast this method should return and what it will test, you should usually do something that's fast enough not to slow down the pool usage, since this call will be made whenever an object returns to the pool.

    If this object is not valid anymore, a scala.util.Failure should be returned, otherwise scala.util.Success should be the result of this call.

    item

    an object produced by this pool

Concrete 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 clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def test(item: T): Try[T]

    Permalink

    Does a full test on the given object making sure it's still valid.

    Does a full test on the given object making sure it's still valid. Different than validate, that's called whenever an object is given back to the pool and should usually be fast, this method will be called when objects are idle to make sure they don't "timeout" or become stale in anyway.

    For convenience, this method defaults to call **validate** but you can implement it in a different way if you would like to.

    item

    an object produced by this pool

  17. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped