> Hello,
> 
> I wish to launch an application using an ApplicationDescriptor and then
> be notified once the application has terminated.  At first blush, it
> seems the easiest way to do this is to call getInstanceId() on the
> ApplicationHandle that was returned by ApplicationHandle.launch().
> Since the instance id is also the service.pid of the handle, I can use
> it to listen for the handle's unregistration.
> 
> For completeness, I also want to account for the (albeit unlikely)
> possibility that the application has shut down before I call
> getInstanceId().  In this case, the ApplicationHandle service may
> already have been unregistered which would make my ApplicationHandle
> instance stale.  The spec seems to hint that I may still call
> getInstanceId() to retrieve the handle's service.pid after it has been
> unregistered, but I don't see it formally stated.  Is this a valid
> assumption, or am I going about this the wrong way?

I think that is a valid assumption.  According to the code for 
ApplicationHandle it will always return the application instance id 
even after the application has ended.  This is also true for the method 
getApplicationDescriptor. I think the javadoc should be 
improved to make this clear.

I'm not sure about the abstract method ApplicationHandle.getState. 
I also find it strange that there is no defined state for STOPPED. 
What do you expect to be returned from ApplicationHandle.getState after 
the application has ended?  Returning STOPPING seems strange.

Tom

> 
> Thanks,
> Josh Arnold
> 
> ----------------------------------------------------------------------
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to