public class ColoredUIUpdater
extends java.lang.Thread
implements de.hawhamburg.reachability.StopableObject
Modifier and Type | Field and Description |
---|---|
private de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber |
infoTopic
An
LPSubscriber , which listens on the reachability status topic (REACHABILITY_AGENT_RESULT_TOPIC). |
private java.util.Map<de.hawhamburg.reachability.enumeration.ReachabilityGroup,de.hawhamburg.reachability.enumeration.ReachabilityStatus> |
internalStatus
An hash map holding the last known states of reachability for each
ReachabilityGroup item. |
private boolean |
shutDown
Determines if the method
shutDown() has been called. |
private ColoredUI |
ui
The
ColoredUI object, which shall be updated. |
Constructor and Description |
---|
ColoredUIUpdater(ColoredUI sourceUI)
Generates a new
ColoredUIUpdater thread to keep the ColoredUI ui up to date. |
Modifier and Type | Method and Description |
---|---|
void |
end()
Disconnects the
infoTopic , if it isn't null . |
void |
init()
Opens a connection the the reachability information topic (REACHABILITY_AGENT_RESULT_TOPIC) and
initializes the intern state hash map
internalStatus with ReachabilityStatus.NOT_CALCULATED . |
boolean |
isActive() |
void |
run()
Connects to the reachability information topic using
init() and frequently tries to get the newest
reachability states from this topic. |
void |
shutDown() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private boolean shutDown
shutDown()
has been called.private de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber infoTopic
LPSubscriber
, which listens on the reachability status topic (REACHABILITY_AGENT_RESULT_TOPIC).private java.util.Map<de.hawhamburg.reachability.enumeration.ReachabilityGroup,de.hawhamburg.reachability.enumeration.ReachabilityStatus> internalStatus
ReachabilityGroup
item.public ColoredUIUpdater(ColoredUI sourceUI)
ColoredUIUpdater
thread to keep the ColoredUI
ui up to date.sourceUI
- A ColoredUI
, which shall be updated.public final void shutDown()
shutDown
in interface de.hawhamburg.reachability.StopableObject
StopableObject.shutDown()
public final boolean isActive()
isActive
in interface de.hawhamburg.reachability.StopableObject
true
if shutDown()
wasn't called, otherwise false
.StopableObject.isActive()
public final void run()
init()
and frequently tries to get the newest
reachability states from this topic. If a new state arrives, the ColoredUI
ui
will be updated
using ColoredUI.refresh(Map)
.run
in interface java.lang.Runnable
run
in class java.lang.Thread
public final void init()
internalStatus
with ReachabilityStatus.NOT_CALCULATED
.public final void end()
infoTopic
, if it isn't null
.