## org.red5.server.net.filter
Class TrafficShapingFilter

    java.lang.Object
      org.apache.mina.core.filterchain.IoFilterAdapter
          org.red5.server.net.filter.TrafficShapingFilter

All Implemented Interfaces:
  IoFilter

    public class TrafficShapingFilter

extends IoFilterAdapter

An `IoFilter` that limits bandwidth (bytes per second) related with read and write operations on a per-session basis.

It is always recommended to add this filter in the first place of the `IoFilterChain`.
This originated from the Mina sandbox.

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.mina.core.filterchain.IoFilter
`IoFilter.NextFilter`

Field Summary
`protected static Logger` `log`

Constructor Summary
`TrafficShapingFilter(int maxReadThroughput, int maxWriteThroughput)`
`TrafficShapingFilter(ScheduledExecutorService scheduledExecutor, int maxReadThroughput, int maxWriteThroughput)`
`TrafficShapingFilter(ScheduledExecutorService scheduledExecutor, MessageSizeEstimator messageSizeEstimator, int maxReadThroughput, int maxWriteThroughput)`

Method Summary
`int` `getMaxReadThroughput()`
`int` `getMaxWriteThroughput()`
`MessageSizeEstimator` `getMessageSizeEstimator()`
`int` `getPoolSize()`
`ScheduledExecutorService` `getScheduledExecutor()`
`void` `messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message)`
`void` `messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest)`
`void` `onPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)`
`void` `onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter)`
`void` `setMaxReadThroughput(int maxReadThroughput)`
`void` `setMaxWriteThroughput(int maxWriteThroughput)`
`void` `setPoolSize(int poolSize)`

Methods inherited from class org.apache.mina.core.filterchain.IoFilterAdapter
`destroy, exceptionCaught, filterClose, filterWrite, init, onPostAdd, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### log

    protected static Logger log

Constructor Detail

### TrafficShapingFilter

    public TrafficShapingFilter(int maxReadThroughput,
                                int maxWriteThroughput)

### TrafficShapingFilter

    public TrafficShapingFilter(ScheduledExecutorService scheduledExecutor,
                                int maxReadThroughput,
                                int maxWriteThroughput)

### TrafficShapingFilter

    public TrafficShapingFilter(ScheduledExecutorService scheduledExecutor,
                                MessageSizeEstimator messageSizeEstimator,
                                int maxReadThroughput,
                                int maxWriteThroughput)

Method Detail

### getScheduledExecutor

    public ScheduledExecutorService getScheduledExecutor()

### getMessageSizeEstimator

    public MessageSizeEstimator getMessageSizeEstimator()

### getMaxReadThroughput

    public int getMaxReadThroughput()

### setMaxReadThroughput

    public void setMaxReadThroughput(int maxReadThroughput)

### getMaxWriteThroughput

    public int getMaxWriteThroughput()

### setMaxWriteThroughput

    public void setMaxWriteThroughput(int maxWriteThroughput)

### getPoolSize

    public int getPoolSize()

### setPoolSize

    public void setPoolSize(int poolSize)

### onPreAdd

    public void onPreAdd(IoFilterChain parent,
                         String name,
                         IoFilter.NextFilter nextFilter)
                  throws Exception

  Specified by:
    `onPreAdd` in interface `IoFilter`
  Overrides:
    `onPreAdd` in class `IoFilterAdapter`
  Throws:
    `Exception`

### onPostRemove

    public void onPostRemove(IoFilterChain parent,
                             String name,
                             IoFilter.NextFilter nextFilter)
                      throws Exception

  Specified by:
    `onPostRemove` in interface `IoFilter`
  Overrides:
    `onPostRemove` in class `IoFilterAdapter`
  Throws:
    `Exception`

### messageReceived

    public void messageReceived(IoFilter.NextFilter nextFilter,
                                IoSession session,
                                Object message)
                         throws Exception

  Specified by:
    `messageReceived` in interface `IoFilter`
  Overrides:
    `messageReceived` in class `IoFilterAdapter`
  Throws:
    `Exception`

### messageSent

    public void messageSent(IoFilter.NextFilter nextFilter,
                            IoSession session,
                            WriteRequest writeRequest)
                     throws Exception

  Specified by:
    `messageSent` in interface `IoFilter`
  Overrides:
    `messageSent` in class `IoFilterAdapter`
  Throws:
    `Exception`

Copyright © 2006-2010 The Red5 Project