org.jgroups.blocks.mux

## Class MuxUpHandler

- java.lang.Object
- - org.jgroups.blocks.mux.MuxUpHandler

- All Implemented Interfaces:
    Muxer<UpHandler>, UpHandler

      public class MuxUpHandler
      extends java.lang.Object
      implements UpHandler, Muxer<UpHandler>

  Allows up handler multiplexing.
  Author:
    Bela Ban, Paul Ferraro

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `log`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(short id, UpHandler handler)` Registers the specified handler to handle messages containing a mux header with the specified mux identifier.
    `UpHandler` | `get(short id)` Gets the handler registered under the specified id
    `UpHandler` | `getDefaultHandler()` Gets the handler for messages that have no mux header.
    `protected ImmutableReference<java.lang.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.
    `void` | `remove(short id)` Unregisters the handler associated with the specifed mux identifier
    `void` | `setDefaultHandler(UpHandler handler)` Sets the handler for messages that have no mux header.
    `java.lang.Object` | `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 Detail

    - #### log

          protected final Log log

  - ### Constructor Detail

    - #### 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 Detail

    - #### 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:
        `Muxer.add(short, java.lang.Object)`

    - #### 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:
        `Muxer.get(short)`

    - #### 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:
        `Muxer.remove(short)`

    - #### 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 java.lang.Object up(Event evt)

      Invoked for all channel events except connection management and state transfer.
      Specified by:
        `up` in interface `UpHandler`
      See Also:
        `UpHandler.up(org.jgroups.Event)`

    - #### handleStateTransferEvent

          protected ImmutableReference<java.lang.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`

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.