public class RemoteWindow extends Window
Window
reflecting this side's view of the peer's LocalWindow
. A RemoteWindow
is initialized
when the peer announces its packet and window sizes in the initial message exchange when opening a channel. Whenever
this side wants to send data, it checks whether the remote window has still enough space; if not, it sends only as
much data as possible. When data is sent, the remote window size is reduced by the number of data bytes sent. When
the window size drops to zero, no data is sent at all, and this side will have to wait for an
SSH_MSG_CHANNEL_WINDOW_ADJUST message from the peer, which will increase the available window size again.log
Constructor and Description |
---|
RemoteWindow(Channel channel,
boolean isClient) |
Modifier and Type | Method and Description |
---|---|
void |
consume(long len) |
void |
expand(long increment) |
void |
init(long size,
long packetSize,
PropertyResolver resolver)
Initializes the
RemoteWindow with the packet and window sizes received from the peer. |
void |
waitAndConsume(long len,
Duration maxWaitTime)
Waits for enough data to become available to consume the specified size
|
void |
waitAndConsume(long len,
long maxWaitTime)
Waits for enough data to become available to consume the specified size
|
protected void |
waitForCondition(Predicate<? super Window> predicate,
Duration maxWaitTime)
Waits up to a specified amount of time for a condition to be satisfied and signaled via the lock.
|
long |
waitForSpace(Duration maxWaitTime)
Waits until some data becomes available or timeout expires
|
long |
waitForSpace(long maxWaitTime)
Waits until some data becomes available or timeout expires
|
checkInitialized, close, getChannel, getMaxSize, getPacketSize, getSize, isOpen, largerThan, toString, updateSize
public RemoteWindow(Channel channel, boolean isClient)
public void init(long size, long packetSize, PropertyResolver resolver)
RemoteWindow
with the packet and window sizes received from the peer.public void expand(long increment)
public void waitAndConsume(long len, long maxWaitTime) throws InterruptedException, WindowClosedException, SocketTimeoutException
len
- Size of data to consumemaxWaitTime
- Max. time (millis) to wait for enough data to become availableInterruptedException
- If interrupted while waitingWindowClosedException
- If window closed while waitingSocketTimeoutException
- If timeout expired before enough data became availablewaitForCondition(Predicate, Duration)
,
consume(long)
public void waitAndConsume(long len, Duration maxWaitTime) throws InterruptedException, WindowClosedException, SocketTimeoutException
len
- Size of data to consumemaxWaitTime
- Max. time to wait for enough data to become availableInterruptedException
- If interrupted while waitingWindowClosedException
- If window closed while waitingSocketTimeoutException
- If timeout expired before enough data became availablewaitForCondition(Predicate, Duration)
,
consume(long)
public long waitForSpace(long maxWaitTime) throws InterruptedException, WindowClosedException, SocketTimeoutException
maxWaitTime
- Max. time (millis) to wait for space to become availableInterruptedException
- If interrupted while waitingWindowClosedException
- If window closed while waitingSocketTimeoutException
- If timeout expired before space became availablewaitForCondition(Predicate, Duration)
public long waitForSpace(Duration maxWaitTime) throws InterruptedException, WindowClosedException, SocketTimeoutException
maxWaitTime
- Max. time to wait for space to become availableInterruptedException
- If interrupted while waitingWindowClosedException
- If window closed while waitingSocketTimeoutException
- If timeout expired before space became availablewaitForCondition(Predicate, Duration)
protected void waitForCondition(Predicate<? super Window> predicate, Duration maxWaitTime) throws WindowClosedException, InterruptedException, SocketTimeoutException
predicate
- The Predicate
to check if the condition has been satisfied - the argument
to the predicate is this
referencemaxWaitTime
- Max. time to wait for the condition to be satisfiedWindowClosedException
- If window closed while waitingInterruptedException
- If interrupted while waitingSocketTimeoutException
- If timeout expired before condition was satisfiedWindow.isOpen()
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.