Class DiskUsageBroadcaster
- java.lang.Object
-
- org.apache.cassandra.service.disk.usage.DiskUsageBroadcaster
-
- All Implemented Interfaces:
IEndpointStateChangeSubscriber
public class DiskUsageBroadcaster extends java.lang.Object implements IEndpointStateChangeSubscriber
StartsDiskUsageMonitor
to monitor local disk usage state and broadcast new state via Gossip. At the same time, it caches cluster's disk usage state received via Gossip.
-
-
Field Summary
Fields Modifier and Type Field Description static DiskUsageBroadcaster
instance
-
Constructor Summary
Constructors Constructor Description DiskUsageBroadcaster(DiskUsageMonitor monitor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeChange(InetAddressAndPort endpoint, EndpointState currentState, ApplicationState newStateKey, VersionedValue newValue)
boolean
hasStuffedOrFullNode()
boolean
isFull(InetAddressAndPort endpoint)
boolean
isStuffed(InetAddressAndPort endpoint)
void
onAlive(InetAddressAndPort endpoint, EndpointState state)
void
onChange(InetAddressAndPort endpoint, ApplicationState state, VersionedValue value)
void
onDead(InetAddressAndPort endpoint, EndpointState state)
void
onJoin(InetAddressAndPort endpoint, EndpointState epState)
Use to inform interested parties about the change in the state for specified endpointvoid
onRemove(InetAddressAndPort endpoint)
void
onRestart(InetAddressAndPort endpoint, EndpointState state)
Called whenever a node is restarted.void
startBroadcasting()
DiskUsageState
state(InetAddressAndPort endpoint)
-
-
-
Field Detail
-
instance
public static final DiskUsageBroadcaster instance
-
-
Constructor Detail
-
DiskUsageBroadcaster
public DiskUsageBroadcaster(DiskUsageMonitor monitor)
-
-
Method Detail
-
hasStuffedOrFullNode
public boolean hasStuffedOrFullNode()
- Returns:
true
if any node in the cluster is STUFFED OR FULL
-
isFull
public boolean isFull(InetAddressAndPort endpoint)
- Returns:
true
if given node's disk usage is FULL
-
isStuffed
public boolean isStuffed(InetAddressAndPort endpoint)
- Returns:
true
if given node's disk usage is STUFFED
-
state
public DiskUsageState state(InetAddressAndPort endpoint)
-
startBroadcasting
public void startBroadcasting()
-
onChange
public void onChange(InetAddressAndPort endpoint, ApplicationState state, VersionedValue value)
- Specified by:
onChange
in interfaceIEndpointStateChangeSubscriber
-
onJoin
public void onJoin(InetAddressAndPort endpoint, EndpointState epState)
Description copied from interface:IEndpointStateChangeSubscriber
Use to inform interested parties about the change in the state for specified endpoint- Specified by:
onJoin
in interfaceIEndpointStateChangeSubscriber
- Parameters:
endpoint
- endpoint for which the state change occurred.epState
- state that actually changed for the above endpoint.
-
beforeChange
public void beforeChange(InetAddressAndPort endpoint, EndpointState currentState, ApplicationState newStateKey, VersionedValue newValue)
- Specified by:
beforeChange
in interfaceIEndpointStateChangeSubscriber
-
onAlive
public void onAlive(InetAddressAndPort endpoint, EndpointState state)
- Specified by:
onAlive
in interfaceIEndpointStateChangeSubscriber
-
onDead
public void onDead(InetAddressAndPort endpoint, EndpointState state)
- Specified by:
onDead
in interfaceIEndpointStateChangeSubscriber
-
onRestart
public void onRestart(InetAddressAndPort endpoint, EndpointState state)
Description copied from interface:IEndpointStateChangeSubscriber
Called whenever a node is restarted. Note that there is no guarantee when that happens that the node was previously marked down. It will have only ifstate.isAlive() == false
asstate
is from before the restarted node is marked up.- Specified by:
onRestart
in interfaceIEndpointStateChangeSubscriber
-
onRemove
public void onRemove(InetAddressAndPort endpoint)
- Specified by:
onRemove
in interfaceIEndpointStateChangeSubscriber
-
-