com.realtime.crossfire.jxclient.stats
Class PoisonWatcher

java.lang.Object
  extended by com.realtime.crossfire.jxclient.stats.PoisonWatcher

public class PoisonWatcher
extends java.lang.Object

Helper class to synthesize an "is poisoned" stat value. The Crossfire server currently does not send this information, therefore drawinfo messages are tracked.


Field Summary
private  boolean active
          Whether poisoning is active.
private static java.lang.String ASSERT_MESSAGE
          The text message the server sends in poisoned state.
private static java.lang.String DE_ASSERT_MESSAGE
          The text message the server sends when the poison wears off.
private  CrossfireDrawextinfoListener drawextinfoListener
          The drawextinfo listener to receive drawextinfo messages.
private  CrossfireDrawinfoListener drawinfoListener
          The drawinfo listener to receive drawinfo messages.
private  Stats stats
          The stats instance to notify.
private  java.lang.Object sync
          The object used for synchronization.
private static int TIMEOUT_DE_ASSERT
          Timeout after that the "poisoned" state is reset.
private  TimeoutEvent timeoutEvent
          The timeout event used to turn off poisoning if the de-assert message was missed.
 
Constructor Summary
PoisonWatcher(Stats stats, CrossfireServerConnection crossfireServerConnection)
          Create a new instance.
 
Method Summary
private  void check(java.lang.String message)
          Examine a text message.
private  void setActive(boolean active)
          Set the current poisoned state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

private boolean active
Whether poisoning is active.


ASSERT_MESSAGE

@NotNull
private static final java.lang.String ASSERT_MESSAGE
The text message the server sends in poisoned state.

See Also:
Constant Field Values

DE_ASSERT_MESSAGE

@NotNull
private static final java.lang.String DE_ASSERT_MESSAGE
The text message the server sends when the poison wears off.

See Also:
Constant Field Values

drawextinfoListener

@NotNull
private final CrossfireDrawextinfoListener drawextinfoListener
The drawextinfo listener to receive drawextinfo messages.


drawinfoListener

@NotNull
private final CrossfireDrawinfoListener drawinfoListener
The drawinfo listener to receive drawinfo messages.


stats

@NotNull
private final Stats stats
The stats instance to notify.


sync

@NotNull
private final java.lang.Object sync
The object used for synchronization.


TIMEOUT_DE_ASSERT

private static final int TIMEOUT_DE_ASSERT
Timeout after that the "poisoned" state is reset. This allow to prevent a stuck poison warning if the de-assertion was missed for any reason.

See Also:
Constant Field Values

timeoutEvent

@NotNull
private final TimeoutEvent timeoutEvent
The timeout event used to turn off poisoning if the de-assert message was missed.

Constructor Detail

PoisonWatcher

public PoisonWatcher(@NotNull
                     Stats stats,
                     @NotNull
                     CrossfireServerConnection crossfireServerConnection)
Create a new instance.

Parameters:
stats - The stats instance to notify.
crossfireServerConnection - The connection to watch.
Method Detail

check

private void check(@NotNull
                   java.lang.String message)
Examine a text message.

Parameters:
message - The text message.

setActive

private void setActive(boolean active)
Set the current poisoned state.

Parameters:
active - The new poisoned state.