Class BehaviorInterceptor<O,​I>

    • Constructor Detail

      • BehaviorInterceptor

        public BehaviorInterceptor()
    • Method Detail

      • interceptMessageType

        public java.lang.Class<? extends O> interceptMessageType()
      • aroundStart

        public Behavior<I> aroundStart​(TypedActorContext<O> ctx,
                                       BehaviorInterceptor.PreStartTarget<I> target)
        Override to intercept actor startup. To trigger startup of the next behavior in the stack, call target.start().
        Parameters:
        ctx - (undocumented)
        target - (undocumented)
        Returns:
        The returned behavior will be the "started" behavior of the actor used to accept the next message or signal.
      • aroundReceive

        public abstract Behavior<I> aroundReceive​(TypedActorContext<O> ctx,
                                                  O msg,
                                                  BehaviorInterceptor.ReceiveTarget<I> target)
        Intercept a message sent to the running actor. Pass the message on to the next behavior in the stack by passing it to target.apply, return Behaviors.same without invoking target to filter out the message.

        Parameters:
        ctx - (undocumented)
        msg - (undocumented)
        target - (undocumented)
        Returns:
        The behavior for next message or signal
      • aroundSignal

        public abstract Behavior<I> aroundSignal​(TypedActorContext<O> ctx,
                                                 Signal signal,
                                                 BehaviorInterceptor.SignalTarget<I> target)
        Intercept a signal sent to the running actor. Pass the signal on to the next behavior in the stack by passing it to target.apply.

        Parameters:
        ctx - (undocumented)
        signal - (undocumented)
        target - (undocumented)
        Returns:
        The behavior for next message or signal
      • isSame

        public boolean isSame​(BehaviorInterceptor<java.lang.Object,​java.lang.Object> other)
        Parameters:
        other - (undocumented)
        Returns:
        true if this behavior logically the same as another behavior interceptor and can therefore be eliminated (to avoid building infinitely growing stacks of behaviors)? Default implementation is based on instance equality. Override to provide use case specific logic.