Package io.vertx.core.net

## Class TrafficShapingOptions

- java.lang.Object
- - io.vertx.core.net.TrafficShapingOptions

-     public class TrafficShapingOptions
      extends Object

  Options describing how `GlobalTrafficShapingHandler` will handle traffic shaping.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `DEFAULT_CHECK_INTERVAL` | Default check interval for stats = 1 second.
    `static long` | `DEFAULT_INBOUND_GLOBAL_BANDWIDTH_LIMIT` | Default inbound bandwidth limit in bytes/sec = 0 (0 implies unthrottled)
    `static long` | `DEFAULT_MAX_TIME` | Default max delay to wait = 15 seconds.
    `static long` | `DEFAULT_OUTBOUND_GLOBAL_BANDWIDTH_LIMIT` | Default outbound bandwidth limit in bytes/sec = 0 (0 implies unthrottled)
    `static long` | `DEFAULT_PEAK_OUTBOUND_GLOBAL_BANDWIDTH` | Default peak outbound bandwidth limit in bytes/sec = 400 Mbps (aligns with netty's default in `io.netty.handler.traffic.AbstractTrafficShapingHandler#DEFAULT_MAX_SIZE`)

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TrafficShapingOptions()` |
    `TrafficShapingOptions​(JsonObject json)` |
    `TrafficShapingOptions​(TrafficShapingOptions other)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `getCheckIntervalForStats()` |
    `TimeUnit` | `getCheckIntervalForStatsTimeUnit()` |
    `long` | `getInboundGlobalBandwidth()` |
    `long` | `getMaxDelayToWait()` |
    `TimeUnit` | `getMaxDelayToWaitTimeUnit()` |
    `long` | `getOutboundGlobalBandwidth()` |
    `long` | `getPeakOutboundGlobalBandwidth()` |
    `TrafficShapingOptions` | `setCheckIntervalForStats​(long checkIntervalForStats)` | Set the delay between two computations of performances for channels
    `TrafficShapingOptions` | `setCheckIntervalForStatsTimeUnit​(TimeUnit checkIntervalForStatsTimeUnit)` | Set time unit for check interval for stats.
    `TrafficShapingOptions` | `setInboundGlobalBandwidth​(long inboundGlobalBandwidth)` | Set bandwidth limit in bytes per second for inbound connections
    `TrafficShapingOptions` | `setMaxDelayToWait​(long maxDelayToWaitTime)` | Set the maximum delay to wait in case of traffic excess
    `TrafficShapingOptions` | `setMaxDelayToWaitUnit​(TimeUnit maxDelayToWaitTimeUnit)` | Set the maximum delay to wait time unit
    `TrafficShapingOptions` | `setOutboundGlobalBandwidth​(long outboundGlobalBandwidth)` | Set bandwidth limit in bytes per second for outbound connections
    `TrafficShapingOptions` | `setPeakOutboundGlobalBandwidth​(long peakOutboundGlobalBandwidth)` | Set the maximum global write size in bytes per second allowed in the buffer globally for all channels before write suspended is set.
    `JsonObject` | `toJson()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_INBOUND_GLOBAL_BANDWIDTH_LIMIT

          public static final long DEFAULT_INBOUND_GLOBAL_BANDWIDTH_LIMIT

      Default inbound bandwidth limit in bytes/sec = 0 (0 implies unthrottled)
      See Also:
        Constant Field Values

    - #### DEFAULT_OUTBOUND_GLOBAL_BANDWIDTH_LIMIT

          public static final long DEFAULT_OUTBOUND_GLOBAL_BANDWIDTH_LIMIT

      Default outbound bandwidth limit in bytes/sec = 0 (0 implies unthrottled)
      See Also:
        Constant Field Values

    - #### DEFAULT_PEAK_OUTBOUND_GLOBAL_BANDWIDTH

          public static final long DEFAULT_PEAK_OUTBOUND_GLOBAL_BANDWIDTH

      Default peak outbound bandwidth limit in bytes/sec = 400 Mbps (aligns with netty's default in `io.netty.handler.traffic.AbstractTrafficShapingHandler#DEFAULT_MAX_SIZE`)
      See Also:
        Constant Field Values

    - #### DEFAULT_CHECK_INTERVAL

          public static final long DEFAULT_CHECK_INTERVAL

      Default check interval for stats = 1 second. The units are in milliseconds. (Aligns with netty's default in `AbstractTrafficShapingHandler.DEFAULT_CHECK_INTERVAL`)

    - #### DEFAULT_MAX_TIME

          public static final long DEFAULT_MAX_TIME

      Default max delay to wait = 15 seconds. The units are in milliseconds. (Aligns with netty's default in `AbstractTrafficShapingHandler.DEFAULT_MAX_TIME`)

  - ### Constructor Detail

    - #### TrafficShapingOptions

          public TrafficShapingOptions()

    - #### TrafficShapingOptions

          public TrafficShapingOptions​(TrafficShapingOptions other)

    - #### TrafficShapingOptions

          public TrafficShapingOptions​(JsonObject json)

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

    - #### setInboundGlobalBandwidth

          public TrafficShapingOptions setInboundGlobalBandwidth​(long inboundGlobalBandwidth)

      Set bandwidth limit in bytes per second for inbound connections
      Parameters:
        `inboundGlobalBandwidth` - bandwidth limit
      Returns:
        a reference to this, so the API can be used fluently

    - #### setOutboundGlobalBandwidth

          public TrafficShapingOptions setOutboundGlobalBandwidth​(long outboundGlobalBandwidth)

      Set bandwidth limit in bytes per second for outbound connections
      Parameters:
        `outboundGlobalBandwidth` - bandwidth limit
      Returns:
        a reference to this, so the API can be used fluently

    - #### setMaxDelayToWait

          public TrafficShapingOptions setMaxDelayToWait​(long maxDelayToWaitTime)

      Set the maximum delay to wait in case of traffic excess
      Parameters:
        `maxDelayToWaitTime` - maximum delay time for waiting
      Returns:
        a reference to this, so the API can be used fluently

    - #### setMaxDelayToWaitUnit

          public TrafficShapingOptions setMaxDelayToWaitUnit​(TimeUnit maxDelayToWaitTimeUnit)

      Set the maximum delay to wait time unit
      Parameters:
        `maxDelayToWaitTimeUnit` - maximum delay time's unit
      Returns:
        a reference to this, so the API can be used fluently

    - #### setCheckIntervalForStats

          public TrafficShapingOptions setCheckIntervalForStats​(long checkIntervalForStats)

      Set the delay between two computations of performances for channels
      Parameters:
        `checkIntervalForStats` - delay between two computations of performances
      Returns:
        a reference to this, so the API can be used fluently

    - #### setCheckIntervalForStatsTimeUnit

          public TrafficShapingOptions setCheckIntervalForStatsTimeUnit​(TimeUnit checkIntervalForStatsTimeUnit)

      Set time unit for check interval for stats.
      Parameters:
        `checkIntervalForStatsTimeUnit` - check interval for stats time unit
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPeakOutboundGlobalBandwidth

          public TrafficShapingOptions setPeakOutboundGlobalBandwidth​(long peakOutboundGlobalBandwidth)

      Set the maximum global write size in bytes per second allowed in the buffer globally for all channels before write suspended is set. Default value is 400 MB
      Parameters:
        `peakOutboundGlobalBandwidth` - peak outbound bandwidth
      Returns:
        a reference to this, so the API can be used fluently

    - #### getInboundGlobalBandwidth

          public long getInboundGlobalBandwidth()

      Returns:
        inbound bandwidth limit in bytes

    - #### getOutboundGlobalBandwidth

          public long getOutboundGlobalBandwidth()

      Returns:
        outbound bandwidth limit in byte

    - #### getPeakOutboundGlobalBandwidth

          public long getPeakOutboundGlobalBandwidth()

      Returns:
        max outbound bandwidth limit in bytes

    - #### getMaxDelayToWait

          public long getMaxDelayToWait()

      Returns:
        maximum delay to wait in case of traffic excess

    - #### getMaxDelayToWaitTimeUnit

          public TimeUnit getMaxDelayToWaitTimeUnit()

      Returns:
        maximum delay time unit

    - #### getCheckIntervalForStats

          public long getCheckIntervalForStats()

      Returns:
        delay between two computations of performances

    - #### getCheckIntervalForStatsTimeUnit

          public TimeUnit getCheckIntervalForStatsTimeUnit()

      Returns:
        check interval for stats time unit