Class ChannelIdTrackingUnknownChannelReferenceHandler
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
-
- org.apache.sshd.contrib.common.session.helpers.ChannelIdTrackingUnknownChannelReferenceHandler
-
- All Implemented Interfaces:
java.util.EventListener,ChannelListener,UnknownChannelReferenceHandler,SshdEventListener
public class ChannelIdTrackingUnknownChannelReferenceHandler extends DefaultUnknownChannelReferenceHandler implements ChannelListener
Makes sure that the referenced "unknown" channel identifier is one that was assigned in the past. Note: it relies on the fact that the defaultConnectionServiceimplementation assigns channels identifiers in ascending order.
-
-
Field Summary
Fields Modifier and Type Field Description static AttributeRepository.AttributeKey<java.lang.Long>LAST_CHANNEL_ID_KEYstatic ChannelIdTrackingUnknownChannelReferenceHandlerTRACKER-
Fields inherited from class org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
INSTANCE
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.channel.ChannelListener
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ChannelIdTrackingUnknownChannelReferenceHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelInitialized(Channel channel)Called to inform about initial setup of a channel via theChannel.init(org.apache.sshd.common.session.ConnectionService, org.apache.sshd.common.session.Session, long)method.ChannelhandleUnknownChannelCommand(ConnectionService service, byte cmd, long channelId, Buffer buffer)Invoked when the connection service responsible for handling channel messages receives a message intended for an unknown channel.-
Methods inherited from class org.apache.sshd.common.session.helpers.DefaultUnknownChannelReferenceHandler
sendFailureResponse
-
Methods 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, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListener
channelClosed, channelOpenFailure, channelOpenSuccess, channelStateChanged
-
-
-
-
Field Detail
-
LAST_CHANNEL_ID_KEY
public static final AttributeRepository.AttributeKey<java.lang.Long> LAST_CHANNEL_ID_KEY
-
TRACKER
public static final ChannelIdTrackingUnknownChannelReferenceHandler TRACKER
-
-
Method Detail
-
channelInitialized
public void channelInitialized(Channel channel)
Description copied from interface:ChannelListenerCalled to inform about initial setup of a channel via theChannel.init(org.apache.sshd.common.session.ConnectionService, org.apache.sshd.common.session.Session, long)method. Note: this method is guaranteed to be called before either of theChannelListener.channelOpenSuccess(Channel)orChannelListener.channelOpenFailure(Channel, Throwable)will be called- Specified by:
channelInitializedin interfaceChannelListener- Parameters:
channel- The initializedChannel
-
handleUnknownChannelCommand
public Channel handleUnknownChannelCommand(ConnectionService service, byte cmd, long channelId, Buffer buffer) throws java.io.IOException
Description copied from interface:UnknownChannelReferenceHandlerInvoked when the connection service responsible for handling channel messages receives a message intended for an unknown channel.- Specified by:
handleUnknownChannelCommandin interfaceUnknownChannelReferenceHandler- Overrides:
handleUnknownChannelCommandin classDefaultUnknownChannelReferenceHandler- Parameters:
service- TheConnectionServiceinstance through which the message was receivedcmd- The requested command identifierchannelId- The (unknown) target channel identifierbuffer- The messageBuffercontaining the rest of the message- Returns:
- The resolved
Channel- ifnullthen the message for the unknown channel is ignored. - Throws:
java.io.IOException- If failed to handle the request
-
-