Package org.drasyl.behaviour
Class BehavioralDrasylNode
- java.lang.Object
-
- org.drasyl.DrasylNode
-
- org.drasyl.behaviour.BehavioralDrasylNode
-
public abstract class BehavioralDrasylNode extends DrasylNode
Describes aDrasylNode
as a finite state machine.Note: Unlike the default
DrasylNode
, this node can only process one event at a time. Please consider to run long-running operations asynchronously in a separate thread.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BehavioralDrasylNode()
protected
BehavioralDrasylNode(DrasylConfig config)
protected
BehavioralDrasylNode(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PluginManager pluginManager, AtomicReference<CompletableFuture<Void>> startFuture, AtomicReference<CompletableFuture<Void>> shutdownFuture, io.reactivex.rxjava3.core.Scheduler scheduler)
protected
BehavioralDrasylNode(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PluginManager pluginManager, AtomicReference<CompletableFuture<Void>> startFuture, AtomicReference<CompletableFuture<Void>> shutdownFuture, io.reactivex.rxjava3.core.Scheduler scheduler, Behavior behavior)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Behavior
created()
Returns the initialBehavior
of the node.void
onEvent(Event event)
Sendsevent
to the application and tells it information about the local node, other peers, connections or incoming messages.-
Methods inherited from class org.drasyl.DrasylNode
getVersion, identity, irrevocablyTerminate, pipeline, send, send, shutdown, start
-
-
-
-
Constructor Detail
-
BehavioralDrasylNode
protected BehavioralDrasylNode() throws DrasylException
- Throws:
DrasylException
-
BehavioralDrasylNode
protected BehavioralDrasylNode(DrasylConfig config) throws DrasylException
- Throws:
DrasylException
-
BehavioralDrasylNode
protected BehavioralDrasylNode(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PluginManager pluginManager, AtomicReference<CompletableFuture<Void>> startFuture, AtomicReference<CompletableFuture<Void>> shutdownFuture, io.reactivex.rxjava3.core.Scheduler scheduler, Behavior behavior)
-
BehavioralDrasylNode
protected BehavioralDrasylNode(DrasylConfig config, Identity identity, PeersManager peersManager, Pipeline pipeline, PluginManager pluginManager, AtomicReference<CompletableFuture<Void>> startFuture, AtomicReference<CompletableFuture<Void>> shutdownFuture, io.reactivex.rxjava3.core.Scheduler scheduler)
-
-
Method Detail
-
onEvent
public final void onEvent(@NonNull Event event)
Description copied from class:DrasylNode
Sendsevent
to the application and tells it information about the local node, other peers, connections or incoming messages.- Specified by:
onEvent
in classDrasylNode
- Parameters:
event
- the event
-
created
protected abstract Behavior created()
Returns the initialBehavior
of the node.- Returns:
- the initial
Behavior
-
-