Package org.jgroups.protocols
Class RATE_LIMITER
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.RATE_LIMITER
Protocol which sends at most max_bytes in time_period milliseconds. Can be used instead of a flow control protocol,
e.g. FC or SFC (same position in the stack)
- Author:
- Bela Ban
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.jgroups.stack.Protocol
destroy, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, up, upThreadEnabled
-
Field Details
-
max_bytes
protected long max_bytes -
time_period
protected long time_period -
num_bytes_sent
protected long num_bytes_sentKeeps track of the number of bytes sent in the current time period -
end_of_current_period
protected long end_of_current_period -
lock
-
block
-
num_blockings
protected int num_blockings -
total_block_time
protected long total_block_time
-
-
Constructor Details
-
RATE_LIMITER
public RATE_LIMITER()
-
-
Method Details
-
down
Description copied from class:ProtocolAn event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_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 usingup_prot.up(). -
init
Description copied from class:ProtocolCalled after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent. -
stop
public void stop()Description copied from class:ProtocolThis method is called on aChannel.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 flushed -
reset
protected void reset()
-