org.ros.node
Class DefaultNodeMainExecutor

java.lang.Object
  extended by org.ros.node.DefaultNodeMainExecutor
All Implemented Interfaces:
NodeMainExecutor

public class DefaultNodeMainExecutor
extends java.lang.Object
implements NodeMainExecutor

Executes NodeMains in separate threads.


Method Summary
 void execute(NodeMain nodeMain, NodeConfiguration nodeConfiguration)
          Executes the supplied NodeMain using the supplied NodeConfiguration.
 void execute(NodeMain nodeMain, NodeConfiguration nodeConfiguration, java.util.Collection<NodeListener> nodeListeners)
          Executes the supplied NodeMain using the supplied NodeConfiguration.
 java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
           
static NodeMainExecutor newDefault()
           
static NodeMainExecutor newDefault(java.util.concurrent.ScheduledExecutorService executorService)
           
 void shutdown()
          Shutdown all started Nodes.
 void shutdownNodeMain(NodeMain nodeMain)
          Shuts down the supplied NodeMain (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newDefault

public static NodeMainExecutor newDefault()
Returns:
an instance of DefaultNodeMainExecutor that uses a ScheduledExecutorService that is suitable for both executing tasks immediately and scheduling tasks to execute in the future

newDefault

public static NodeMainExecutor newDefault(java.util.concurrent.ScheduledExecutorService executorService)
Returns:
an instance of DefaultNodeMainExecutor that uses the supplied ExecutorService

getScheduledExecutorService

public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
Specified by:
getScheduledExecutorService in interface NodeMainExecutor
Returns:
the ScheduledExecutorService that this NodeMainExecutor uses

execute

public void execute(NodeMain nodeMain,
                    NodeConfiguration nodeConfiguration,
                    java.util.Collection<NodeListener> nodeListeners)
Description copied from interface: NodeMainExecutor
Executes the supplied NodeMain using the supplied NodeConfiguration.

Specified by:
execute in interface NodeMainExecutor
Parameters:
nodeMain - the NodeMain to execute
nodeConfiguration - the NodeConfiguration that will be used to create the Node
nodeListeners - a Collection of NodeListeners to be added to the Node before it starts, can be null

execute

public void execute(NodeMain nodeMain,
                    NodeConfiguration nodeConfiguration)
Description copied from interface: NodeMainExecutor
Executes the supplied NodeMain using the supplied NodeConfiguration.

Specified by:
execute in interface NodeMainExecutor
Parameters:
nodeMain - the NodeMain to execute
nodeConfiguration - the NodeConfiguration that will be used to create the Node

shutdownNodeMain

public void shutdownNodeMain(NodeMain nodeMain)
Description copied from interface: NodeMainExecutor
Shuts down the supplied NodeMain (i.e. NodeListener.onShutdown(Node) will be called). This does not necessarily shut down the Node that is associated with the NodeMain.

This has no effect if the NodeMain has not started.

Specified by:
shutdownNodeMain in interface NodeMainExecutor
Parameters:
nodeMain - the NodeMain to shutdown

shutdown

public void shutdown()
Description copied from interface: NodeMainExecutor
Shutdown all started Nodes. This does not shut down the supplied ExecutorService.

Specified by:
shutdown in interface NodeMainExecutor