Skip to main content

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








--> -->

Comments

Popular posts from this blog

GraphQL

What is GraphQL  API Standard invented & open-sourced by Facebook Alternative to  REST API  enables declarative data fetching  exposes single endpoint & responds to queries How it works?  Why Graphql? Improvises performance by reducing the data that is to be transferred over the internet Variety of different frontend frameworks and platforms on client-side Fast development speed & expectation for rapid feature development Why Graphql is better than REST? Flexibility & efficient  No more over /under fetching of data Over fetching : Under fetching: Insightful analytics  Schema serves as contract between client and server CORE CONCEPTS : SDL :SCHEMA DEFINITION LANGUAGE Writing Data with mutations 3 kinds of mutations creating new data updating existing data deleting existing data

The BattleGround

Last Sunday while zapping the channels of my idiot box I chanced upon to watch one of the greatest epic of our times –MAHABHARAT. It did’nt take me much time to recall the waves that it created across the nation- when it was telecasted for the first time.I was too young to comprehend it,yet I used to watch it with paramount interest,sitting next to dad & imitating his stimuli to what character speaks Later in my teens ,unlike most of my friends who used to enjoy watching top tens & horror shows , I was inundated to discover that zee was going to re telecast Mahabharat .This time, I was grown up enough to understand it,so I religiously watched all the episodes with same interest. Watching such an epic in formative years has great influence on one’s approach towards life .Today to me ,Mahabharat isn’t just another epic but it is a thinking process, where the mind is the battleground, THE KURUSHETRA ,where all kind of thoughts hover, the state of mind that we...

J2EE Design Patterns

Creational Design Pattern Creational:  Singleton when to use : Used in Logging, Cache, Session, Drivers  Creational:  Factory  When to use : Implementation : Factory chooses the objects, DAO, Abstract DAO factory  Creational: builder     Defines essiential parameter in constructor & optional in setters & add build method .Call build method at the end. Creational: Prototype     Creational:AbstractFactory   Structural   improves  the structure of code Structural:  prototype  Clone method  Structural: proxy  Structural: Facade  Structural: Composite Design Pattern   Structural: Flyweight Design Pattern Structural: Adapter   Structural: Bridge  Behavioural Behavioural:template  Subclass defines behvaiour , order of exectution can be defined in superclass     Behavioural:Observer  Subclass defines behvaiour , order of exectution can be defined in ...