Help coderanch get a
new server
by contributing to the fundraiser
  • 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

How to close the server properly?

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am now encountering a little issue here. My application architecture is very similar to almost anybody else's. I host a connection factory at the server. If a client wants to get a DB connection, they have to obtain the remote connection factory object and call createDBConnection(). This method will return an object of type DBConnection (a remote interface).

However, doesn't this approach mean that I will need some way of tracking all the DBConnection objects that are created? What if the admin wants to stop the server? This will only stop the connection factory, but NOT the DBConnection objects. Do I need to store a list of all the DBConnection objects created, and close them as well?
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Liang,

I use the follow strategy :
1.I wait until all the client s are done with them tasks
2.I start the shotdown process
3.If a client tries to connect an exception raises.

I hope this help.

Regards,
Mihai.
 
Liang Anmian
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't quite understand what you meant. What I'm encountering now is that I need a way to close all remote database connections if I initiate a shutdown. Currently, it stops the connection factory, but doesn't stop existing connections.
 
I found some pretty shells, some sea glass and this lovely tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic