public abstract class ChannelMultiplexer extends Container<IChannel> implements InternalChannelMultiplexer
ILocationAware.Location
IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>
IBufferProvider.Introspection
ILifecycle.DeferrableActivation
CONTEXT_MULTIPLEXER, RESERVED_CHANNEL
DEFAULT_OPEN_CHANNEL_TIMEOUT, NO_CHANNEL_TIMEOUT
Constructor and Description |
---|
ChannelMultiplexer() |
Modifier and Type | Method and Description |
---|---|
void |
closeChannel(InternalChannel channel) |
protected InternalChannel |
createChannel() |
protected abstract INegotiationContext |
createNegotiationContext() |
protected <INFRA_STRUCTURE> |
createProtocol(String type,
INFRA_STRUCTURE infraStructure) |
protected IFactoryKey |
createProtocolFactoryKey(String type) |
protected abstract void |
deregisterChannelFromPeer(InternalChannel channel) |
protected void |
doBeforeOpenChannel(IProtocol<?> protocol) |
protected void |
doDeactivate() |
InternalChannel |
getChannel(short channelID) |
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() |
long |
getOpenChannelTimeout() |
protected void |
initChannel(InternalChannel channel,
IProtocol<?> protocol) |
void |
inverseCloseChannel(short channelID) |
InternalChannel |
inverseOpenChannel(short channelID,
String protocolID)
Deprecated.
|
InternalChannel |
inverseOpenChannel(short channelID,
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(String protocolID,
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) |
fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
addListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
multiplexChannel
getLocation, isClient, isServer
addListener, getListeners, hasListeners, removeListener
getBufferCapacity, provideBuffer, retainBuffer
public ITransportConfig getConfig()
ITransportConfigAware
getConfig
in interface ITransportConfigAware
public void setConfig(ITransportConfig config)
ITransportConfigAware
setConfig
in interface ITransportConfigAware
public long getOpenChannelTimeout()
getOpenChannelTimeout
in interface IChannelMultiplexer
public void setOpenChannelTimeout(long openChannelTimeout)
setOpenChannelTimeout
in interface IChannelMultiplexer
public final InternalChannel getChannel(short channelID)
public final Collection<IChannel> getChannels()
IChannelMultiplexer
getChannels
in interface IChannelMultiplexer
public boolean isEmpty()
public IChannel[] getElements()
getElements
in interface IContainer<IChannel>
public InternalChannel openChannel() throws ChannelException
IChannelMultiplexer
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
.
openChannel
in interface IChannelMultiplexer
ChannelException
IChannelMultiplexer.openChannel(String, Object)
,
IChannelMultiplexer.openChannel(IProtocol)
public InternalChannel openChannel(String protocolID, Object infraStructure) throws ChannelException
IChannelMultiplexer
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
.
openChannel
in interface IChannelMultiplexer
ChannelException
IChannelMultiplexer.openChannel()
,
IChannelMultiplexer.openChannel(IProtocol)
public InternalChannel openChannel(IProtocol<?> protocol) throws ChannelException
IChannelMultiplexer
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.
openChannel
in interface IChannelMultiplexer
ChannelException
IChannelMultiplexer.openChannel()
,
IChannelMultiplexer.openChannel(String, Object)
@Deprecated public InternalChannel inverseOpenChannel(short channelID, String protocolID)
inverseOpenChannel(short, String, int)
.public InternalChannel inverseOpenChannel(short channelID, String protocolID, int protocolVersion)
public void closeChannel(InternalChannel channel) throws ChannelException
closeChannel
in interface InternalChannelMultiplexer
ChannelException
public void inverseCloseChannel(short channelID) throws ChannelException
ChannelException
protected InternalChannel createChannel()
protected void initChannel(InternalChannel channel, IProtocol<?> protocol)
protected <INFRA_STRUCTURE> IProtocol<INFRA_STRUCTURE> createProtocol(String type, INFRA_STRUCTURE infraStructure)
protected IFactoryKey createProtocolFactoryKey(String type)
protected void doBeforeOpenChannel(IProtocol<?> protocol)
protected void doDeactivate() throws Exception
doDeactivate
in class Lifecycle
Exception
protected abstract INegotiationContext createNegotiationContext()
protected abstract void registerChannelWithPeer(short channelID, long timeout, IProtocol<?> protocol) throws ChannelException
ChannelException
protected abstract void deregisterChannelFromPeer(InternalChannel channel) throws ChannelException
ChannelException
Copyright (c) 2014 Eike Stepper (Berlin, 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