S - Type of AbstractSession being usedpublic abstract class AbstractConnectionService<S extends AbstractSession> extends AbstractInnerCloseable implements ConnectionService
AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
protected Map<Integer,Channel> |
channels
Map of channels keyed by the identifier
|
static int |
DEFAULT_MAX_CHANNELS
Default value for
MAX_CONCURRENT_CHANNELS_PROP is none specified |
static String |
MAX_CONCURRENT_CHANNELS_PROP
Property that can be used to configure max. allowed concurrent active channels
|
protected AtomicInteger |
nextChannelId
Next channel identifier
|
static IntUnaryOperator |
RESPONSE_BUFFER_GROWTH_FACTOR
Default growth factor function used to resize response buffers
|
closeFuture, lock, statelogCLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConnectionService(S session) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPortForwardingEventListener(PortForwardingEventListener listener)
Add a port forwarding listener
|
boolean |
addPortForwardingEventListenerManager(PortForwardingEventListenerManager manager) |
void |
channelClose(Buffer buffer)
Close a channel due to a close packet received
|
void |
channelData(Buffer buffer)
Process incoming data on a channel
|
void |
channelEof(Buffer buffer)
Process end of file on a channel
|
void |
channelExtendedData(Buffer buffer)
Process incoming extended data on a channel
|
void |
channelFailure(Buffer buffer)
Process a failure on a channel
|
protected void |
channelOpen(Buffer buffer) |
void |
channelOpenConfirmation(Buffer buffer) |
void |
channelOpenFailure(Buffer buffer) |
void |
channelRequest(Buffer buffer)
Service a request on a channel
|
void |
channelSuccess(Buffer buffer)
Process a success on a channel
|
void |
channelWindowAdjust(Buffer buffer)
Process a window adjust packet on a channel
|
protected AgentForwardSupport |
createAgentForwardSupport(S session) |
protected TcpipForwarder |
createTcpipForwarder(S session) |
protected X11ForwardSupport |
createX11ForwardSupport(S session) |
AgentForwardSupport |
getAgentForwardSupport() |
protected Channel |
getChannel(Buffer buffer)
Retrieve the channel designated by the given packet
|
protected Channel |
getChannel(int recipient,
Buffer buffer) |
Collection<Channel> |
getChannels() |
protected Closeable |
getInnerCloseable() |
protected int |
getNextChannelId() |
PortForwardingEventListener |
getPortForwardingEventListenerProxy() |
Collection<PortForwardingEventListenerManager> |
getRegisteredManagers() |
S |
getSession() |
TcpipForwarder |
getTcpipForwarder()
Retrieve the tcpip forwarder
|
X11ForwardSupport |
getX11ForwardSupport() |
protected void |
globalRequest(Buffer buffer)
Process global requests
|
protected void |
handleChannelRegistrationFailure(Channel channel,
int channelId) |
protected void |
handleUnknownRequest(Buffer buffer,
String req,
boolean wantReply) |
boolean |
isAllowMoreSessions() |
protected void |
preClose()
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.
|
void |
process(int cmd,
Buffer buffer)
Service the request.
|
int |
registerChannel(Channel channel)
Register a newly created channel with a new unique identifier
|
void |
removePortForwardingEventListener(PortForwardingEventListener listener)
Remove a port forwarding listener
|
boolean |
removePortForwardingEventListenerManager(PortForwardingEventListenerManager manager) |
protected void |
requestFailure(Buffer buffer) |
protected void |
requestSuccess(Buffer buffer) |
protected IoWriteFuture |
sendChannelOpenFailure(Buffer buffer,
int sender,
int reasonCode,
String message,
String lang) |
protected IoWriteFuture |
sendGlobalResponse(Buffer buffer,
String req,
RequestHandler.Result result,
boolean wantReply) |
void |
setAllowMoreSessions(boolean allow) |
void |
start() |
String |
toString() |
void |
unregisterChannel(Channel channel)
Remove this channel from the list of managed channels
|
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, isClosed, isClosing, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerpublic static final String MAX_CONCURRENT_CHANNELS_PROP
registerChannel(Channel),
Constant Field Valuespublic static final int DEFAULT_MAX_CHANNELS
MAX_CONCURRENT_CHANNELS_PROP is none specifiedpublic static final IntUnaryOperator RESPONSE_BUFFER_GROWTH_FACTOR
protected final AtomicInteger nextChannelId
protected AbstractConnectionService(S session)
public PortForwardingEventListener getPortForwardingEventListenerProxy()
getPortForwardingEventListenerProxy in interface PortForwardingEventListenerManagerpublic void addPortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManageraddPortForwardingEventListener in interface PortForwardingEventListenerManagerlistener - The PortForwardingEventListener to add - never nullpublic void removePortForwardingEventListener(PortForwardingEventListener listener)
PortForwardingEventListenerManagerremovePortForwardingEventListener in interface PortForwardingEventListenerManagerlistener - The PortForwardingEventListener to remove - ignored if nullpublic Collection<PortForwardingEventListenerManager> getRegisteredManagers()
getRegisteredManagers in interface PortForwardingEventListenerManagerHolderpublic boolean addPortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
addPortForwardingEventListenerManager in interface PortForwardingEventListenerManagerHolderpublic boolean removePortForwardingEventListenerManager(PortForwardingEventListenerManager manager)
removePortForwardingEventListenerManager in interface PortForwardingEventListenerManagerHolderpublic Collection<Channel> getChannels()
public S getSession()
getSession in interface Servicepublic TcpipForwarder getTcpipForwarder()
ConnectionServicegetTcpipForwarder in interface ConnectionServiceTcpipForwarderprotected void preClose()
AbstractCloseablepreClose in class AbstractCloseableprotected TcpipForwarder createTcpipForwarder(S session)
public X11ForwardSupport getX11ForwardSupport()
getX11ForwardSupport in interface ConnectionServiceprotected X11ForwardSupport createX11ForwardSupport(S session)
public AgentForwardSupport getAgentForwardSupport()
getAgentForwardSupport in interface ConnectionServiceprotected AgentForwardSupport createAgentForwardSupport(S session)
protected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseableprotected int getNextChannelId()
public int registerChannel(Channel channel) throws IOException
ConnectionServiceregisterChannel in interface ConnectionServicechannel - The Channel to registerIOException - If failed to initialize and register the channelprotected void handleChannelRegistrationFailure(Channel channel, int channelId) throws IOException
IOExceptionpublic void unregisterChannel(Channel channel)
unregisterChannel in interface ConnectionServicechannel - the channelpublic void process(int cmd,
Buffer buffer)
throws Exception
Servicepublic boolean isAllowMoreSessions()
isAllowMoreSessions in interface ConnectionServicepublic void setAllowMoreSessions(boolean allow)
setAllowMoreSessions in interface ConnectionServicepublic void channelOpenConfirmation(Buffer buffer) throws IOException
IOExceptionpublic void channelOpenFailure(Buffer buffer) throws IOException
IOExceptionpublic void channelData(Buffer buffer) throws IOException
buffer - the buffer containing the dataIOException - if an error occurspublic void channelExtendedData(Buffer buffer) throws IOException
buffer - the buffer containing the dataIOException - if an error occurspublic void channelWindowAdjust(Buffer buffer) throws IOException
buffer - the buffer containing the window adjustment parametersIOException - if an error occurspublic void channelEof(Buffer buffer) throws IOException
buffer - the buffer containing the packetIOException - if an error occurspublic void channelClose(Buffer buffer) throws IOException
buffer - the buffer containing the packetIOException - if an error occurspublic void channelRequest(Buffer buffer) throws IOException
buffer - the buffer containing the requestIOException - if an error occurspublic void channelFailure(Buffer buffer) throws IOException
buffer - the buffer containing the packetIOException - if an error occurspublic void channelSuccess(Buffer buffer) throws IOException
buffer - the buffer containing the packetIOException - if an error occursprotected Channel getChannel(Buffer buffer) throws IOException
buffer - the incoming packetIOException - if the channel does not existsprotected Channel getChannel(int recipient, Buffer buffer) throws IOException
IOExceptionprotected IoWriteFuture sendChannelOpenFailure(Buffer buffer, int sender, int reasonCode, String message, String lang) throws IOException
IOExceptionprotected void handleUnknownRequest(Buffer buffer, String req, boolean wantReply) throws IOException
IOExceptionprotected IoWriteFuture sendGlobalResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException
IOExceptionCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.