felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Loubser <da...@travellinck.com>
Subject Re: Can I restart one Service from another Service?
Date Wed, 06 Aug 2014 07:51:07 GMT
David, what you are saying is probably exactly what Neil meant in his
brief post - by "representing the remote process as a service", it could
be assumed that one writes a service that publishes / unpublishes an
OSGi service as the connection to the remote process comes and goes.

We do exactly this, where we have many services that are simply proxies
to external suppliers (various kinds of web services). None of them are
connection-oriented like the original poster's scenario seemingly is,
which makes it quite a bit simpler.


On 06/08/2014 02:43, David Jencks wrote:
> I'm afraid Neil's proposal puts the exact same problem in another component.  He is correct
that you should NOT call any of the lifecycle methods that DS calls.  On the other hand the
original request isn't very well formed.  
> What is your goal here?  Do you want a service "proxying" the remote process to be registered
only when there is a connection to the remote process?  How do you determine whether or not
the remote process is available and when its availability changes?
> I don't understand your problem yet, but you might consider having the activate method
start a thread that manages the connection to the remote process, and registers a service
when is establishes the connection and unregisters the service when the connection fails or
ends.  The deactivate method can stop this thread.
> thanks
> david jencks
> On Aug 5, 2014, at 4:48 PM, Neil Bartlett <njbartlett@gmail.com> wrote:
>> No you should not call activate/deactivate yourself, these are intended to be called
by the framework.
>> Instead, represent the remote process as a service, then bind the service into your
DS component using a mandatory reference.
>> On 6 August 2014 at 00:10:15, Dean Schulze (dean.w.schulze@gmail.com) wrote:
>> I have a Service Component that communicates with a remote process via a 
>> socket. The activate methods waits for the remote process to come up and 
>> then establishes communication. If that remote process goes down I need to 
>> go through the same process that the activate method uses to establish 
>> communication. 
>> I haven't been able to find any information on restarting a Service 
>> Component. Can I programatically restart a Service Component, or would it 
>> be better to call deactivate() and activate() on the same Service Component? 
>> Thanks. 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

View raw message