• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Invalid connection pool when database is down

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a java thread, it will update the database every 15 minutes, only when the thread got started, it creates a connection pool to the database. But our database will be shut down during the weekend, after this, the connection pool contains unuseful connections. I have to restart the thread to recreate the connection pool. Does anybody got experience to handle this issue without restarting the thread?
I thought we could use catch block to catch exception, assuming I have 5 connections in the pool, so after I got 5 exceptions(each get connection method will throw one exception), I set up a static variable BAD_CONNECTION to true, then when next time, my thread runs, it will check the variable BAD_CONNECTION, if it's true, a new connection pool will be created. But what happens to the old connection pool? it will be automatically garbage collected? Say if database down for a long time, my thread will create a bunch of unuseful connection pools, since it runs every 15 minutes. Is there any memory leak here?
Any comments would be welcome.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic