Class KeepAliveFilter

    • Constructor Detail

      • KeepAliveFilter

        public KeepAliveFilter​(KeepAliveMessageFactory messageFactory,
                               IdleStatus interestedIdleStatus)
        Creates a new instance with the default properties. The default property values are:
        Parameters:
        messageFactory - The message factory to use
        interestedIdleStatus - The IdleStatus the filter is interested in
      • KeepAliveFilter

        public KeepAliveFilter​(KeepAliveMessageFactory messageFactory,
                               KeepAliveRequestTimeoutHandler policy)
        Creates a new instance with the default properties. The default property values are:
        • interestedIdleStatus - IdleStatus.READER_IDLE
        • keepAliveRequestInterval - 60 (seconds)
        • keepAliveRequestTimeout - 30 (seconds)
        Parameters:
        messageFactory - The message factory to use
        policy - The TimeOut handler policy
      • KeepAliveFilter

        public KeepAliveFilter​(KeepAliveMessageFactory messageFactory,
                               IdleStatus interestedIdleStatus,
                               KeepAliveRequestTimeoutHandler policy)
        Creates a new instance with the default properties. The default property values are:
        • keepAliveRequestInterval - 60 (seconds)
        • keepAliveRequestTimeout - 30 (seconds)
        Parameters:
        messageFactory - The message factory to use
        interestedIdleStatus - The IdleStatus the filter is interested in
        policy - The TimeOut handler policy
      • KeepAliveFilter

        public KeepAliveFilter​(KeepAliveMessageFactory messageFactory,
                               IdleStatus interestedIdleStatus,
                               KeepAliveRequestTimeoutHandler policy,
                               int keepAliveRequestInterval,
                               int keepAliveRequestTimeout)
        Creates a new instance.
        Parameters:
        messageFactory - The message factory to use
        interestedIdleStatus - The IdleStatus the filter is interested in
        policy - The TimeOut handler policy
        keepAliveRequestInterval - the interval to use
        keepAliveRequestTimeout - The timeout to use
    • Method Detail

      • getRequestInterval

        public int getRequestInterval()
        Returns:
        the interval for keep alive messages
      • setRequestInterval

        public void setRequestInterval​(int keepAliveRequestInterval)
        Sets the interval for keepAlive messages
        Parameters:
        keepAliveRequestInterval - the interval to set
      • getRequestTimeout

        public int getRequestTimeout()
        Returns:
        The timeout
      • setRequestTimeout

        public void setRequestTimeout​(int keepAliveRequestTimeout)
        Sets the timeout
        Parameters:
        keepAliveRequestTimeout - The timeout to set
      • isForwardEvent

        public boolean isForwardEvent()
        Returns:
        true if and only if this filter forwards a IoEventType.SESSION_IDLE event to the next filter. By default, the value of this property is false.
      • setForwardEvent

        public void setForwardEvent​(boolean forwardEvent)
        Sets if this filter needs to forward a IoEventType.SESSION_IDLE event to the next filter. By default, the value of this property is false.
        Parameters:
        forwardEvent - a flag set to tell if the filter has to forward a IoEventType.SESSION_IDLE 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
        Overrides:
        onPreAdd in class IoFilterAdapter
        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
        Overrides:
        onPostAdd in class IoFilterAdapter
        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
        Overrides:
        onPostRemove in class IoFilterAdapter
        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