Package org.jgroups.protocols
Class RATE_LIMITER2
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.RATE_LIMITER2
-
-
Field Summary
Fields Modifier and Type Field Description protected AverageMinMaxavg_block_timeprotected longbytes_leftprotected java.util.concurrent.locks.Conditioncondprotected booleandrop_dont_block_msgsprotected java.util.concurrent.Future<?>fprotected longintervalprotected java.util.concurrent.locks.Locklockprotected intmax_bytesprotected java.util.concurrent.atomic.LongAddernum_blockingsprotected java.util.concurrent.atomic.LongAddernum_dropped_msgsprotected intnum_replenishmentsprotected booleanrunningprotected java.lang.Runnabletaskprotected TimeSchedulertimer-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description RATE_LIMITER2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeInterval(long new_interval)java.lang.Objectdown(Message msg)A message is sent down the stack.booleandropDontBlockMessages()RATE_LIMITER2dropDontBlockMessages(boolean p)voidinit()Called after a protocol has been created and before the protocol is started.longinterval()RATE_LIMITER2interval(long i)intmaxBytes()RATE_LIMITER2maxBytes(int m)voidreplenish()voidresetStats()voidstart()This method is called on aJChannel.connect(String); starts work.voidstop()Called on aJChannel.disconnect(); stops work (e.g.-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString, up, up, up
-
-
-
-
Field Detail
-
max_bytes
protected int max_bytes
-
interval
protected long interval
-
drop_dont_block_msgs
protected boolean drop_dont_block_msgs
-
bytes_left
protected long bytes_left
-
num_replenishments
protected int num_replenishments
-
num_dropped_msgs
protected final java.util.concurrent.atomic.LongAdder num_dropped_msgs
-
num_blockings
protected final java.util.concurrent.atomic.LongAdder num_blockings
-
avg_block_time
protected final AverageMinMax avg_block_time
-
lock
protected java.util.concurrent.locks.Lock lock
-
cond
protected java.util.concurrent.locks.Condition cond
-
running
protected boolean running
-
timer
protected TimeScheduler timer
-
f
protected java.util.concurrent.Future<?> f
-
task
protected final java.lang.Runnable task
-
-
Method Detail
-
maxBytes
public int maxBytes()
-
maxBytes
public RATE_LIMITER2 maxBytes(int m)
-
interval
public long interval()
-
interval
public RATE_LIMITER2 interval(long i)
-
dropDontBlockMessages
public boolean dropDontBlockMessages()
-
dropDontBlockMessages
public RATE_LIMITER2 dropDontBlockMessages(boolean p)
-
init
public void init() throws java.lang.ExceptionDescription copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
-
start
public void start() throws java.lang.ExceptionDescription copied from class:ProtocolThis method is called on aJChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top.- Specified by:
startin interfaceLifecycle- Overrides:
startin classProtocol- Throws:
java.lang.Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soJChannel.connect(String)will throw an exception
-
stop
public void stop()
Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom.
-
resetStats
public void resetStats()
- Overrides:
resetStatsin classProtocol
-
replenish
public void replenish()
-
changeInterval
public void changeInterval(long new_interval)
-
-