Class IoFilterAdapter

    • Constructor Detail

      • IoFilterAdapter

        public IoFilterAdapter()
    • Method Detail

      • init

        public void init()
                  throws java.lang.Exception
        Invoked by ReferenceCountingFilter when this filter is added to a IoFilterChain at the first time, so you can initialize shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingFilter.
        Specified by:
        init in interface IoFilter
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • destroy

        public void destroy()
                     throws java.lang.Exception
        Invoked by ReferenceCountingFilter when this filter is not used by any IoFilterChain anymore, so you can destroy shared resources. Please note that this method is never called if you don't wrap a filter with ReferenceCountingFilter.
        Specified by:
        destroy in interface IoFilter
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • onPreAdd

        public void onPreAdd​(IoFilterChain parent,
                             java.lang.String name,
                             IoFilter.NextFilter nextFilter)
                      throws java.lang.Exception
        Invoked before this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked before IoFilter.init() is invoked.
        Specified by:
        onPreAdd in interface IoFilter
        Parameters:
        parent - the parent who called this method
        name - the name assigned to this filter
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • onPostAdd

        public void onPostAdd​(IoFilterChain parent,
                              java.lang.String name,
                              IoFilter.NextFilter nextFilter)
                       throws java.lang.Exception
        Invoked after this filter is added to the specified parent. Please note that this method can be invoked more than once if this filter is added to more than one parents. This method is not invoked before IoFilter.init() is invoked.
        Specified by:
        onPostAdd in interface IoFilter
        Parameters:
        parent - the parent who called this method
        name - the name assigned to this filter
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • onPreRemove

        public void onPreRemove​(IoFilterChain parent,
                                java.lang.String name,
                                IoFilter.NextFilter nextFilter)
                         throws java.lang.Exception
        Invoked before this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked before IoFilter.destroy() is invoked.
        Specified by:
        onPreRemove in interface IoFilter
        Parameters:
        parent - the parent who called this method
        name - the name assigned to this filter
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • onPostRemove

        public void onPostRemove​(IoFilterChain parent,
                                 java.lang.String name,
                                 IoFilter.NextFilter nextFilter)
                          throws java.lang.Exception
        Invoked after this filter is removed from the specified parent. Please note that this method can be invoked more than once if this filter is removed from more than one parents. This method is always invoked before IoFilter.destroy() is invoked.
        Specified by:
        onPostRemove in interface IoFilter
        Parameters:
        parent - the parent who called this method
        name - the name assigned to this filter
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • event

        public void event​(IoFilter.NextFilter nextFilter,
                          IoSession session,
                          FilterEvent event)
                   throws java.lang.Exception
        Propagate an event up to the IoHandler
        Specified by:
        event in interface IoFilter
        Parameters:
        nextFilter - the IoFilter.NextFilter for this filter. You can reuse this object until this filter is removed from the chain.
        session - The IoSession which has to process this invocation
        event - The event to propagate
        Throws:
        java.lang.Exception - If an error occurred while processing the event
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object