Class MuxUpHandler

java.lang.Object
org.jgroups.blocks.mux.MuxUpHandler
All Implemented Interfaces:
Muxer<UpHandler>, UpHandler

public class MuxUpHandler extends Object implements UpHandler, Muxer<UpHandler>
Allows up handler multiplexing.
Author:
Bela Ban, Paul Ferraro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Log
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a multiplexing up handler, with no default handler.
    MuxUpHandler(UpHandler defaultHandler)
    Creates a multiplexing up handler using the specified default handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(short id, UpHandler handler)
    Registers the specified handler to handle messages containing a mux header with the specified mux identifier.
    get(short id)
    Gets the handler registered under the specified id
    Gets the handler for messages that have no mux header.
    Extension point for subclasses called by up() when an event related to state transfer is received, allowing the subclass to override the default behavior of passing the event to the default up handler.
    void
    remove(short id)
    Unregisters the handler associated with the specifed mux identifier
    void
    Sets the handler for messages that have no mux header.
    up(Event evt)
    Invoked for all channel events except connection management and state transfer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      protected final Log log
  • Constructor Details

    • MuxUpHandler

      public MuxUpHandler()
      Creates a multiplexing up handler, with no default handler.
    • MuxUpHandler

      public MuxUpHandler(UpHandler defaultHandler)
      Creates a multiplexing up handler using the specified default handler.
      Parameters:
      defaultHandler - a default up handler to handle messages with no MuxHeader
  • Method Details

    • add

      public void add(short id, UpHandler handler)
      Registers the specified handler to handle messages containing a mux header with the specified mux identifier.
      Specified by:
      add in interface Muxer<UpHandler>
      Parameters:
      id - a mux id
      handler - a handler for the specified id
      See Also:
    • get

      public UpHandler get(short id)
      Gets the handler registered under the specified id
      Specified by:
      get in interface Muxer<UpHandler>
      Parameters:
      id - a mux id
      Returns:
      the handler, or null if no handler is registered under id
      See Also:
    • remove

      public void remove(short id)
      Unregisters the handler associated with the specifed mux identifier
      Specified by:
      remove in interface Muxer<UpHandler>
      Parameters:
      id - a mux id
      See Also:
    • getDefaultHandler

      public UpHandler getDefaultHandler()
      Description copied from interface: Muxer
      Gets the handler for messages that have no mux header.
      Specified by:
      getDefaultHandler in interface Muxer<UpHandler>
      Returns:
      the default handler, or null if no default handler has been set
    • setDefaultHandler

      public void setDefaultHandler(UpHandler handler)
      Description copied from interface: Muxer
      Sets the handler for messages that have no mux header.
      Specified by:
      setDefaultHandler in interface Muxer<UpHandler>
      Parameters:
      handler - a handler for messages that have no mux header
    • up

      public Object up(Event evt)
      Invoked for all channel events except connection management and state transfer.
      Specified by:
      up in interface UpHandler
      Parameters:
      evt -
      See Also:
    • handleStateTransferEvent

      protected ImmutableReference<Object> handleStateTransferEvent(Event evt)
      Extension point for subclasses called by up() when an event related to state transfer is received, allowing the subclass to override the default behavior of passing the event to the default up handler.
      Returns:
      an AtomicReference containing the return value for the event if the event was handled and no further processing should be done in up(), or null if up() needs to handle the event. If the event was handled but the return value is null, an AtomicReference initialized to null should be returned. This default implementation always returns null