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
Author:
Apache MINA SSHD Project
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.sshd.common.Property<Integer>
    Max. pending packets count
    static final org.apache.sshd.common.Property<Duration>
    Timeout (seconds) for throttling packet writer to wait for pending packets send

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThrottlingChannelStreamWriter(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 Type
    Method
    Description
    void
     
    int
     
    org.apache.sshd.common.channel.throttle.ChannelStreamWriter
     
    int
     
    long
     
    boolean
     
    void
    operationComplete(org.apache.sshd.common.io.IoWriteFuture future)
     
     
    org.apache.sshd.common.io.IoWriteFuture
    writeData(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

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • WAIT_TIME

      public static final org.apache.sshd.common.Property<Duration> WAIT_TIME
      Timeout (seconds) for throttling packet writer to wait for pending packets send
    • MAX_PEND_COUNT

      public static final org.apache.sshd.common.Property<Integer> MAX_PEND_COUNT
      Max. pending packets count
  • 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

      public boolean isOpen()
      Specified by:
      isOpen in interface Channel
    • writeData

      public org.apache.sshd.common.io.IoWriteFuture writeData(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException
      Specified by:
      writeData in interface org.apache.sshd.common.channel.throttle.ChannelStreamWriter
      Throws:
      IOException
    • operationComplete

      public void operationComplete(org.apache.sshd.common.io.IoWriteFuture future)
      Specified by:
      operationComplete in interface org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object