Class SenderState
- java.lang.Object
-
- org.apache.catalina.tribes.transport.SenderState
-
public class SenderState extends java.lang.ObjectTracks the delivery state of a sender associated with a cluster member.
-
-
Field Summary
Fields Modifier and Type Field Description static intFAILINGSender has failed and is unable to transmit messages.protected static java.util.concurrent.ConcurrentMap<Member,SenderState>memberStatesRegistry of sender states for each cluster member.static intREADYSender is ready to transmit messages.static intSUSPECTSender has been suspected of failure but not yet confirmed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SenderStategetSenderState(Member member)Returns theSenderStatefor the given member, creating one if it does not exist.static SenderStategetSenderState(Member member, boolean create)Returns theSenderStatefor the given member.booleanisFailing()Returnstrueif the sender has failed.booleanisReady()Returnstrueif the sender is ready to transmit messages.booleanisSuspect()Returnstrueif the sender is in a suspect or failing state.static voidremoveSenderState(Member member)Removes theSenderStatefor the given member from the registry.voidsetFailing()Sets the sender state to failing.voidsetReady()Sets the sender state to ready.voidsetSuspect()Sets the sender state to suspect.
-
-
-
Field Detail
-
READY
public static final int READY
Sender is ready to transmit messages.- See Also:
- Constant Field Values
-
SUSPECT
public static final int SUSPECT
Sender has been suspected of failure but not yet confirmed.- See Also:
- Constant Field Values
-
FAILING
public static final int FAILING
Sender has failed and is unable to transmit messages.- See Also:
- Constant Field Values
-
memberStates
protected static final java.util.concurrent.ConcurrentMap<Member,SenderState> memberStates
Registry of sender states for each cluster member.
-
-
Method Detail
-
getSenderState
public static SenderState getSenderState(Member member)
Returns theSenderStatefor the given member, creating one if it does not exist.- Parameters:
member- the cluster member- Returns:
- the sender state for the member
-
getSenderState
public static SenderState getSenderState(Member member, boolean create)
Returns theSenderStatefor the given member.- Parameters:
member- the cluster membercreate- iftrue, creates a new state when none exists- Returns:
- the sender state, or
nullif not found and create isfalse
-
removeSenderState
public static void removeSenderState(Member member)
Removes theSenderStatefor the given member from the registry.- Parameters:
member- the cluster member whose state should be removed
-
isSuspect
public boolean isSuspect()
Returnstrueif the sender is in a suspect or failing state.- Returns:
trueif the sender is not ready
-
setSuspect
public void setSuspect()
Sets the sender state to suspect.
-
isReady
public boolean isReady()
Returnstrueif the sender is ready to transmit messages.- Returns:
trueif the sender is in the ready state
-
setReady
public void setReady()
Sets the sender state to ready.
-
isFailing
public boolean isFailing()
Returnstrueif the sender has failed.- Returns:
trueif the sender is in the failing state
-
setFailing
public void setFailing()
Sets the sender state to failing.
-
-