public abstract class AbstractClientChannel extends AbstractChannel implements ClientChannel
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulState
AbstractCloseable.State
ClientChannel.ClientChannelEvent, ClientChannel.Streaming
Modifier and Type | Field and Description |
---|---|
protected ChannelAsyncInputStream |
asyncErr |
protected ChannelAsyncOutputStream |
asyncIn |
protected ChannelAsyncInputStream |
asyncOut |
protected OutputStream |
err |
protected AtomicReference<String> |
exitSignalHolder |
protected AtomicReference<Integer> |
exitStatusHolder |
protected InputStream |
in |
protected InputStream |
invertedErr |
protected OutputStream |
invertedIn |
protected InputStream |
invertedOut |
protected AtomicBoolean |
opened |
protected String |
openFailureLang |
protected String |
openFailureMsg |
protected int |
openFailureReason |
protected OpenFuture |
openFuture |
protected OutputStream |
out |
protected ClientChannel.Streaming |
streaming |
protected String |
type |
channelListenerProxy, channelListeners, eof, executor, gracefulFuture, gracefulState, handlers, localWindow, remoteWindow, RESPONSE_BUFFER_GROWTH_FACTOR, service, shutdownExecutor
closeFuture, lock, state
log
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEM
Modifier | Constructor and Description |
---|---|
protected |
AbstractClientChannel(String type) |
Modifier and Type | Method and Description |
---|---|
protected void |
addChannelSignalRequestHandlers(EventNotifier<String> notifier) |
protected abstract void |
doOpen() |
protected void |
doWriteData(byte[] data,
int off,
int len) |
protected void |
doWriteExtendedData(byte[] data,
int off,
int len) |
IoInputStream |
getAsyncErr() |
IoOutputStream |
getAsyncIn() |
IoInputStream |
getAsyncOut() |
OutputStream |
getErr() |
String |
getExitSignal() |
Integer |
getExitStatus() |
InputStream |
getIn() |
protected Closeable |
getInnerCloseable() |
InputStream |
getInvertedErr() |
OutputStream |
getInvertedIn()
Access to an output stream to send data directly to the remote channel.
|
InputStream |
getInvertedOut() |
OutputStream |
getOut() |
ClientChannel.Streaming |
getStreaming() |
void |
handleOpenFailure(Buffer buffer)
For a client channel, this method will be called internally by the
session when the server has rejected this channel opening.
|
void |
handleOpenSuccess(int recipient,
int rwSize,
int packetSize,
Buffer buffer)
For a client channel, this method will be called internally by the
session when the confirmation has been received.
|
void |
handleWindowAdjust(Buffer buffer) |
OpenFuture |
open() |
OpenFuture |
open(int recipient,
int rwSize,
int packetSize,
Buffer buffer)
For a server channel, this method will actually open the channel
|
void |
setErr(OutputStream err) |
void |
setIn(InputStream in)
Set an input stream that will be read by this channel and forwarded to
the remote channel.
|
void |
setOut(OutputStream out) |
void |
setStreaming(ClientChannel.Streaming streaming) |
Set<ClientChannel.ClientChannelEvent> |
waitFor(Collection<ClientChannel.ClientChannelEvent> mask,
long timeout)
Waits until any of the specified events in the mask is signaled
|
addChannelListener, addPendingRequest, addRequestHandler, configureWindow, doCloseImmediately, getChannelListenerProxy, getExecutorService, getId, getLocalWindow, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getSession, handleChannelRequest, handleClose, handleData, handleEof, handleExtendedData, handleFailure, handleInternalRequest, handleRequest, handleSuccess, handleUnknownChannelRequest, init, isEofSignalled, isShutdownOnExit, notifyStateChanged, preClose, removeChannelListener, removePendingRequest, sendEof, sendResponse, sendWindowAdjust, setEofSignalled, setExecutorService, setRecipient, setShutdownOnExit, toString, writePacket
doCloseGracefully
builder, close, isClosed, isClosing
close, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close
getId, getLocalWindow, getRecipient, getRemoteWindow, getSession, handleClose, handleData, handleEof, handleExtendedData, handleFailure, handleRequest, handleSuccess, init
addChannelListener, getChannelListenerProxy, removeChannelListener
getParentPropertyResolver, getProperties
protected final AtomicBoolean opened
protected final String type
protected ClientChannel.Streaming streaming
protected ChannelAsyncOutputStream asyncIn
protected ChannelAsyncInputStream asyncOut
protected ChannelAsyncInputStream asyncErr
protected InputStream in
protected OutputStream invertedIn
protected OutputStream out
protected InputStream invertedOut
protected OutputStream err
protected InputStream invertedErr
protected final AtomicReference<Integer> exitStatusHolder
protected final AtomicReference<String> exitSignalHolder
protected int openFailureReason
protected String openFailureMsg
protected String openFailureLang
protected OpenFuture openFuture
protected AbstractClientChannel(String type)
protected void addChannelSignalRequestHandlers(EventNotifier<String> notifier)
public ClientChannel.Streaming getStreaming()
getStreaming
in interface ClientChannel
public void setStreaming(ClientChannel.Streaming streaming)
setStreaming
in interface ClientChannel
public IoOutputStream getAsyncIn()
getAsyncIn
in interface ClientChannel
public IoInputStream getAsyncOut()
getAsyncOut
in interface ClientChannel
public IoInputStream getAsyncErr()
getAsyncErr
in interface ClientChannel
public OutputStream getInvertedIn()
ClientChannel
ClientChannel.setIn(java.io.InputStream)
method
and having the channel polling for data in that stream.getInvertedIn
in interface ClientChannel
public InputStream getIn()
public void setIn(InputStream in)
ClientChannel
ClientChannel.getInvertedIn()
method instead and write data directly.setIn
in interface ClientChannel
in
- an InputStream to be polled and forwardedpublic InputStream getInvertedOut()
getInvertedOut
in interface ClientChannel
public OutputStream getOut()
public void setOut(OutputStream out)
setOut
in interface ClientChannel
public InputStream getInvertedErr()
getInvertedErr
in interface ClientChannel
public OutputStream getErr()
public void setErr(OutputStream err)
setErr
in interface ClientChannel
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractChannel
public Set<ClientChannel.ClientChannelEvent> waitFor(Collection<ClientChannel.ClientChannelEvent> mask, long timeout)
ClientChannel
waitFor
in interface ClientChannel
mask
- The ClientChannel.ClientChannelEvent
s masktimeout
- The timeout to wait (msec.) - if non-positive then foreverClientChannel.ClientChannelEvent.TIMEOUT
if timeout expired before the expected event was signalledpublic OpenFuture open() throws IOException
open
in interface ClientChannel
IOException
public OpenFuture open(int recipient, int rwSize, int packetSize, Buffer buffer)
Channel
recipient
- Recipient identifierrwSize
- Read/Write window sizepacketSize
- Preferred maximum packet sizebuffer
- Incoming Buffer
that triggered the call.
Note: the buffer's read position is exactly
after the information that read to this call
was decodedOpenFuture
for the channel open requestpublic void handleOpenSuccess(int recipient, int rwSize, int packetSize, Buffer buffer)
Channel
recipient
- Recipient identifierrwSize
- Read/Write window sizepacketSize
- Preferred maximum packet sizebuffer
- Incoming Buffer
that triggered the call.
Note: the buffer's read position is exactly
after the information that read to this call
was decodedprotected abstract void doOpen() throws IOException
IOException
public void handleOpenFailure(Buffer buffer)
Channel
buffer
- Incoming Buffer
that triggered the call.
Note: the buffer's read position is exactly
after the information that read to this call
was decodedprotected void doWriteData(byte[] data, int off, int len) throws IOException
doWriteData
in class AbstractChannel
IOException
protected void doWriteExtendedData(byte[] data, int off, int len) throws IOException
doWriteExtendedData
in class AbstractChannel
IOException
public void handleWindowAdjust(Buffer buffer) throws IOException
handleWindowAdjust
in class AbstractChannel
IOException
public Integer getExitStatus()
getExitStatus
in interface ClientChannel
null
if not signaledpublic String getExitSignal()
getExitSignal
in interface ClientChannel
null
if not signaledCopyright © 2008–2016 The Apache Software Foundation. All rights reserved.