Trustin Lee wrote:
Hi folks,
I've just added a very interesting feature, which overlaps with
org.apache.mina.filter.traffic. The difference if that it attaches to
the new ThreadPoolExecutors - OrderedThreadPoolExecutor and
UnorderedThreadPoolExecutor. You can specify an IoEventQueueHandler
in the constructor. IoEventQueueHandler provides some hook methods
for vetoing the event from getting into the queue and monitoring flow
of events. IoEventQueueThrottle is the first implementation of
IoEventQueueHandler. It is much simpler than
org.apache.mina.filter.traffic classes because it interacts
ThreadPoolExecutors directly. Please take a look into the source
code:
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/executor/IoEventQueueThrottle.java?view=markup
As you can see from the source code, it doesn't use IoSession traffic
mask operation; it just blocks on Executor.execute() and unblocks on
notification. Trade-off of this simplicity is that there's no various
scope type in threshold value, in contrast to ReadThrottleFilter. It
will be more efficient and won't burden call stack depth at all
instead, while fulfilling most people's demand.
Looking at this again... for some reason IoEventQueueThrottle does not seem to
help in the case of writes, I can easily crash the server with OOM errors by
writing to fast.
--
Luis Neves