Class Behavior

java.lang.Object
org.drasyl.node.behaviour.Behavior
Direct Known Subclasses:
DeferredBehavior

public class Behavior extends Object
The behavior of an node defines how it reacts to the events that it receives.

Behaviors can be formulated in a number of different ways, either by using the DSLs in Behaviors.

  • Method Details

    • receive

      public Behavior receive(Event event)
      Process an incoming event and return the next behavior.

      The returned behavior can in addition to normal behaviors be one of the canned special objects:

      • returning UNHANDLED keeps the same behavior and signals that the event was not handled (event will be logged with DEBUG level).
      • returning IGNORE will ignore all future events.
      • returning SAME designates to reuse the current behavior.
      • returning SHUTDOWN will shutdown the DrasylNode.
    • toString

      public String toString()
      Overrides:
      toString in class Object