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 AgentForwardSupport |
agentForward |
protected Map<Integer,Channel> |
channels
Map of channels keyed by the identifier
|
static int |
DEFAULT_MAX_CHANNELS |
static String |
MAX_CONCURRENT_CHANNELS_PROP
Property that can be used to configure max.
|
protected AtomicInteger |
nextChannelId
Next channel identifier
|
static Int2IntFunction |
RESPONSE_BUFFER_GROWTH_FACTOR
Default growth factor function used to resize response buffers
|
protected TcpipForwarder |
tcpipForwarder
The tcpip forwarder
|
protected X11ForwardSupport |
x11Forward |
closeFuture, lock, state
log
Modifier | Constructor and Description |
---|---|
protected |
AbstractConnectionService(S session) |
Modifier and Type | Method and Description |
---|---|
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 Channel |
getChannel(Buffer buffer)
Retrieve the channel designated by the given packet
|
Collection<Channel> |
getChannels() |
protected Closeable |
getInnerCloseable() |
protected int |
getNextChannelId() |
S |
getSession() |
TcpipForwarder |
getTcpipForwarder()
Retrieve the tcpip forwarder
|
protected void |
globalRequest(Buffer buffer)
Process global requests
|
protected void |
handleUnknownRequest(Buffer buffer,
String req,
boolean wantReply) |
boolean |
isAllowMoreSessions() |
void |
process(int cmd,
Buffer buffer)
Service the request.
|
int |
registerChannel(Channel channel)
Register a newly created channel with a new unique identifier
|
protected void |
requestFailure(Buffer buffer) |
protected void |
requestSuccess(Buffer buffer) |
protected void |
sendChannelOpenFailure(Buffer buffer,
int sender,
int reasonCode,
String message,
String lang) |
protected void |
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, doCloseImmediately
builder, close, isClosed, isClosing, preClose
close, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createX11Display, initAgentForward
public static final String MAX_CONCURRENT_CHANNELS_PROP
registerChannel(Channel)
,
Constant Field Valuespublic static final int DEFAULT_MAX_CHANNELS
public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR
protected final AtomicInteger nextChannelId
protected final TcpipForwarder tcpipForwarder
protected final AgentForwardSupport agentForward
protected final X11ForwardSupport x11Forward
protected AbstractConnectionService(S session)
public Collection<Channel> getChannels()
public S getSession()
getSession
in interface Service
public TcpipForwarder getTcpipForwarder()
ConnectionService
getTcpipForwarder
in interface ConnectionService
TcpipForwarder
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractInnerCloseable
protected int getNextChannelId()
public int registerChannel(Channel channel) throws IOException
ConnectionService
registerChannel
in interface ConnectionService
channel
- The Channel
to registerIOException
- If failed to initialize and register the channelpublic void unregisterChannel(Channel channel)
unregisterChannel
in interface ConnectionService
channel
- the channelpublic void process(int cmd, Buffer buffer) throws Exception
Service
public boolean isAllowMoreSessions()
isAllowMoreSessions
in interface ConnectionService
public void setAllowMoreSessions(boolean allow)
setAllowMoreSessions
in interface ConnectionService
public void channelOpenConfirmation(Buffer buffer) throws IOException
IOException
public void channelOpenFailure(Buffer buffer) throws IOException
IOException
public 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 void sendChannelOpenFailure(Buffer buffer, int sender, int reasonCode, String message, String lang) throws IOException
IOException
protected void handleUnknownRequest(Buffer buffer, String req, boolean wantReply) throws IOException
IOException
protected void sendGlobalResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException
IOException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.