This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Control service shutdown sequence

 
vivekkumar sharma
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running three java applications say A,B,C as windows services with A having dependency on B and B having dependency on C.

Which means when you start A, It shall automatically start service B and C (Java programs running). And also when you stop C ,it shall stop first B and then A.

Problem I am facing is when you stop C, windows first stop A then B.

I am able to register java applications as windows services with dependency but problem is when u stop service, Windows send signal to all the dependent services to stop and thus I am not able to control order in which services stop

Help is appreciated
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be more of a Windows issue than a Java issue, so I'm moving this thread to "General Computing".
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vivekkumar sharma:
And also when you stop C ,it shall stop first B and then A.

Problem I am facing is when you stop C, windows first stop A then B.

Actually in this case I agree with Windows' actions. Given the dependecies you have specified an orderly shutdown sequence is A, then B, then C. Stopping C before either A or B pulls the rug out under A and B. Maybe you need to explain why you want a different shutdown sequence.

Based on the way you defined the dependencies the Service Control Manager will actually start C, then B and then finally A when you try to start A.
[ March 29, 2006: Message edited by: Peer Reynders ]
 
vivekkumar sharma
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thans for replying.
I want to control the shut down sequence of services because
say C is client
B is Child server
A is Master Server

now when you Close Master Server
I want Child server should NOT shut down before client service shuts.

Bt setting dependenices as follows
Client Dependent on Child Server and Master Server
Child server dependent on Master Server.

winodws does not gurrante shut down sequence of Child server and client

regards
vivek
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vivekkumar sharma:
Bt setting dependenices as follows
Client Dependent on Child Server and Master Server
Child server dependent on Master Server.


If the "Child Server" can operate without the "Master Server" then its not truly "dependent" - look into an alternate way of starting the "Master Server" i.e. not through dependencies. You could always declare a dependency for the "Child Server" to another late starting service like the spooler - that should give the Master Server long enough to start up.

However if the client shuts down quickly enough it may be enough to increase the "Kill timeout" How to Increase Shutdown Time for Services to Close Properly. The SCM gives a service only 20 seconds by default to shut down - after that the service is forcibly terminated.
 
vivekkumar sharma
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your pointers
I will try solution
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic