org.ros.internal.node.client
Class Registrar

java.lang.Object
  extended by org.ros.internal.node.client.Registrar
All Implemented Interfaces:
ServiceManagerListener, TopicParticipantManagerListener

public class Registrar
extends java.lang.Object
implements TopicParticipantManagerListener, ServiceManagerListener

Manages topic, and service registrations of a SlaveServer with the MasterServer.


Constructor Summary
Registrar(MasterClient masterClient, java.util.concurrent.ScheduledExecutorService executorService)
           
 
Method Summary
 void onPublisherAdded(DefaultPublisher<?> publisher)
          Called when a new Publisher is added.
 void onPublisherRemoved(DefaultPublisher<?> publisher)
          Called when a new Publisher is removed.
 void onServiceServerAdded(DefaultServiceServer<?,?> serviceServer)
          Called when a new ServiceServer is added.
 void onServiceServerRemoved(DefaultServiceServer<?,?> serviceServer)
          Called when a new ServiceServer is added.
 void onSubscriberAdded(DefaultSubscriber<?> subscriber)
          Called when a Subscriber is added.
 void onSubscriberRemoved(DefaultSubscriber<?> subscriber)
          Called when a Subscriber is removed.
 void setRetryDelay(long delay, java.util.concurrent.TimeUnit unit)
          Failed registration actions are retried periodically until they succeed.
 void shutdown()
          Shuts down the Registrar.
 void start(NodeIdentifier nodeIdentifier)
          Starts the Registrar for the SlaveServer identified by the given NodeIdentifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Registrar

public Registrar(MasterClient masterClient,
                 java.util.concurrent.ScheduledExecutorService executorService)
Parameters:
masterClient - a MasterClient for communicating with the ROS master
executorService - a ScheduledExecutorService to be used for all asynchronous operations
Method Detail

setRetryDelay

public void setRetryDelay(long delay,
                          java.util.concurrent.TimeUnit unit)
Failed registration actions are retried periodically until they succeed. This method adjusts the delay between successive retry attempts for any particular registration action.

Parameters:
delay - the delay in units of unit between retries
unit - the unit of delay

onPublisherAdded

public void onPublisherAdded(DefaultPublisher<?> publisher)
Description copied from interface: TopicParticipantManagerListener
Called when a new Publisher is added.

Specified by:
onPublisherAdded in interface TopicParticipantManagerListener
Parameters:
publisher - the Publisher that was added

onPublisherRemoved

public void onPublisherRemoved(DefaultPublisher<?> publisher)
Description copied from interface: TopicParticipantManagerListener
Called when a new Publisher is removed.

Specified by:
onPublisherRemoved in interface TopicParticipantManagerListener
Parameters:
publisher - the Publisher that was removed

onSubscriberAdded

public void onSubscriberAdded(DefaultSubscriber<?> subscriber)
Description copied from interface: TopicParticipantManagerListener
Called when a Subscriber is added.

Specified by:
onSubscriberAdded in interface TopicParticipantManagerListener
Parameters:
subscriber - the Subscriber that was added

onSubscriberRemoved

public void onSubscriberRemoved(DefaultSubscriber<?> subscriber)
Description copied from interface: TopicParticipantManagerListener
Called when a Subscriber is removed.

Specified by:
onSubscriberRemoved in interface TopicParticipantManagerListener
Parameters:
subscriber - the Subscriber that was removed

onServiceServerAdded

public void onServiceServerAdded(DefaultServiceServer<?,?> serviceServer)
Description copied from interface: ServiceManagerListener
Called when a new ServiceServer is added.

Specified by:
onServiceServerAdded in interface ServiceManagerListener
Parameters:
serviceServer - the ServiceServer that was added

onServiceServerRemoved

public void onServiceServerRemoved(DefaultServiceServer<?,?> serviceServer)
Description copied from interface: ServiceManagerListener
Called when a new ServiceServer is added.

Specified by:
onServiceServerRemoved in interface ServiceManagerListener
Parameters:
serviceServer - the ServiceServer that was added

start

public void start(NodeIdentifier nodeIdentifier)
Starts the Registrar for the SlaveServer identified by the given NodeIdentifier.

Parameters:
nodeIdentifier - the NodeIdentifier for the SlaveServer this Registrar is responsible for

shutdown

public void shutdown()
Shuts down the Registrar.

No further registration requests will be accepted. All queued registration jobs have up to SHUTDOWN_TIMEOUT SHUTDOWN_TIMEOUT_UNITS to complete before being canceled.

Calling shutdown() more than once has no effect.