• 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

DataSource - Flush

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody!!! Well, here comes my question....

I've been working with a DataSource in Glassfish but I'm wondering if is there any way in which I could make a flush from code?...
I mean... Yoou can make the container validate the connection, but that produces overhead.. so it is possible to catch an exception and
make a flush in that moment?

And forgive me for my bad English... :O
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure I understand what you mean by "flush" - what is it you want this to do?
 
Juan Marino
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
flush -> Restart the pool... Restart all the connections
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disconnecting and reconnecting is the only way to do this. Because you have a connection pool you will not actually know if the connection is actually closed or just returned to the pool.

I can't think of a reason why you would want to do this though. What is driving this requirement?
 
Juan Marino
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I´m working on "electronic funds transfer", and my boss was asking me about it
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does your boss believe you need to close all connections in the pool and reopen? Seems like a fairly odd requirement, its possible she/he is misunderstanding how databases work?
 
Juan Marino
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If in any moment the DataBase is restarted, all the connections in the pool are lost and there is no way in which we can restart those connections but validating it by Glassfish
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Connection pool implementations can usually recover from this. I don't know GlassFish that well, but I'd be surprised if it doesn't have this feature. Worth a look in the docs.

reply
    Bookmark Topic Watch Topic
  • New Topic