Package org.eclipse.spi.net4j
Class Channel
- java.lang.Object
-
- org.eclipse.net4j.util.event.Notifier
-
- org.eclipse.net4j.util.lifecycle.Lifecycle
-
- org.eclipse.spi.net4j.Channel
-
- All Implemented Interfaces:
IBufferHandler
,IBufferProvider
,IChannel
,ILocationAware
,org.eclipse.net4j.util.collection.Closeable
,org.eclipse.net4j.util.concurrent.IExecutorServiceProvider
,org.eclipse.net4j.util.container.IManagedContainerProvider
,org.eclipse.net4j.util.event.INotifier
,org.eclipse.net4j.util.event.INotifier.INotifier2
,org.eclipse.net4j.util.lifecycle.IDeactivateable
,org.eclipse.net4j.util.lifecycle.ILifecycle
,org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
,org.eclipse.net4j.util.security.IUserAware
,InternalChannel
public class Channel extends org.eclipse.net4j.util.lifecycle.Lifecycle implements InternalChannel, org.eclipse.net4j.util.concurrent.IExecutorServiceProvider, org.eclipse.net4j.util.container.IManagedContainerProvider
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 Modifier and Type Class Description protected class
Channel.ReceiverWork
Deprecated.As of 4.10 scheduled for future removal.protected class
Channel.ReceiveSerializer
Deprecated.As of 4.4 scheduled for future removal.protected class
Channel.SendQueue
A queue that holds buffers that shall be sent.-
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
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
-
Nested classes/interfaces inherited from interface org.eclipse.net4j.ILocationAware
ILocationAware.Location
-
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
org.eclipse.net4j.util.event.INotifier.INotifier2
-
Nested classes/interfaces inherited from interface org.eclipse.spi.net4j.InternalChannel
InternalChannel.SendQueueEvent
-
-
Constructor Summary
Constructors Constructor Description Channel()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
protected Channel.ReceiverWork
createReceiverWork(IBuffer buffer)
Deprecated.As of 4.10 scheduled for future removal.protected void
doActivate()
protected void
doBeforeActivate()
protected void
doDeactivate()
short
getBufferCapacity()
Returns the capacity of the buffers provided byIBufferProvider.provideBuffer()
.org.eclipse.net4j.util.container.IManagedContainer
getContainer()
java.util.concurrent.ExecutorService
getExecutorService()
short
getID()
Returns the ID of this channel.ILocationAware.Location
getLocation()
IChannelMultiplexer
getMultiplexer()
Returns the multiplexer this channel is associated with.long
getReceivedBuffers()
Returns the number ofbuffers
that are received from themultiplexer
of this channel and are passed on to thereceive handler
of this channel.java.util.concurrent.ExecutorService
getReceiveExecutor()
Deprecated.IBufferHandler
getReceiveHandler()
Returns theIBufferHandler
that handles buffers received from the peer channel.java.util.Queue<IBuffer>
getSendQueue()
long
getSentBuffers()
Returns the number ofbuffers
that are sent to themultiplexer
of this channel.java.lang.String
getUserID()
void
handleBuffer(IBuffer buffer)
Handles the given buffer.void
handleBufferFromMultiplexer(IBuffer buffer)
Handles a buffer sent by the multiplexer.boolean
isClient()
boolean
isClosed()
boolean
isServer()
IBuffer
provideBuffer()
Provides a buffer from thisBufferProvider
.void
retainBuffer(IBuffer buffer)
Retains a buffer to thisBufferProvider
.void
sendBuffer(IBuffer buffer)
Asynchronously sends the given buffer to the receive handler of the peer channel.void
setID(short id)
void
setMultiplexer(IChannelMultiplexer channelMultiplexer)
void
setReceiveExecutor(java.util.concurrent.ExecutorService receiveExecutor)
Deprecated.void
setReceiveHandler(IBufferHandler receiveHandler)
Sets theIBufferHandler
to handle buffers received from the peer channel.void
setUserID(java.lang.String userID)
java.lang.String
toString()
protected void
unregisterFromMultiplexer()
-
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation
-
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getContainer
public org.eclipse.net4j.util.container.IManagedContainer getContainer()
- Specified by:
getContainer
in interfaceorg.eclipse.net4j.util.container.IManagedContainerProvider
-
getUserID
public java.lang.String getUserID()
- Specified by:
getUserID
in interfaceorg.eclipse.net4j.util.security.IUserAware
-
setUserID
public void setUserID(java.lang.String userID)
- Specified by:
setUserID
in interfaceInternalChannel
-
getLocation
public ILocationAware.Location getLocation()
Description copied from interface:ILocationAware
- Specified by:
getLocation
in interfaceILocationAware
-
isClient
public boolean isClient()
Description copied from interface:ILocationAware
- Specified by:
isClient
in interfaceILocationAware
-
isServer
public boolean isServer()
Description copied from interface:ILocationAware
- Specified by:
isServer
in interfaceILocationAware
-
getMultiplexer
public IChannelMultiplexer getMultiplexer()
Description copied from interface:IChannel
Returns the multiplexer this channel is associated with. This channel multiplexer can be used, for example, to open additional channels that will be multiplexed through the same transport medium.- Specified by:
getMultiplexer
in interfaceIChannel
-
setMultiplexer
public void setMultiplexer(IChannelMultiplexer channelMultiplexer)
- Specified by:
setMultiplexer
in interfaceInternalChannel
-
getID
public short getID()
Description copied from interface:IChannel
Returns the ID of this channel. The ID is unique at any time among all channels of the associatedmultiplexer
.
-
setID
public void setID(short id)
- Specified by:
setID
in interfaceInternalChannel
-
getExecutorService
public java.util.concurrent.ExecutorService getExecutorService()
- Specified by:
getExecutorService
in interfaceorg.eclipse.net4j.util.concurrent.IExecutorServiceProvider
- Since:
- 4.5
-
getReceiveExecutor
@Deprecated public java.util.concurrent.ExecutorService getReceiveExecutor()
Deprecated.- Specified by:
getReceiveExecutor
in interfaceInternalChannel
-
setReceiveExecutor
@Deprecated public void setReceiveExecutor(java.util.concurrent.ExecutorService receiveExecutor)
Deprecated.- Specified by:
setReceiveExecutor
in interfaceInternalChannel
-
getReceiveHandler
public IBufferHandler getReceiveHandler()
Description copied from interface:IChannel
Returns theIBufferHandler
that handles buffers received from the peer channel.- Specified by:
getReceiveHandler
in interfaceIChannel
-
setReceiveHandler
public void setReceiveHandler(IBufferHandler receiveHandler)
Description copied from interface:IChannel
Sets theIBufferHandler
to handle buffers received from the peer channel.- Specified by:
setReceiveHandler
in interfaceIChannel
-
getSentBuffers
public long getSentBuffers()
Description copied from interface:IChannel
Returns the number ofbuffers
that are sent to themultiplexer
of this channel.- Specified by:
getSentBuffers
in interfaceIChannel
- Since:
- 3.0
-
getReceivedBuffers
public long getReceivedBuffers()
Description copied from interface:IChannel
Returns the number ofbuffers
that are received from themultiplexer
of this channel and are passed on to thereceive handler
of this channel.- Specified by:
getReceivedBuffers
in interfaceIChannel
- Since:
- 3.0
-
getSendQueue
public java.util.Queue<IBuffer> getSendQueue()
- Specified by:
getSendQueue
in interfaceInternalChannel
-
sendBuffer
public void sendBuffer(IBuffer buffer)
Description copied from interface:IChannel
Asynchronously sends the given buffer to the receive handler of the peer channel.- Specified by:
sendBuffer
in interfaceIChannel
-
handleBuffer
public void handleBuffer(IBuffer buffer)
Handles the given buffer. Ensures it is in the PUTTING state (otherwise ignores it) and sends it on behalf of the send queue.- Specified by:
handleBuffer
in interfaceIBufferHandler
- Parameters:
buffer
- The buffer to be handled.- See Also:
IBuffer.getState()
,BufferState.PUTTING
,sendQueue
-
handleBufferFromMultiplexer
public void handleBufferFromMultiplexer(IBuffer buffer)
Handles a buffer sent by the multiplexer. Adds work to the receive queue or releases the buffer.- Specified by:
handleBufferFromMultiplexer
in interfaceInternalChannel
- See Also:
InternalChannelMultiplexer.multiplexChannel(org.eclipse.spi.net4j.InternalChannel)
-
createReceiverWork
@Deprecated protected Channel.ReceiverWork createReceiverWork(IBuffer buffer)
Deprecated.As of 4.10 scheduled for future removal.
-
getBufferCapacity
public short getBufferCapacity()
Description copied from interface:IBufferProvider
Returns the capacity of the buffers provided byIBufferProvider.provideBuffer()
.- Specified by:
getBufferCapacity
in interfaceIBufferProvider
-
provideBuffer
public IBuffer provideBuffer()
Description copied from interface:IBufferProvider
Provides a buffer from thisBufferProvider
.- Specified by:
provideBuffer
in interfaceIBufferProvider
-
retainBuffer
public void retainBuffer(IBuffer buffer)
Description copied from interface:IBufferProvider
Retains a buffer to thisBufferProvider
.- Specified by:
retainBuffer
in interfaceIBufferProvider
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.eclipse.net4j.util.lifecycle.Lifecycle
-
doBeforeActivate
protected void doBeforeActivate() throws java.lang.Exception
- Overrides:
doBeforeActivate
in classorg.eclipse.net4j.util.lifecycle.Lifecycle
- Throws:
java.lang.Exception
-
doActivate
protected void doActivate() throws java.lang.Exception
- Overrides:
doActivate
in classorg.eclipse.net4j.util.lifecycle.Lifecycle
- Throws:
java.lang.Exception
-
doDeactivate
protected void doDeactivate() throws java.lang.Exception
- Overrides:
doDeactivate
in classorg.eclipse.net4j.util.lifecycle.Lifecycle
- Throws:
java.lang.Exception
-
unregisterFromMultiplexer
protected void unregisterFromMultiplexer()
-
close
public void close()
- Specified by:
close
in interfaceorg.eclipse.net4j.util.collection.Closeable
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceorg.eclipse.net4j.util.collection.Closeable
-
-