More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.sandStorm.core
Class RateLimitingPredicate

java.lang.Object
  |
  +--seda.sandStorm.core.RateLimitingPredicate
All Implemented Interfaces:
EnqueuePredicateIF

public class RateLimitingPredicate
extends java.lang.Object
implements EnqueuePredicateIF

This enqueue predicate implements input rate policing.


Constructor Summary
RateLimitingPredicate(SinkIF sink, double targetRate, int depth)
          Create a new RateLimitingPredicate for the given sink, targetRate, and token bucket depth.
 
Method Summary
 boolean accept(QueueElementIF qel)
          Returns true if the given element can be accepted into the queue.
 int getBucketSize()
          Return the number of tokens currently in the bucket.
 int getDepth()
          Return the current depth.
 double getTargetRate()
          Return the current rate limit.
 void setDepth(int depth)
          Set the bucket depth.
 void setTargetRate(double targetRate)
          Set the rate limit.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RateLimitingPredicate

public RateLimitingPredicate(SinkIF sink,
                             double targetRate,
                             int depth)
Create a new RateLimitingPredicate for the given sink, targetRate, and token bucket depth. A rate of -1.0 indicates no rate limit.
Method Detail

accept

public boolean accept(QueueElementIF qel)
Returns true if the given element can be accepted into the queue.
Specified by:
accept in interface EnqueuePredicateIF
Following copied from interface: seda.sandStorm.api.EnqueuePredicateIF
Parameters:
element - The QueueElementIF to enqueue
Returns:
True if the sink accepts the element; false otherwise.

getTargetRate

public double getTargetRate()
Return the current rate limit.

getDepth

public int getDepth()
Return the current depth.

getBucketSize

public int getBucketSize()
Return the number of tokens currently in the bucket.

setTargetRate

public void setTargetRate(double targetRate)
Set the rate limit. A limit of -1.0 indicates no rate limit.

setDepth

public void setDepth(int depth)
Set the bucket depth.

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/