Class AbstractPipeline

    • Field Detail

      • handlerNames

        protected Map<String,​org.drasyl.pipeline.AbstractHandlerContext> handlerNames
      • head

        protected org.drasyl.pipeline.AbstractEndHandler head
      • tail

        protected org.drasyl.pipeline.AbstractEndHandler tail
      • inboundSerialization

        protected Serialization inboundSerialization
      • outboundSerialization

        protected Serialization outboundSerialization
    • Constructor Detail

      • AbstractPipeline

        public AbstractPipeline()
    • Method Detail

      • initPointer

        protected void initPointer()
      • addFirst

        public Pipeline addFirst​(String name,
                                 Handler handler)
        Description copied from interface: Pipeline
        Inserts a Handler at the first position of this pipeline.
        Specified by:
        addFirst in interface Pipeline
        Parameters:
        name - the name of the handler to insert first
        handler - the handler to insert first
      • addLast

        public Pipeline addLast​(String name,
                                Handler handler)
        Description copied from interface: Pipeline
        Appends a Handler at the last position of this pipeline.
        Specified by:
        addLast in interface Pipeline
        Parameters:
        name - the name of the handler to append
        handler - the handler to append
      • addBefore

        public Pipeline addBefore​(String baseName,
                                  String name,
                                  Handler handler)
        Description copied from interface: Pipeline
        Inserts a Handler before an existing handler of this pipeline.
        Specified by:
        addBefore in interface Pipeline
        Parameters:
        baseName - the name of the existing handler
        name - the name of the handler to insert before
        handler - the handler to insert before
      • addAfter

        public Pipeline addAfter​(String baseName,
                                 String name,
                                 Handler handler)
        Description copied from interface: Pipeline
        Inserts a Handler after an existing handler of this pipeline.
        Specified by:
        addAfter in interface Pipeline
        Parameters:
        baseName - the name of the existing handler
        name - the name of the handler to insert after
        handler - the handler to insert after
      • remove

        public Pipeline remove​(String name)
        Description copied from interface: Pipeline
        Removes the Handler with the specified name from this pipeline.
        Specified by:
        remove in interface Pipeline
        Parameters:
        name - the name under which the Handler was stored.
      • replace

        public Pipeline replace​(String oldName,
                                String newName,
                                Handler newHandler)
        Description copied from interface: Pipeline
        Replaces the Handler of the specified name with a new handler in this pipeline.
        Specified by:
        replace in interface Pipeline
        Parameters:
        oldName - the name of the Handler to be replaced
        newName - the name under which the replacement should be added
        newHandler - the Handler which is used as replacement
      • get

        public Handler get​(String name)
        Description copied from interface: Pipeline
        Returns the Handler with the specified name in this pipeline.
        Specified by:
        get in interface Pipeline
        Returns:
        the handler with the specified name. null if there's no such handler in this pipeline.
      • context

        public HandlerContext context​(String name)
        Description copied from interface: Pipeline
        Returns the context object of the Handler with the specified name in this pipeline.
        Specified by:
        context in interface Pipeline
        Returns:
        the context object of the handler with the specified name. null if there's no such handler in this pipeline.
      • processInbound

        public CompletableFuture<Void> processInbound​(Address sender,
                                                      Object msg)
        Description copied from interface: Pipeline
        Processes an inbound message by the pipeline.

        If an exception occurs during the execution of this method, the given msg is automatically released when it is of type ReferenceCounted.

        Specified by:
        processInbound in interface Pipeline
        Parameters:
        sender - the sender of the message
        msg - the inbound message
      • processOutbound

        public CompletableFuture<Void> processOutbound​(Address recipient,
                                                       Object msg)
        Description copied from interface: Pipeline
        Processes an outbound message by the pipeline.

        If an exception occurs during the execution of this method, the given msg is automatically released when it is of type ReferenceCounted.

        Specified by:
        processOutbound in interface Pipeline
        Parameters:
        recipient - the recipient of the message
        msg - the outbound message
        Returns:
        a completed future if the message was successfully processed, otherwise an exceptionally future