Package org.drasyl.node.behaviour
Class BehavioralDrasylNode
java.lang.Object
org.drasyl.node.DrasylNode
org.drasyl.node.behaviour.BehavioralDrasylNode
Describes a
DrasylNode
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.
-
Field Summary
Fields inherited from class org.drasyl.node.DrasylNode
bootstrap, identity
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
BehavioralDrasylNode
(Identity identity, io.netty.bootstrap.ServerBootstrap bootstrap, io.netty.channel.ChannelFuture channelFuture) protected
BehavioralDrasylNode
(Identity identity, io.netty.bootstrap.ServerBootstrap bootstrap, io.netty.channel.ChannelFuture channelFuture, io.netty.channel.Channel channel, Behavior behavior) protected
BehavioralDrasylNode
(DrasylConfig config) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Behavior
created()
Returns the initialBehavior
of the node.protected Behavior.BehaviorBuilder
Creates a newBehavior.BehaviorBuilder
to build a newBehavior
for inbound message/event handling.final void
Sendsevent
to the application and tells it information about the local node, other peers, connections or incoming messages.Methods inherited from class org.drasyl.node.DrasylNode
generateIdentity, identity, pipeline, resolve, resolve, send, send, shutdown, start
-
Constructor Details
-
BehavioralDrasylNode
- Throws:
DrasylException
-
BehavioralDrasylNode
- Throws:
DrasylException
-
BehavioralDrasylNode
-
BehavioralDrasylNode
protected BehavioralDrasylNode(Identity identity, io.netty.bootstrap.ServerBootstrap bootstrap, io.netty.channel.ChannelFuture channelFuture)
-
-
Method Details
-
onEvent
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
Returns the initialBehavior
of the node.- Returns:
- the initial
Behavior
-
newBehaviorBuilder
Creates a newBehavior.BehaviorBuilder
to build a newBehavior
for inbound message/event handling.
-