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.container.Container<IChannel>
org.eclipse.spi.net4j.ChannelMultiplexer
- All Implemented Interfaces:
- IBufferProvider, IChannelMultiplexer, ILocationAware, ITransportConfigAware, IContainer<IChannel>, INotifier, ILifecycle, ILifecycle.DeferrableActivation, InternalChannelMultiplexer
- Direct Known Subclasses:
- Connector
- public abstract class ChannelMultiplexer
- extends Container<IChannel>
- implements InternalChannelMultiplexer
- Since:
- 2.0
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 |
ChannelMultiplexer
public ChannelMultiplexer()
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
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 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(String protocolID,
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
public InternalChannel inverseOpenChannel(short channelID,
String protocolID)
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
createChannel
protected InternalChannel createChannel()
initChannel
protected void initChannel(InternalChannel channel,
IProtocol<?> protocol)
createProtocol
protected <INFRA_STRUCTURE> IProtocol<INFRA_STRUCTURE> createProtocol(String type,
INFRA_STRUCTURE infraStructure)
createProtocolFactoryKey
protected IFactoryKey createProtocolFactoryKey(String type)
doBeforeOpenChannel
protected void doBeforeOpenChannel(IProtocol<?> protocol)
doDeactivate
protected void doDeactivate()
throws Exception
- Overrides:
doDeactivate
in class Lifecycle
- Throws:
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 - 2012 Eike Stepper (Berlin, Germany) and others.