Package org.apache.sshd.common.channel
Class LocalWindow
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.channel.Window
-
- org.apache.sshd.common.channel.LocalWindow
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ChannelHolder
public class LocalWindow extends Window
AWindow
that describes how much data this side is prepared to receive from the peer. Initialized when the channel is created. This side reduces the window by the amount of data received on reception; if it receives more data than allowed, it closes the channel. Once the data received has been processed, for instance, passed on, this side checks the current window size and if it is low, increases it and sends an SSH_MSG_CHANNEL_WINDOW_ADJUST message to the peer, who then is allowed to send more data again.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicLong
adjustment
private AbstractChannel
channel
private long
released
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description LocalWindow(AbstractChannel channel, boolean isClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consume(long len)
AbstractChannel
getChannel()
void
init(PropertyResolver resolver)
Initializes theLocalWindow
with the packet and window sizes from theresolver
.void
release(long len)
Updates the window once data that has arrived in a channel has been read, making available room for the sender too send more data, sending a window adjust message if necessary.-
Methods inherited from class org.apache.sshd.common.channel.Window
checkInitialized, close, getMaxSize, getPacketSize, getSize, init, isOpen, largerThan, toString, updateSize
-
-
-
-
Field Detail
-
channel
private final AbstractChannel channel
-
adjustment
private final java.util.concurrent.atomic.AtomicLong adjustment
-
released
private long released
-
-
Constructor Detail
-
LocalWindow
public LocalWindow(AbstractChannel channel, boolean isClient)
-
-
Method Detail
-
getChannel
public AbstractChannel getChannel()
- Specified by:
getChannel
in interfaceChannelHolder
- Overrides:
getChannel
in classWindow
- Returns:
- The associated
Channel
instance
-
init
public void init(PropertyResolver resolver)
Initializes theLocalWindow
with the packet and window sizes from theresolver
.- Parameters:
resolver
- to access properties
-
consume
public void consume(long len) throws java.io.IOException
-
release
public void release(long len) throws java.io.IOException
Updates the window once data that has arrived in a channel has been read, making available room for the sender too send more data, sending a window adjust message if necessary.- Parameters:
len
- length of data read from the channel- Throws:
java.io.IOException
- if sending a window adjust message fails
-
-