hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Hopson <geoff.hop...@gmail.com>
Subject Re: [Newbie] Singletons starting twice
Date Thu, 26 May 2005 07:58:35 GMT
Thanks for the help so far. Maybe I'm being dumb (again), but here's
what I want.

I have a web services-based application. I need to get some
configuration from a database loaded up BEFORE I receive my first web
srevice request, since connecting to the database, fetching, loading,
rejigging etc takes time I haven't got when I recieve my first web
service call.

Therefore I want my HiveMind service to init BEFORE the web server
starts up, so that all my ducks are in a row before I start receiving
calls.

I have a main in my startup class that starts up the web server (Jetty).

Creating the registry in this main method doesn't work, because the
Jetty listener threads have no idea that the registry has been started
(since I haven't received a request yet, I can't use HiveMindFilter).

Here's a dump of the main chunk of my Main method...

// eagerload my service by constructing registry      
Registry registry = RegistryBuilder.constructDefaultRegistry();
// my service has now been created and inited. Who-hoo...
// now start jetty...
Server server = new Server();
server.addWebApplication("/MyApp", "./context/");
server.setTrace(true);
SocketListener listener = new SocketListener();
listener.setPort(8081); 
listener.setMinThreads(5);
listener.setMaxThreads(250);
server.addListener(listener);
server.start();
// And we are ready to receive our first caller...


Trouble is, the first web service request comes in, and the HiveMind
registry gets reloaded into the first Listener thread that responds,
along with all the initialisation I think I have already done.

Thanks again for any insights.

Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message