public class Window extends AbstractLoggingBean implements Channel, PropertyResolver
Modifier and Type | Field and Description |
---|---|
static Predicate<Window> |
SPACE_AVAILABLE_PREDICATE
Default
Predicate used to test if space became available |
log
Constructor and Description |
---|
Window(AbstractChannel channel,
Object lock,
boolean client,
boolean local) |
Modifier and Type | Method and Description |
---|---|
void |
check(int maxFree) |
protected void |
checkInitialized(String location) |
void |
close() |
void |
consume(int len) |
void |
consumeAndCheck(int len) |
void |
expand(int window) |
int |
getMaxSize() |
int |
getPacketSize() |
PropertyResolver |
getParentPropertyResolver() |
Map<String,Object> |
getProperties()
A map of properties that can be used to configure the SSH server
or client.
|
int |
getSize() |
void |
init(int size,
int packetSize,
Map<String,Object> props) |
void |
init(PropertyResolver resolver) |
boolean |
isOpen() |
String |
toString() |
protected void |
updateSize(int size) |
void |
waitAndConsume(int len,
long maxWaitTime)
Waits for enough data to become available to consume the specified size
|
protected void |
waitForCondition(Predicate<? super Window> predicate,
long maxWaitTime)
Waits up to a specified amount of time for a condition to be satisfied and
signaled via the lock.
|
int |
waitForSpace(long maxWaitTime)
Waits until some data becomes available or timeout expires
|
public Window(AbstractChannel channel, Object lock, boolean client, boolean local)
public Map<String,Object> getProperties()
PropertyResolver
A map of properties that can be used to configure the SSH server or client. This map will never be changed by either the server or client and is not supposed to be changed at runtime (changes are not bound to have any effect on a running client or server), though it may affect the creation of sessions later as these values are usually not cached.
Note: the type of the mapped property should match the
expected configuration value type - Long, Integer, Boolean,
String
, etc.... If it doesn't, the toString()
result of the
mapped value is used to convert it to the required type. E.g., if
the mapped value is the string "1234" and the expected
value is a long
then it will be parsed into one. Also, if
the mapped value is an Integer
but a long
is expected,
then it will be converted into one.
getProperties
in interface PropertyResolver
Map
containing configuration values, never null
public PropertyResolver getParentPropertyResolver()
getParentPropertyResolver
in interface PropertyResolver
null
if no parentpublic int getSize()
public int getMaxSize()
public int getPacketSize()
public void init(PropertyResolver resolver)
public void expand(int window)
public void consume(int len)
public void consumeAndCheck(int len) throws IOException
IOException
public void check(int maxFree) throws IOException
IOException
public void waitAndConsume(int len, long maxWaitTime) throws InterruptedException, WindowClosedException, SocketTimeoutException
len
- Size of data to consumemaxWaitTime
- ax. 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, long)
,
consume(int)
public int 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, long)
protected void waitForCondition(Predicate<? super Window> predicate, long 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 (millis) to wait for the condition to be satisfiedWindowClosedException
- If window closed while waitingInterruptedException
- If interrupted while waitingSocketTimeoutException
- If timeout expired before condition was satisfiedisOpen()
protected void updateSize(int size)
protected void checkInitialized(String location)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.