java - endless database connection with a thread application -


i have made thread application checking on things on database , make transactions problem have making endless inactive connection causing database hang

i have used code

genericobjectpool connectionpool = new genericobjectpool(null);         connectionfactory connectionfactory = new drivermanagerconnectionfactory(dburl, dbusername, dbpassword);         connectionpool.setmaxactive(10);         connectionpool.setwhenexhaustedaction((byte) 1);         connectionpool.setmaxwait(30000);         connectionpool.setmaxidle(-1);         connectionpool.settestonborrow(false);         connectionpool.settestonreturn(false);         connectionpool.settimebetweenevictionrunsmillis(-1);         connectionpool.setnumtestsperevictionrun(-1);         connectionpool.setminevictableidletimemillis(-1);         connectionpool.settestwhileidle(false);         poolableconnectionfactory poolableconnectionfactory = new poolableconnectionfactory(connectionfactory,connectionpool,null,null,false,true);         poolableconnectionfactory.setvalidationquery(null);         poolableconnectionfactory.setdefaultreadonly(false);         poolableconnectionfactory.setdefaultautocommit(true);         poolingdriver driver = new poolingdriver();         driver.registerpool("pro",connectionpool);         conn = drivermanager.getconnection("jdbc:apache:commons:dbcp:pro"); 

any 1 has idea?

note : have changed connectionpool.setmaxidle(-1); value connectionpool.setmaxidle(0); started exception connection closed


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -