Questions tagged [apache-commons-pool]

Apache Commons Pool is a general purpose, object pooling framework for the Java programming language.

Apache Commons Pool is a component of the Apache Commons project. Apache Commons Pool is general purpose, object pooling framework, is open source software distributed under the Apache License, Version 2.0, and is the underlying object pooling framework for Apache Commons DBCP.

52 questions
1
vote
0 answers

How to use borrowObject of GenericObjectPool class such that threads don't get stuck?

I am using the apache commons pool2 version 2.8.1. While borrowing object from pool, threads are getting stuck. I initialised the pool size as 1. And had 3 threads created. First thread enters borrowObject method, since there are no idle objects to…
1
vote
1 answer

MinEvictableIdleTimeMillis setting not working as expected

I have this pool of objects (using org.apache.commons.pool2), from which I borrow (or create) one. The maximum idle size I have set is 3 ( with a max size of 5). This was set with the understanding that if there are idle objects more than 3, those…
user1583803
  • 424
  • 2
  • 6
  • 16
1
vote
1 answer

Configure Apache Commons Pool to create objects on start up

I'm configuring a pool of objects using apache commons pool2. It seems the objects in the pool are only created when an attempt is made to borrow an object. I'd like the objects to be created up front, so I have a minimum number of objects ready…
ronanl
  • 11
  • 2
1
vote
1 answer

GenericObjectPool Returned object not currently part of this pool

I have created a pool of objects that I need to reuse. Every time I try to return the object I get an error of: "Returned object not currently part of this pool" I have override the both the equals and hashcode methods but that does not help. I set…
The Myron
  • 21
  • 4
1
vote
1 answer

Websphere MQ connection pooling

Is there any connection pool library for Websphere MQ in Java? I tried to implement connection pool for WebSphere MQ using Apache Commons Pool, but it didn't work.
1
vote
1 answer

How to figure out the number of idle objects and borrowed objects in Apache Common Pool 2

There are several getXXXCount method defined in the BaseGenericObjectPool class BaseGenericObjectPool.getBorrowedCount BaseGenericObjectPool.getCreatedCount BaseGenericObjectPool.getDestroyedCount But all of them are computed since the pool was…
Tom
  • 5,848
  • 12
  • 44
  • 104
1
vote
1 answer

Redis client : create new connections when pool size gets exhausted

We are using redis for caching purpose in our application. Our goal is to create new Redis connections as the pool size exhaust or crosses a certain threshold so that we can keep the number of idle connections minimal . This way a redis-server…
1
vote
1 answer

What does CommonsPool2TargetSource do if you disable blockWhenExhausted?

The deprecated CommonPoolTargetSource had a set of behaviors you could define using setWhenExhaustedActionName(). The CommonsPool2TargetSource and the CommonsPool2 BaseGenericObjectPool it wraps describe "getBlockWhenExhausted" as Returns whether…
1
vote
1 answer

Is it a bad practise to pass jedis instance between methods?

I was referring to this SO question, and I did couple of additions in this benchmark test. The main problem is my apis are getting slow as load increases on server. I am using jedis pool configuration. // get a new instance public synchronized…
theGamblerRises
  • 686
  • 1
  • 11
  • 27
1
vote
1 answer

How to inject Spring beans into class generated by reflection in Apache Commons Pooling class flow

I'm using Spring MVC 3.2.4 and Apache Commons Pooling 2.3 for managing connections to a SOAP service. One of the things I am using is the "idle object eviction" thread feature in the GenericObjectPool…
skel625
  • 876
  • 3
  • 7
  • 17
1
vote
1 answer

Error trying to wire a Lettuce Connection Factory

I'm trying to setup a connection factory for my redis client (lettuce client version: 2.3.3) using Spring Data Redis (version.: 1.1.x) but I'm having some troubles while wiring everything together. Here's my configuration:…
1
vote
1 answer

commons pool jar 2.2 : is there any replacement of GenericObjectPool.Config class?

I just studying redis. In my text-book, they use GenericObjectPool.Config class which supported in apache commons pool jar version 1.6. However, for now that class has disappeared. So I want to know is there any replacement of…
Juneyoung Oh
  • 7,318
  • 16
  • 73
  • 121
1
vote
1 answer

Why does the following simple piece of Java code using pooled connections from commons.dbcp block?

I have written a simple Java code, which attempts to store files in an hsqldb database. All it does is reads the files from a certain directory and puts them in the DB. It is single threaded, but I am using pooled connections from the apache…
mark
  • 59,016
  • 79
  • 296
  • 580
1
vote
1 answer

apache commons pool - how to use a factory that takes arguments

I am trying to use apache commons pool to create a pool of 'objects'. Since I already have an object factory which takes a string type argument and create a right type of object I want to use this factory. But the problem is that none of the…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
1
vote
2 answers

How to shutdown a GenericKeyedObjectPool safely?

I have a GenericKeyedObjectPool in my application. I can close it with the close method but how should I wait for the clients to return (and the pool destroys) every borrowed object to the pool? I need something like…
palacsint
  • 28,416
  • 10
  • 82
  • 109