To register a service: BundleContext.registerService() The returned object from that method is a ServiceRegistration. When you want to unregister, call ServiceRegistration.unregister().
Regards, Neil On 6 August 2014 at 14:49:40, Dean Schulze (dean.w.schu...@gmail.com) wrote: The remote process sends a heartbeat over the socket periodically. If the heartbeat is missing we need to re-establish the socket by waiting for the remote process to come back up and connect. I could register a proxy service when there is a connection and unregister it when the connection is lost. Can you give me a pointer to how to dynamically register / unregister a service? On 8/5/2014 6:43 PM, 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 <njbartl...@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.schu...@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-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org