Class AsyncCapableClientChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ClientChannel,ClientSessionHolder,AttributeRepository,AttributeStore,Channel,ChannelIdentifier,ChannelListenerManager,StreamingChannel,ChannelStreamWriterResolver,ChannelStreamWriterResolverManager,Closeable,PropertyResolver,SessionContextHolder,SessionHolder<Session>,ExecutorServiceCarrier
- Direct Known Subclasses:
ChannelDirectTcpip,ChannelSession
AbstractClientChannel.setIn(InputStream).- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sshd.common.channel.AbstractChannel
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulState, AbstractChannel.PacketValidatorNested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.StateNested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>Nested classes/interfaces inherited from interface org.apache.sshd.common.channel.StreamingChannel
StreamingChannel.Streaming -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Future<?> protected CloseableExecutorServiceprotected final booleanFields inherited from class org.apache.sshd.client.channel.AbstractClientChannel
asyncErr, asyncIn, asyncOut, err, exitSignalHolder, exitStatusHolder, in, invertedErr, invertedIn, invertedOut, opened, openFailureLang, openFailureMsg, openFailureReason, openFuture, out, redirectErrorStream, streamingFields inherited from class org.apache.sshd.common.channel.AbstractChannel
channelListenerProxy, channelListeners, closeSignaled, DEFAULT_PACKET_VALIDATOR, eofReceived, eofSent, gracefulFuture, gracefulState, initialized, RESPONSE_BUFFER_GROWTH_FACTOR, service, unregisterSignaledFields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.channel.Channel
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEMFields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver
NONEFields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAsyncCapableClientChannel(String type, boolean withErrorStream) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoOpen()protected voiddoWriteExtendedData(byte[] data, int off, long len) getErr()protected CloseableObtains anInputStreamto read receivedSshConstants.SSH_MSG_CHANNEL_EXTENDED_DATAdata directly from the channel.protected voidprotected intsecuredRead(InputStream in, int maxChunkSize, byte[] buf, int off, int len) voidsetErr(OutputStream err) Sets an output stream for the channel to write receivedSshConstants.SSH_MSG_CHANNEL_EXTENDED_DATAdata to.Methods inherited from class org.apache.sshd.client.channel.AbstractClientChannel
addChannelSignalRequestHandlers, doWriteData, getAsyncIn, getAsyncOut, getChannelState, getChannelType, getExitSignal, getExitStatus, getIn, getInvertedIn, getInvertedOut, getOut, getStreaming, handleOpenFailure, handleOpenSuccess, handleWindowAdjust, isRedirectErrorStream, mayWrite, open, open, setIn, setOut, setRedirectErrorStream, setStreaming, updateCurrentChannelState, waitForMethods inherited from class org.apache.sshd.common.channel.AbstractChannel
addChannelListener, addPendingRequest, addRequestHandler, attributeKeys, clearAttributes, computeAttributeIfAbsent, configureWindow, getAttribute, getAttributesCount, getChannelId, getChannelListenerProxy, getChannelStreamWriterResolver, getExecutorService, getLocalWindow, getPacketValidator, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getRequestHandlers, getSession, handleChannelRegistrationResult, handleChannelRequest, handleChannelUnregistration, handleClose, handleData, handleEof, handleExtendedData, handleFailure, handleInternalRequest, handleRequest, handleSuccess, handleUnknownChannelRequest, init, invokeChannelSignaller, isEofSent, isEofSignalled, isInitialized, notifyStateChanged, notifyStateChanged, preClose, removeAttribute, removeChannelListener, removePendingRequest, removeRequestHandler, resolveChannelStreamWriterResolver, sendEof, sendResponse, sendWindowAdjust, setAttribute, setChannelStreamWriterResolver, setPacketValidator, setRecipient, signalChannelClosed, signalChannelClosed, signalChannelInitialized, signalChannelInitialized, signalChannelOpenFailure, signalChannelOpenFailure, signalChannelOpenSuccess, signalChannelOpenSuccess, toString, validateIncomingDataSize, writePacketMethods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediatelyMethods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListenerMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCountMethods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttributeMethods inherited from interface org.apache.sshd.common.channel.Channel
addRequestHandler, addRequestHandlers, getLocalWindow, getRecipient, getRemoteWindow, getRequestHandlers, handleChannelRegistrationResult, handleChannelUnregistration, handleClose, handleData, handleEof, handleExtendedData, handleFailure, handleRequest, handleSuccess, init, isEofSignalled, isInitialized, removeRequestHandler, removeRequestHandlers, resolveAttribute, writePacketMethods inherited from interface org.apache.sshd.common.channel.ChannelIdentifier
getChannelIdMethods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListenerMethods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolverMethods inherited from interface org.apache.sshd.client.channel.ClientChannel
getClientSession, waitForMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmptyMethods inherited from interface org.apache.sshd.common.session.SessionHolder
getSession, getSessionContext
-
Field Details
-
withErrorStream
protected final boolean withErrorStream -
pumperService
-
pumper
-
-
Constructor Details
-
AsyncCapableClientChannel
-
-
Method Details
-
getErr
- Overrides:
getErrin classAbstractClientChannel
-
getAsyncErr
- Specified by:
getAsyncErrin interfaceClientChannel- Overrides:
getAsyncErrin classAbstractClientChannel
-
getInvertedErr
Description copied from interface:ClientChannelObtains anInputStreamto read receivedSshConstants.SSH_MSG_CHANNEL_EXTENDED_DATAdata directly from the channel. This is an alternative toClientChannel.setErr(OutputStream). If the error stream is redirected to the output stream viasetRedirectErrorStream(true), the returned stream will not receive any data and be always at EOF.When the channel closes, it will not close the returned stream. It is the caller's responsibility to close the returned stream if needed. Closing the stream while the channel is open may cause the channel to be closed forcibly if more data arrives. The stream remains open after the channel has closed, so that the caller can read the last arrived data even afterwards.
As with all external processes, the application should read this stream (unless it was redirected) to avoid that the channel blocks when the stream's buffer is full. The buffer size for the returned stream is bounded by the channel's local window size. If the caller does not read this stream, the channel will block once the local window is exhausted.
This method should be called only after the channel has been opened.
- Specified by:
getInvertedErrin interfaceClientChannel- Overrides:
getInvertedErrin classAbstractClientChannel- Returns:
- an
InputStreamfor reading received data, ornullif an output stream was set viaClientChannel.setErr(OutputStream) - See Also:
-
setErr
Description copied from interface:ClientChannelSets an output stream for the channel to write receivedSshConstants.SSH_MSG_CHANNEL_EXTENDED_DATAdata to. For remote command execution, this is typically the remote command'sstderr.The stream must be set before the channel is opened. When the channel closes, it will
closethe given stream.If no stream is set by the time the channel is opened, the channel will internally forward data to a stream that can be read via the
InputStreamobtained viaClientChannel.getInvertedErr(). (Or it might forward the data to the output stream ifsetRedirectErrorStream(true)is set.)- Specified by:
setErrin interfaceClientChannel- Overrides:
setErrin classAbstractClientChannel- Parameters:
err- theOutputStream- See Also:
-
doWriteExtendedData
- Overrides:
doWriteExtendedDatain classAbstractClientChannel- Throws:
IOException
-
doOpen
- Specified by:
doOpenin classAbstractClientChannel- Throws:
IOException
-
getInnerCloseable
- Overrides:
getInnerCloseablein classAbstractClientChannel
-
closeImmediately0
protected void closeImmediately0() -
pumpInputStream
protected void pumpInputStream() -
securedRead
protected int securedRead(InputStream in, int maxChunkSize, byte[] buf, int off, int len) throws IOException - Throws:
IOException
-