public class DefaultNodeMainExecutor extends java.lang.Object implements NodeMainExecutor
NodeMain
s in separate threads.Modifier and Type | Method and Description |
---|---|
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
Node s. |
void |
shutdownNodeMain(NodeMain nodeMain)
Shuts down the supplied
NodeMain (i.e. |
public static NodeMainExecutor newDefault()
DefaultNodeMainExecutor
that uses a
ScheduledExecutorService
that is suitable for both
executing tasks immediately and scheduling tasks to execute in the
futurepublic static NodeMainExecutor newDefault(java.util.concurrent.ScheduledExecutorService executorService)
DefaultNodeMainExecutor
that uses the
supplied ExecutorService
public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
getScheduledExecutorService
in interface NodeMainExecutor
ScheduledExecutorService
that this
NodeMainExecutor
usespublic void execute(NodeMain nodeMain, NodeConfiguration nodeConfiguration, java.util.Collection<NodeListener> nodeListeners)
NodeMainExecutor
NodeMain
using the supplied
NodeConfiguration
.execute
in interface NodeMainExecutor
nodeMain
- the NodeMain
to executenodeConfiguration
- the NodeConfiguration
that will be used to create the
Node
nodeListeners
- a Collection
of NodeListener
s to be added to the
Node
before it starts, can be null
public void execute(NodeMain nodeMain, NodeConfiguration nodeConfiguration)
NodeMainExecutor
NodeMain
using the supplied
NodeConfiguration
.execute
in interface NodeMainExecutor
nodeMain
- the NodeMain
to executenodeConfiguration
- the NodeConfiguration
that will be used to create the
Node
public void shutdownNodeMain(NodeMain nodeMain)
NodeMainExecutor
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.
shutdownNodeMain
in interface NodeMainExecutor
nodeMain
- the NodeMain
to shutdownpublic void shutdown()
NodeMainExecutor
Node
s. This does not shut down the supplied
ExecutorService
.shutdown
in interface NodeMainExecutor