public class Channel extends Lifecycle implements InternalChannel, IExecutorServiceProvider
Modifier and Type | Class and Description |
---|---|
protected class |
Channel.ReceiverWork
If the meaning of this type isn't clear, there really should be more of a description here...
|
protected class |
Channel.ReceiveSerializer
Deprecated.
As of 4.4 use
ExecutorWorkSerializer . |
protected class |
Channel.SendQueue
A queue that holds buffers that shall be sent.
|
InternalChannel.SendQueueEvent
ILocationAware.Location
IBufferProvider.Introspection
ILifecycle.DeferrableActivation
Constructor and Description |
---|
Channel() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Channel.ReceiverWork |
createReceiverWork(IBuffer buffer) |
protected void |
doActivate() |
protected void |
doBeforeActivate() |
protected void |
doDeactivate() |
short |
getBufferCapacity()
Returns the capacity of the buffers provided by
IBufferProvider.provideBuffer() . |
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() |
ExecutorService |
getReceiveExecutor() |
IBufferHandler |
getReceiveHandler()
Returns the
IBufferHandler that handles buffers received from the peer channel. |
Queue<IBuffer> |
getSendQueue() |
long |
getSentBuffers() |
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 this
BufferProvider . |
void |
retainBuffer(IBuffer buffer)
Retains a buffer to this
BufferProvider . |
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(ExecutorService receiveExecutor) |
void |
setReceiveHandler(IBufferHandler receiveHandler)
Sets the
IBufferHandler to handle buffers received from the peer channel. |
void |
setUserID(String userID) |
String |
toString() |
protected void |
unregisterFromMultiplexer() |
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
activate, deactivate, getLifecycleState, isActive
addListener, getListeners, hasListeners, removeListener
public String getUserID()
getUserID
in interface IUserAware
public void setUserID(String userID)
setUserID
in interface InternalChannel
public ILocationAware.Location getLocation()
ILocationAware
getLocation
in interface ILocationAware
public boolean isClient()
ILocationAware
isClient
in interface ILocationAware
public boolean isServer()
ILocationAware
isServer
in interface ILocationAware
public IChannelMultiplexer getMultiplexer()
IChannel
getMultiplexer
in interface IChannel
public void setMultiplexer(IChannelMultiplexer channelMultiplexer)
setMultiplexer
in interface InternalChannel
public short getID()
IChannel
multiplexer
.public void setID(short id)
setID
in interface InternalChannel
public ExecutorService getExecutorService()
getExecutorService
in interface IExecutorServiceProvider
public ExecutorService getReceiveExecutor()
getReceiveExecutor
in interface InternalChannel
public void setReceiveExecutor(ExecutorService receiveExecutor)
setReceiveExecutor
in interface InternalChannel
public IBufferHandler getReceiveHandler()
IChannel
IBufferHandler
that handles buffers received from the peer channel.getReceiveHandler
in interface IChannel
public void setReceiveHandler(IBufferHandler receiveHandler)
IChannel
IBufferHandler
to handle buffers received from the peer channel.setReceiveHandler
in interface IChannel
public long getSentBuffers()
getSentBuffers
in interface InternalChannel
public long getReceivedBuffers()
getReceivedBuffers
in interface InternalChannel
public Queue<IBuffer> getSendQueue()
getSendQueue
in interface InternalChannel
public void sendBuffer(IBuffer buffer)
IChannel
sendBuffer
in interface IChannel
public void handleBuffer(IBuffer buffer)
handleBuffer
in interface IBufferHandler
buffer
- The buffer to be handled and otionally released.IBuffer.getState()
,
BufferState.PUTTING
,
sendQueue
public void handleBufferFromMultiplexer(IBuffer buffer)
handleBufferFromMultiplexer
in interface InternalChannel
InternalChannelMultiplexer.multiplexChannel(org.eclipse.spi.net4j.InternalChannel)
,
IWorkSerializer
,
Channel.ReceiverWork
protected Channel.ReceiverWork createReceiverWork(IBuffer buffer)
public short getBufferCapacity()
IBufferProvider
IBufferProvider.provideBuffer()
.getBufferCapacity
in interface IBufferProvider
public IBuffer provideBuffer()
IBufferProvider
BufferProvider
.provideBuffer
in interface IBufferProvider
public void retainBuffer(IBuffer buffer)
IBufferProvider
BufferProvider
.retainBuffer
in interface IBufferProvider
protected void doBeforeActivate() throws Exception
doBeforeActivate
in class Lifecycle
Exception
protected void doActivate() throws Exception
doActivate
in class Lifecycle
Exception
protected void doDeactivate() throws Exception
doDeactivate
in class Lifecycle
Exception
protected void unregisterFromMultiplexer()
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