Or, use HiveMindFilter, if you're using the "default" registry anyway.

-----Original Message-----
From: David J. M. Karlsen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 25, 2005 7:03 PM
To: [email protected]
Subject: Re: [Newbie] Singletons starting twice

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 <[EMAIL PROTECTED]> 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
<[EMAIL PROTECTED]>:
>>
>>    
>>
>>>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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to