You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@river.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2008/11/07 06:44:39 UTC

Stopping a Transient instance...

Hi,

I am starting Reggie, Mahalo and Outrigger as transient instances, such as;

NonActivatableServiceDescriptor serviceDescriptor = new
NonActivatableServiceDescriptor(
    httpURL,
    securityPolicyLocation,
    reggieJarLocation,
    "com.sun.jini.reggie.TransientRegistrarImpl",
    new String[]{ reggieConfig } );
lookupCreated = (NonActivatableServiceDescriptor.Created)
serviceDescriptor.create( serviceDescConfig );


But how do I shut it down without stopping the JVM??


Cheers
Niclas

Re: Stopping a Transient instance...

Posted by John McClain <Jo...@Sun.COM>.
Niclas Hedhman wrote:
> On Sat, Nov 8, 2008 at 3:52 AM, Greg Trasuk <tr...@stratuscom.com> wrote:
> 
>> Remember that 'transient' and 'local' are two different things.  Usually
>> a transient instance of the service still exports a remote endpoint; it
>> just doesn't save its state to disk.
> 
> Yes, no problem with that. But my lifecycle 'controller' of these
> services are running in the same JVM (as part of junit tests), hence
> my referral to 'local'.

<historicalPerspective memory="faulty" value="questionable">

The starter kit didn't really support the sort local lifecycle 
controllers you are building until 2.1. The basic interfaces were 
introduced in 2.0, but at that point the emphasis was on supporting the 
configurable service starter command line tool and some of cases that 
are important for local controllers had not yet been addressed.

In contrast we had DestroyAdmin in v1.0. At that point it had to be 
remote (since 3rd party agents running in the same VM as the service 
backend was not part of our model) and by the time 2.1 rolled around it 
didn't occur to us to add local admin interfaces.

</historicalPerspective>

Re: Stopping a Transient instance...

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Sat, Nov 8, 2008 at 3:52 AM, Greg Trasuk <tr...@stratuscom.com> wrote:

> Remember that 'transient' and 'local' are two different things.  Usually
> a transient instance of the service still exports a remote endpoint; it
> just doesn't save its state to disk.

Yes, no problem with that. But my lifecycle 'controller' of these
services are running in the same JVM (as part of junit tests), hence
my referral to 'local'.


Cheers
Niclas

Re: Stopping a Transient instance...

Posted by Greg Trasuk <tr...@stratuscom.com>.
On Fri, 2008-11-07 at 04:24, Niclas Hedhman wrote:
> On Fri, Nov 7, 2008 at 5:20 PM, Dominic Cleal <do...@cdo2.com> wrote:
> 
> >> But how do I shut it down without stopping the JVM??
> >
> > Check out the Administrable and DestroyAdmin[1] interfaces - these are
> > implemented by Reggie et al and will allow you to remotely destroy the
> > service.
> 
> Thanks, I'll try that, although it feels "odd" to do a remote shutdown
> of a local, transient instance...
> 


Remember that 'transient' and 'local' are two different things.  Usually
a transient instance of the service still exports a remote endpoint; it
just doesn't save its state to disk.

> Cheers
> Niclas
-- 
Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.com


Re: Stopping a Transient instance...

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Fri, Nov 7, 2008 at 5:24 PM, Niclas Hedhman <ni...@hedhman.org> wrote:
> On Fri, Nov 7, 2008 at 5:20 PM, Dominic Cleal <do...@cdo2.com> wrote:
>
>>> But how do I shut it down without stopping the JVM??
>>
>> Check out the Administrable and DestroyAdmin[1] interfaces - these are
>> implemented by Reggie et al and will allow you to remotely destroy the
>> service.
>
> Thanks, I'll try that, although it feels "odd" to do a remote shutdown
> of a local, transient instance...

Is this intended to work?


lookupCreated = (NonActivatableServiceDescriptor.Created)
serviceDescriptor.create( serviceDescConfig );

:
:

Object admin = ((Administrable) lookupCreated.proxy).getAdmin();
((DestroyAdmin) admin).destroy();


Cheers
Niclas

Re: Stopping a Transient instance...

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Fri, Nov 7, 2008 at 5:20 PM, Dominic Cleal <do...@cdo2.com> wrote:

>> But how do I shut it down without stopping the JVM??
>
> Check out the Administrable and DestroyAdmin[1] interfaces - these are
> implemented by Reggie et al and will allow you to remotely destroy the
> service.

Thanks, I'll try that, although it feels "odd" to do a remote shutdown
of a local, transient instance...

Cheers
Niclas

Re: Stopping a Transient instance...

Posted by Dominic Cleal <do...@cdo2.com>.
Hi Niclas,

On Friday 07 November 2008 05:44:39 Niclas Hedhman wrote:
> I am starting Reggie, Mahalo and Outrigger as transient instances, such as;
>
> [snip]
>
> But how do I shut it down without stopping the JVM??

Check out the Administrable and DestroyAdmin[1] interfaces - these are 
implemented by Reggie et al and will allow you to remotely destroy the 
service.

The main service proxy should implement Administrable, which you then call 
getAdmin() on to receive an admin object.  This should implement 
DestroyAdmin, among other things such as JoinAdmin, that will in turn let you 
remotely destroy the service.

[1]http://java.sun.com/products/jini/2.1/doc/api/com/sun/jini/admin/DestroyAdmin.html

Cheers,

-- 
Dominic Cleal
CDO2
Albert Buildings
49 Queen Victoria Street
London
EC4N 4SA
Tel: +44 (0)845 456 4460
Fax: +44 (0)845 456 4461
www.cdo2.com  www.cdovar.net