org.eclipse.spi.net4j

## Class ChannelMultiplexer

- java.lang.Object
- - org.eclipse.net4j.util.event.Notifier
  - - org.eclipse.net4j.util.lifecycle.Lifecycle
    - - org.eclipse.net4j.util.lifecycle.ShareableLifecycle
      - - org.eclipse.net4j.util.container.Container<IChannel>
        - - org.eclipse.spi.net4j.ChannelMultiplexer

- All Implemented Interfaces:
    IBufferProvider, IChannelMultiplexer, ILocationAware, ITransportConfigAware, IExecutorServiceProvider, IContainer<IChannel>, INotifier, IDeactivateable, ILifecycle, ILifecycle.DeferrableActivation, InternalChannelMultiplexer, InverseCloseable
  Direct Known Subclasses:
    Connector

      public abstract class ChannelMultiplexer
      extends Container<IChannel>
      implements InternalChannelMultiplexer, IExecutorServiceProvider, InverseCloseable

  If the meaning of this type isn't clear, there really should be more of a description here...
  Since:
    2.0
  Author:
    Eike Stepper

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

      `InternalChannelMultiplexer.BufferMultiplexer`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAware

      `ILocationAware.Location`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

      `IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.buffer.IBufferProvider

      `IBufferProvider.Introspection, IBufferProvider.Notification`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `ILifecycle.DeferrableActivation`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `USE_LABEL`

    - ### Fields inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

      `CONTEXT_MULTIPLEXER, RESERVED_CHANNEL`

    - ### Fields inherited from interface org.eclipse.net4j.channel.IChannelMultiplexer

      `DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChannelMultiplexer()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeChannel(InternalChannel channel)`
    `protected InternalChannel` | `createChannel()`
    `protected abstract INegotiationContext` | `createNegotiationContext()`
    `protected <INFRA_STRUCTURE> IProtocol<INFRA_STRUCTURE>` | `createProtocol(java.lang.String type, INFRA_STRUCTURE infraStructure)`
    `protected IFactoryKey` | `createProtocolFactoryKey(java.lang.String type)`
    `protected abstract void` | `deregisterChannelFromPeer(InternalChannel channel)`
    `protected void` | `doBeforeOpenChannel(IProtocol<?> protocol)`
    `protected void` | `doDeactivate()`
    `InternalChannel` | `getChannel(short channelID)`
    `java.util.Collection<IChannel>` | `getChannels()` Returns a collection of currently open channels.
    `ITransportConfig` | `getConfig()` Returns the current transport configuration if there is one, a new empty one otherwise.
    `IChannel[]` | `getElements()`
    `java.util.concurrent.ExecutorService` | `getExecutorService()`
    `long` | `getOpenChannelTimeout()`
    `protected void` | `initChannel(InternalChannel channel, IProtocol<?> protocol)`
    `void` | `inverseClose()`
    `void` | `inverseCloseChannel(short channelID)`
    `InternalChannel` | `inverseOpenChannel(short channelID, java.lang.String protocolID)` Deprecated. Use `inverseOpenChannel(short, String, int)`.
    `InternalChannel` | `inverseOpenChannel(short channelID, java.lang.String protocolID, int protocolVersion)`
    `boolean` | `isEmpty()`
    `InternalChannel` | `openChannel()` Synchronous request to open a new `IChannel` with an undefined channel protocol.
    `InternalChannel` | `openChannel(IProtocol<?> protocol)` Synchronous request to open a new `IChannel` with the given channel protocol .
    `InternalChannel` | `openChannel(java.lang.String protocolID, java.lang.Object infraStructure)` Synchronous request to open a new `IChannel` with a channel protocol defined by a given protocol identifier.
    `protected abstract void` | `registerChannelWithPeer(short channelID, long timeout, IProtocol<?> protocol)`
    `void` | `setConfig(ITransportConfig config)` Sets a new transport configuration by copying the given one.
    `void` | `setOpenChannelTimeout(long openChannelTimeout)`

    - ### Methods inherited from class org.eclipse.net4j.util.container.Container

      `fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent`

    - ### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString`

    - ### Methods inherited from class org.eclipse.net4j.util.event.Notifier

      `addListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.spi.net4j.InternalChannelMultiplexer

      `multiplexChannel`

    - ### Methods inherited from interface org.eclipse.net4j.ILocationAware

      `getLocation, isClient, isServer`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

    - ### Methods inherited from interface org.eclipse.net4j.buffer.IBufferProvider

      `getBufferCapacity, provideBuffer, retainBuffer`

- - ### Constructor Detail

    - #### ChannelMultiplexer

          public ChannelMultiplexer()

  - ### Method Detail

    - #### getConfig

          public ITransportConfig getConfig()

      Description copied from interface: `ITransportConfigAware`
      Returns the current transport configuration if there is one, a new empty one otherwise.
      Specified by:
        `getConfig` in interface `ITransportConfigAware`

    - #### setConfig

          public void setConfig(ITransportConfig config)

      Description copied from interface: `ITransportConfigAware`
      Sets a new transport configuration by copying the given one.
      Specified by:
        `setConfig` in interface `ITransportConfigAware`

    - #### getExecutorService

          public java.util.concurrent.ExecutorService getExecutorService()

      Specified by:
        `getExecutorService` in interface `IExecutorServiceProvider`

    - #### getOpenChannelTimeout

          public long getOpenChannelTimeout()

      Specified by:
        `getOpenChannelTimeout` in interface `IChannelMultiplexer`

    - #### setOpenChannelTimeout

          public void setOpenChannelTimeout(long openChannelTimeout)

      Specified by:
        `setOpenChannelTimeout` in interface `IChannelMultiplexer`

    - #### getChannel

          public final InternalChannel getChannel(short channelID)

    - #### getChannels

          public final java.util.Collection<IChannel> getChannels()

      Description copied from interface: `IChannelMultiplexer`
      Returns a collection of currently open channels.
      Specified by:
        `getChannels` in interface `IChannelMultiplexer`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `IContainer<IChannel>`
      Overrides:
        `isEmpty` in class `Container<IChannel>`

    - #### getElements

          public IChannel[] getElements()

      Specified by:
        `getElements` in interface `IContainer<IChannel>`

    - #### openChannel

          public InternalChannel openChannel()
                                      throws ChannelException

      Description copied from interface: `IChannelMultiplexer`
      Synchronous request to open a new `IChannel` with an undefined channel protocol. Since the peer connector can't lookup a protocol `factory` without a protocol identifier the `IBufferHandler` of the peer `IChannel` can only be provided by externally provided channel `lifecycle` `listeners`.

      Specified by:
        `openChannel` in interface `IChannelMultiplexer`
      Throws:
        `ChannelException`
      See Also:
        `IChannelMultiplexer.openChannel(String, Object)`, `IChannelMultiplexer.openChannel(IProtocol)`

    - #### openChannel

          public InternalChannel openChannel(java.lang.String protocolID,
                                             java.lang.Object infraStructure)
                                      throws ChannelException

      Description copied from interface: `IChannelMultiplexer`
      Synchronous request to open a new `IChannel` with a channel protocol defined by a given protocol identifier. The peer connector will lookup a protocol `factory` with the protocol identifier, create a `IBufferHandler` and inject it into the peer `IChannel`.

      Specified by:
        `openChannel` in interface `IChannelMultiplexer`
      Throws:
        `ChannelException`
      See Also:
        `IChannelMultiplexer.openChannel()`, `IChannelMultiplexer.openChannel(IProtocol)`

    - #### openChannel

          public InternalChannel openChannel(IProtocol<?> protocol)
                                      throws ChannelException

      Description copied from interface: `IChannelMultiplexer`
      Synchronous request to open a new `IChannel` with the given channel protocol . The peer connector will lookup a protocol `factory` with the protocol identifier, create a `IBufferHandler` and inject it into the peer channel.

      Specified by:
        `openChannel` in interface `IChannelMultiplexer`
      Throws:
        `ChannelException`
      See Also:
        `IChannelMultiplexer.openChannel()`, `IChannelMultiplexer.openChannel(String, Object)`

    - #### inverseOpenChannel

          @Deprecated
          public InternalChannel inverseOpenChannel(short channelID,
                                                                 java.lang.String protocolID)

      Deprecated. Use `inverseOpenChannel(short, String, int)`.

    - #### inverseOpenChannel

          public InternalChannel inverseOpenChannel(short channelID,
                                                    java.lang.String protocolID,
                                                    int protocolVersion)

      Since:
        4.2

    - #### closeChannel

          public void closeChannel(InternalChannel channel)
                            throws ChannelException

      Specified by:
        `closeChannel` in interface `InternalChannelMultiplexer`
      Throws:
        `ChannelException`

    - #### inverseCloseChannel

          public void inverseCloseChannel(short channelID)
                                   throws ChannelException

      Throws:
        `ChannelException`

    - #### inverseClose

          public void inverseClose()

      Specified by:
        `inverseClose` in interface `InverseCloseable`

    - #### createChannel

          protected InternalChannel createChannel()

    - #### initChannel

          protected void initChannel(InternalChannel channel,
                                     IProtocol<?> protocol)

    - #### createProtocol

          protected <INFRA_STRUCTURE> IProtocol<INFRA_STRUCTURE> createProtocol(java.lang.String type,
                                                                                INFRA_STRUCTURE infraStructure)

    - #### createProtocolFactoryKey

          protected IFactoryKey createProtocolFactoryKey(java.lang.String type)

    - #### doBeforeOpenChannel

          protected void doBeforeOpenChannel(IProtocol<?> protocol)

    - #### doDeactivate

          protected void doDeactivate()
                               throws java.lang.Exception

      Overrides:
        `doDeactivate` in class `Lifecycle`
      Throws:
        `java.lang.Exception`

    - #### createNegotiationContext

          protected abstract INegotiationContext createNegotiationContext()

    - #### registerChannelWithPeer

          protected abstract void registerChannelWithPeer(short channelID,
                                                          long timeout,
                                                          IProtocol<?> protocol)
                                                   throws ChannelException

      Throws:
        `ChannelException`

    - #### deregisterChannelFromPeer

          protected abstract void deregisterChannelFromPeer(InternalChannel channel)
                                                     throws ChannelException

      Throws:
        `ChannelException`

Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html