Class DefaultPipeline<K,​V>

  • All Implemented Interfaces:
    Pipeline<K,​V>

    public class DefaultPipeline<K,​V>
    extends Object
    implements Pipeline<K,​V>
    fixme 线程池组件出来后在添加任务自定义执行线程池的功能
    • Constructor Detail

      • DefaultPipeline

        public DefaultPipeline()
        todo final chain target,maybe not exists,need one invoker
    • Method Detail

      • addFirst

        public Pipeline addFirst​(String name,
                                 Command command)
        Description copied from interface: Pipeline
        Inserts a PipelineProcess at the first position of this pipeline.
        Specified by:
        addFirst in interface Pipeline<K,​V>
        Parameters:
        name - the name of the command to insert first
        command - the command to insert first
      • addLast

        public Pipeline addLast​(String name,
                                Command command)
        Description copied from interface: Pipeline
        Appends a PipelineProcess at the last position of this pipeline.
        Specified by:
        addLast in interface Pipeline<K,​V>
        Parameters:
        name - the name of the command to append
        command - the command to append
      • addBefore

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

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

        public Command remove​(String name)
        Description copied from interface: Pipeline
        Removes the Command with the specified name from this pipeline.
        Specified by:
        remove in interface Pipeline<K,​V>
        Parameters:
        name - the name under which the Command was stored.
        Returns:
        the removed command
      • remove

        public final Command remove​(Class commandType)
        Description copied from interface: Pipeline
        Removes the Command of the specified type from this pipeline.
        Specified by:
        remove in interface Pipeline<K,​V>
        Parameters:
        commandType - the type of the command
        Returns:
        the removed command
      • removeFirst

        public Command removeFirst()
        Description copied from interface: Pipeline
        Removes the first Command in this pipeline.
        Specified by:
        removeFirst in interface Pipeline<K,​V>
        Returns:
        the removed command
      • removeLast

        public Command removeLast()
        Description copied from interface: Pipeline
        Removes the last Command in this pipeline.
        Specified by:
        removeLast in interface Pipeline<K,​V>
        Returns:
        the removed command
      • first

        public Command first()
        Description copied from interface: Pipeline
        Returns the first Command in this pipeline.
        Specified by:
        first in interface Pipeline<K,​V>
        Returns:
        the first command. null if this pipeline is empty.
      • last

        public Command last()
        Description copied from interface: Pipeline
        Returns the last Command in this pipeline.
        Specified by:
        last in interface Pipeline<K,​V>
        Returns:
        the last command. null if this pipeline is empty.
      • get

        public Command get​(String name)
        Description copied from interface: Pipeline
        Returns the Command with the specified name in this pipeline.
        Specified by:
        get in interface Pipeline<K,​V>
        Returns:
        the command with the specified name. null if there's no such command in this pipeline.
      • get

        public Command get​(Class commandType)
        Description copied from interface: Pipeline
        Returns the Command of the specified type in this pipeline.
        Specified by:
        get in interface Pipeline<K,​V>
        Returns:
        the command of the specified command type. null if there's no such command in this pipeline.
      • firstContext

        public PipelineProcess firstContext()
        Description copied from interface: Pipeline
        Returns the context of the first Command in this pipeline.
        Specified by:
        firstContext in interface Pipeline<K,​V>
        Returns:
        the context of the first command. null if this pipeline is empty.
      • lastContext

        public PipelineProcess lastContext()
        Description copied from interface: Pipeline
        Returns the context of the last Command in this pipeline.
        Specified by:
        lastContext in interface Pipeline<K,​V>
        Returns:
        the context of the last command. null if this pipeline is empty.
      • context

        public PipelineProcess context​(Command command)
        Description copied from interface: Pipeline
        Returns the context object of the specified Command in this pipeline.
        Specified by:
        context in interface Pipeline<K,​V>
        Returns:
        the context object of the specified command. null if there's no such command in this pipeline.
      • context

        public PipelineProcess context​(String name)
        Description copied from interface: Pipeline
        Returns the context object of the Command with the specified name in this pipeline.
        Specified by:
        context in interface Pipeline<K,​V>
        Returns:
        the context object of the command with the specified name. null if there's no such command in this pipeline.
      • context

        public PipelineProcess context​(Class commandType)
        Description copied from interface: Pipeline
        Returns the context object of the Command of the specified type in this pipeline.
        Specified by:
        context in interface Pipeline<K,​V>
        Returns:
        the context object of the command of the specified type. null if there's no such command in this pipeline.
      • toMap

        public Map<String,​Command<K,​V>> toMap()
        Description copied from interface: Pipeline
        Converts this pipeline into an ordered Map whose keys are command names and whose values are commands.
        Specified by:
        toMap in interface Pipeline<K,​V>
      • toString

        public final String toString()
        Returns the String representation of this pipeline.
        Overrides:
        toString in class Object