hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. M. Karlsen" <da...@davidkarlsen.com>
Subject Re: [Newbie] Singletons starting twice
Date Wed, 25 May 2005 23:03:17 GMT
Geoff Hopson wrote:

>Thanks for the response.
>
>Not got the code in front of me, but I recall it is using
>createDefaultRegistry. I am attempting to get the registry started
>before I start the web server - I have a main method that attempts to
>start the registry, get my service started, then when everything is
>set up and ready, start the web server.
>
>Regards,
>Geoff
>
>
>On 5/25/05, Achim Huegen <ahuegen@gmx-topmail.de> wrote:
>  
>
>>How do you initialise the registry?
>>Are you using the HivemindFilter?
>>
>>Achim
>>
>>Am Wed, 25 May 2005 19:47:05 +0100 schrieb Geoff Hopson <geoff.hopson@gmail.com>:
>>
>>    
>>
>>>Hi,
>>>
>>>Probably a FAQ or I´ve done something dumb....
>>>
>>>I have an application that starts an embedded Jetty server. However, I
>>>need a service to be started up and initialised before the web server
>>>starts up and is able to receive web service calls - lots of database
>>>initialisation, pre-fetching etc. I cannot do this on receipt of the
>>>first web service call, unfortunately.
>>>
>>>So, I saw eagerLoad and tried that. Nice. I can get my service set up
>>>and initialized before the web server starts.
>>>
>>>But, when the first request arrives, the service is initialised again!
>>>
>>>The first time, the service is initialised through the ´Main´ thread.
>>>When Jetty starts up, the first request initializes my service from
>>>the ´Listener-X´ thread (whichever one responds). Once that
>>>initialisation is done, no more occur (which is what I expect from the
>>>default singleton model).
>>>
>>>I guess I am loading the registry twice, but I have no idea why/how.
>>>
>>>Any clues? Any other techniques for pre-loading services other than
>>>eagerLoad? What do folks do with embedding Jetty and HiveMind in the
>>>same application?
>>>      
>>>
Maybe you could build the registry in the init() method of the servlet? 
That way you could init the services before the first request - and keep 
the registry within the web-module classloader if it has a separate one.



---------------------------------------------------------------------
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