Package org.apache.sshd.common.channel
Class Window
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.channel.Window
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ChannelHolder
- Direct Known Subclasses:
LocalWindow
,RemoteWindow
public abstract class Window extends AbstractLoggingBean implements ChannelHolder, java.io.Closeable
AChannel
implements a sliding window flow control for data packets (SSH_MSG_CHANNEL_DATA and SSH_MSG_CHANNEL_EXTENDED_DATA packets). Each channel has two windows, a local window describing how much data it is prepared to receive (and the peer is allowed to send), and a remote window that reflects this side's view of the peer's local window. When the local window size is zero, no data should be received; when the remote window size is zero, no data should be sent. Peers update the other's remote window periodically, but at the latest when a window is exhausted, by sending SSH_MSG_CHANNEL_WINDOW_ADJUST messages.- See Also:
LocalWindow
,RemoteWindow
-
-
Field Summary
Fields Modifier and Type Field Description private Channel
channelInstance
private java.util.concurrent.atomic.AtomicBoolean
closed
private java.util.concurrent.atomic.AtomicBoolean
initialized
protected java.lang.Object
lock
private long
maxSize
private long
packetSize
private long
size
private java.lang.String
suffix
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkInitialized(java.lang.String location)
void
close()
abstract void
consume(long len)
Channel
getChannel()
long
getMaxSize()
long
getPacketSize()
long
getSize()
protected void
init(long size, long packetSize, PropertyResolver resolver)
boolean
isOpen()
protected static java.util.function.Predicate<Window>
largerThan(long minSize)
java.lang.String
toString()
protected void
updateSize(long size)
-
-
-
Field Detail
-
lock
protected final java.lang.Object lock
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
initialized
private final java.util.concurrent.atomic.AtomicBoolean initialized
-
channelInstance
private final Channel channelInstance
-
suffix
private final java.lang.String suffix
-
size
private long size
-
maxSize
private long maxSize
-
packetSize
private long packetSize
-
-
Constructor Detail
-
Window
protected Window(Channel channel, boolean isClient)
-
-
Method Detail
-
largerThan
protected static java.util.function.Predicate<Window> largerThan(long minSize)
-
getChannel
public Channel getChannel()
- Specified by:
getChannel
in interfaceChannelHolder
- Returns:
- The associated
Channel
instance
-
getSize
public long getSize()
-
getMaxSize
public long getMaxSize()
-
getPacketSize
public long getPacketSize()
-
init
protected void init(long size, long packetSize, PropertyResolver resolver)
-
consume
public abstract void consume(long len) throws java.io.IOException
- Throws:
java.io.IOException
-
updateSize
protected void updateSize(long size)
-
checkInitialized
protected void checkInitialized(java.lang.String location)
-
isOpen
public boolean isOpen()
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-