Hi Istvano,
This is not really clear in the doc but if you want your service to be
notified of shutdown events, it is not sufficient to have it implement
RegistryShutdownListener. In addition, in the configuration, you must
declare it listens for events from the ShutdownCoordinator.
Try that:
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="....ClientSourceImpl">
<event-listener service-id="hivemind.ShutdownCoordinator"/>
<set property="configFile" value="my.properties"/>
</construct>
</invoke-factory>
This should do the trick (I got stuck with the same problem a few weeks
ago;-))
-----Original Message-----
From: Istvan Orban [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 16, 2004 9:22 PM
To: [email protected]
Subject: Re: Multi-threaded question
Thanks it helped a lot...
But I must be doing somewhing wrong as the "registryDidShutdown" never
get called.
I have this interface->
public interface ClientSource {
public abstract Client getClient();
public abstract void releaseClient(Client client);
}
this is the core service ->
public class ClientSourceImpl implements ClientSource,
RegistryShutdownListener {
....
public void registryDidShutdown() {
System.out.println("!!!!! SHUTDOWN !!!!!!");
}
public void initializeService() {
System.out.println("!!!!! STARTUP !!!!!!");
}
}
<?xml version="1.0"?>
<module id="service" version="1.0.0">
<contribution configuration-id="hivemind.EagerLoad">
<load service-id="MyClientSource"/>
</contribution>
<service-point id="MyClientSource" interface="....ClientSource">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="....ClientSourceImpl">
<set property="configFile" value="my.properties"/>
</construct>
</invoke-factory>
<interceptor service-id="hivemind.LoggingInterceptor"/>
</service-point>
</module>
everything works fine
Registry registry = RegistryBuilder.constructDefaultRegistry();
ClientSource cs = (ClientSource)
registry.getService(ClientSource.class);
.......
System.out.println("before Shutdown");
registry.shutdown();
System.out.println("after Shutdown");
log:
Creating SingletonProxy for service service.MyClientSource
Constructing core service implementation for service service.MyClientSource
Autowired property log to
[EMAIL PROTECTED]
Set property configFile to my.properties
Applying interceptor factory hivemind.LoggingInterceptor
.....
before Shutdown
after Shutdown
Any idea what I'm doing wrong ???
THANKS A LOT!!!!
>Please check out the following API docs:
>
>http://jakarta.apache.org/hivemind/hivemind/apidocs/org/apache/hivemind/Reg
i
>stry.html#shutdown()
>
>http://jakarta.apache.org/hivemind/hivemind/apidocs/org/apache/hivemind/eve
n
>ts/RegistryShutdownListener.html
>
>http://jakarta.apache.org/hivemind/hivemind/apidocs/org/apache/hivemind/Dis
c
>ardable.html
>
>Hope this helps.
>
>-Filip
>
>
>
>>-----Original Message-----
>>From: Istvan Orban [mailto:[EMAIL PROTECTED]
>>Sent: Saturday, October 16, 2004 2:53 PM
>>To: [email protected]
>>Subject: Multi-threaded question
>>
>>Hi,
>>
>>I have some services which are loaded <contribution
>>configuration-id="hivemind.EagerLoad">
>>one of this service creates a pool to a server. and manages the pool
>>itself.
>>
>>I'm supposed to delete this pool from the remote server when I do not
>>need it anymore.
>>
>>the final application will run inside Tomcat, and many Threads will
>>requests clients from the Pool which is managed by the service I wrote.
>>When the application is stopped I guess I should stop Hivemind too, with
>>all my services, and do the necessary clean-ups.
>>
>>Is there a standard way of doing this??
>>
>>Thanks, sorrry for the lame question..
>>
>>Istvano
>>
>>---------------------------------------------------------------------
>>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]
>
>
>
>
>
---------------------------------------------------------------------
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]