public class RATE_LIMITER extends Protocol
Modifier and Type | Field and Description |
---|---|
protected long |
current_period_start |
protected int |
frag_size |
protected java.util.concurrent.locks.Lock |
lock |
protected long |
max_bytes |
protected int |
num_blockings |
protected long |
num_bytes_sent_in_period
Keeps track of the number of bytes sent in the current time period
|
protected boolean |
running |
protected long |
time_period |
protected long |
time_period_ns |
protected long |
total_block_time |
after_creation_hook, down_prot, ergonomics, id, log, name, stack, stats, up_prot
Constructor and Description |
---|
RATE_LIMITER() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
double |
getAverageBlockTime() |
long |
getMaxBytes() |
long |
getTimePeriod() |
long |
getTotalBlockTime() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
void |
resetStats() |
void |
setMaxBytes(long max_bytes) |
void |
setTimePeriod(long time_period) |
void |
start()
This method is called on a
Channel.connect(String) . |
void |
stop()
This method is called on a
Channel.disconnect() . |
accept, afterCreationHook, destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, up, up
protected long max_bytes
protected long time_period
protected long time_period_ns
protected long num_bytes_sent_in_period
protected long current_period_start
protected final java.util.concurrent.locks.Lock lock
protected int num_blockings
protected long total_block_time
protected int frag_size
protected volatile boolean running
public long getMaxBytes()
public void setMaxBytes(long max_bytes)
public long getTimePeriod()
public void setTimePeriod(long time_period)
public long getTotalBlockTime()
public double getAverageBlockTime()
public void resetStats()
resetStats
in class Protocol
public void init() throws java.lang.Exception
Protocol
public void start() throws java.lang.Exception
Protocol
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.start
in class Protocol
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedpublic java.lang.Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.Copyright © 1998-2020 Red Hat. All Rights Reserved.