Re: Safety check if a service has been initialized

2013-10-14 Thread Muhammad Gelbana
@Barry, there are usually tests being carried out killing the server will leave the database in an inconsistent state. So a graceful shutdown is needed @Lance, you are correct, this is a good approach to solve this. I still think having this around (Checking if a service is built) is an addition

Re: Safety check if a service has been initialized

2013-10-14 Thread Lance Java
Why not create your own hub which your db services register with when they are realized / constructed. You then have a single shutdown listener which loops the list in order before finally shutting down the db connection. On 14 Oct 2013 17:38, "Muhammad Gelbana" wrote: > This cannot guarantee th

Re: Safety check if a service has been initialized

2013-10-14 Thread Barry Books
I would say if you are really relying on an orderly shutdown you might want to rethink your design. In general you are far more likely to have a crash than an orderly shutdown. Personally I stop my web servers with killall -9 java On Mon, Oct 14, 2013 at 11:37 AM, Muhammad Gelbana wrote: > This

Re: Safety check if a service has been initialized

2013-10-14 Thread Muhammad Gelbana
This cannot guarantee the order of the shutdown procedure. I need this executed after all services are shutdown. However, I can inject another service instead of *RegistryShutdownHub*, this way I can guarantee the order. To explain, I'll inject a service which will hold a set of database connectio

Re: Safety check if a service has been initialized

2013-10-14 Thread Lance Java
Why not add the following to your database services: @PostInjection public void addShutdownListener(RegistryShutdownHub shutdownHub) { shutdownHub.addRegistryShutdownListener(new Runnable() { … }); } The shutdown listener will only fire if the service has been realized (constructed)

Re: Safety check if a service has been initialized

2013-10-14 Thread Muhammad Gelbana
My core module shuts down 2 database services but I recently deployed a new application that uses only one schema so when the *RegisteryShutdownHub *service calls the shutdown procedure, the idle database connection service is asked to shutdown by calling *.close()* and this attempts to instantiate

Re: Safety check if a service has been initialized

2013-10-14 Thread Lance Java
The Scoreboard is a ServiceActivityTracker. I've never needed to do it myself but I'm sure you can register your own custom tracker. On 14 Oct 2013 13:17, "Martin Kersten" wrote: > Sometimes it is very important. I for myself need this in some tests to > recognize some specials in tear down and s

Re: Safety check if a service has been initialized

2013-10-14 Thread Martin Kersten
Sometimes it is very important. I for myself need this in some tests to recognize some specials in tear down and set up. And thanks Lance for the hint. I used another way but this Scoreboard is way more cooler. Wasnt aware of this. 2013/10/14 Thiago H de Paula Figueiredo > On Sun, 13 Oct 2013 1

Re: Safety check if a service has been initialized

2013-10-14 Thread Thiago H de Paula Figueiredo
On Sun, 13 Oct 2013 12:14:46 -0300, Muhammad Gelbana wrote: Will many agree with me if I asked for a way to safely check if a service has been initialized or built ? Why do you need that? If you invoke a service method, the service will be initialized and ready to use, even if Tapestry-Io

Re: Safety check if a service has been initialized

2013-10-14 Thread Lance Java
Take a look at the built in ServiceStatus page. You can @Inject ServiceActivityScoreboard and check ServiceActivity.getStatus()

Safety check if a service has been initialized

2013-10-13 Thread Muhammad Gelbana
Will many agree with me if I asked for a way to safely check if a service has been initialized or built ? Something like RegistryTools.isBuilt(myServiceReference); *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana