Class ThrottlingChannelStreamWriter
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.contrib.common.channel.throttle.ThrottlingChannelStreamWriter
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, EventListener, org.apache.sshd.common.channel.throttle.ChannelStreamWriter, org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>, org.apache.sshd.common.util.SshdEventListener
public class ThrottlingChannelStreamWriter
extends org.apache.sshd.common.util.logging.AbstractLoggingBean
implements org.apache.sshd.common.channel.throttle.ChannelStreamWriter, org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>
A
ChannelStreamWriter delegate implementation that "throttles" the output by having a limit on the
outstanding packets that have not been sent yet. The writePacket implementation make sure
that the limit has not been exceeded - if so, then it waits until pending packets have been successfully sent before
sending the next packet.
Note: closing the throttler does not close the delegate writer-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicIntegerprivate final org.apache.sshd.common.channel.throttle.ChannelStreamWriterstatic final org.apache.sshd.common.Property<Integer> Max.private final intprivate final longprivate final AtomicBooleanstatic final org.apache.sshd.common.Property<Duration> Timeout (seconds) for throttling packet writer to wait for pending packets sendFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionThrottlingChannelStreamWriter(org.apache.sshd.common.channel.Channel channel) ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, long maxWait) ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, Duration maxWait) ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, TimeUnit waitUnit, long waitCount) ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, org.apache.sshd.common.PropertyResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intorg.apache.sshd.common.channel.throttle.ChannelStreamWriterintlongbooleanisOpen()voidoperationComplete(org.apache.sshd.common.io.IoWriteFuture future) toString()org.apache.sshd.common.io.IoWriteFuturewriteData(org.apache.sshd.common.util.buffer.Buffer buffer) 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
-
Field Details
-
WAIT_TIME
Timeout (seconds) for throttling packet writer to wait for pending packets send -
MAX_PEND_COUNT
Max. pending packets count -
delegate
private final org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate -
maxPendingPackets
private final int maxPendingPackets -
maxWait
private final long maxWait -
open
-
availableCount
-
-
Constructor Details
-
ThrottlingChannelStreamWriter
public ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.Channel channel) -
ThrottlingChannelStreamWriter
public ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, org.apache.sshd.common.PropertyResolver resolver) -
ThrottlingChannelStreamWriter
public ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, TimeUnit waitUnit, long waitCount) -
ThrottlingChannelStreamWriter
public ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, Duration maxWait) -
ThrottlingChannelStreamWriter
public ThrottlingChannelStreamWriter(org.apache.sshd.common.channel.throttle.ChannelStreamWriter delegate, int maxPendingPackets, long maxWait)
-
-
Method Details
-
getDelegate
public org.apache.sshd.common.channel.throttle.ChannelStreamWriter getDelegate() -
getMaxPendingPackets
public int getMaxPendingPackets() -
getAvailablePacketsCount
public int getAvailablePacketsCount() -
getMaxWait
public long getMaxWait() -
isOpen
-
writeData
public org.apache.sshd.common.io.IoWriteFuture writeData(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException - Specified by:
writeDatain interfaceorg.apache.sshd.common.channel.throttle.ChannelStreamWriter- Throws:
IOException
-
operationComplete
public void operationComplete(org.apache.sshd.common.io.IoWriteFuture future) - Specified by:
operationCompletein interfaceorg.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
toString
-