Tuesday, December 5, 2017

Connection Pooling :Apache DBCP,Basic Datasource, linux Objeckkeypool










What is connection Pooling?

Pooling resources (also called object pooling) among multiple clients is a technique used to promote object reuse and to reduce the overhead of creating new resources, resulting in better performance and throughput.

Concerns remain at the application level with respect to excessive object creation and the availability of limited server resources like memory, CPU, threads, and database connections, which could represent potential bottlenecks and, when not utilized optimally, bring down the whole server.

create a Sessionfactory, a class in charge of creating the actual object you want to store in the pool. In our example that would be an ssh connection.

What is Commmons Pool framework ?

GenericObjectPool.

CursorableLinkedList: which is a doubly-linked-list implementation (part of the Jakarta Commons Collections), as the underlying datastructure for holding the objects being pooled

 org.apache.commons.PoolableObjectFactory 

-->
 // Creates an instance that can be returned by the pool
    public Object
makeObject() {}
  
Implement the object creation
 // Destroys an instance no longer needed by the pool
    public void
destroyObject(Object obj) {}
  Implement the object destruction 
 // Validate the object before using it
    public boolean
validateObject(Object obj) {}
    Validate the object before it is used
// Initialize an instance to be returned by the pool
    public void
activateObject(Object obj) {}
   Implement the object initialization code
 // Uninitialize an instance to be returned to the pool
    public void
passivateObject(Object obj) {}      Implement the object uninitialization code








--> -->

No comments:

Post a Comment