java.lang.Objectcom.realtime.crossfire.jxclient.metaserver.MetaserverProcessor
public class MetaserverProcessor
Asynchronously queries the metaserver and updates a MetaserverModel
instance. Queries are performed regularly every UPDATE_INTERVAL but
not faster than MIN_UPDATE_INTERVAL. Queries can be stopped stopped
when the server selection GUI is left (disable(); a call to query() automatically re-starts queries.
| Field Summary | |
|---|---|
private int |
counter
Counter used by the query runnable. |
private Metaserver |
metaserver
The Metaserver instance to forward to. |
private static int |
MIN_UPDATE_INTERVAL
The minimal update-interval in seconds. |
private long |
nextQuery
The timestamp at which a query is allowed. |
private java.lang.Runnable |
runnable
The query Thread. |
private boolean |
running
Whether the query runnable has been started. |
private java.lang.Object |
sync
The object used for synchronization. |
private static int |
UPDATE_INTERVAL
The regular update-interval in seconds. |
| Constructor Summary | |
|---|---|
MetaserverProcessor(Metaserver metaserver)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
disable()
Disables periodic re-queries. |
void |
query()
Immediately triggers a metaserver query and enables periodic re-queries. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int counter
runnable. If positive, the value will
be decremented once per second; when it reaches zero, it is reset back to
UPDATE_INTERVAL and a metaserver query is executed.
When set to zero, updating is disabled.
@NotNull private final Metaserver metaserver
Metaserver instance to forward to.
private static final int MIN_UPDATE_INTERVAL
private long nextQuery
MIN_UPDATE_INTERVAL).
@NotNull private final java.lang.Runnable runnable
Thread.
private boolean running
runnable has been started.
@NotNull private final java.lang.Object sync
private static final int UPDATE_INTERVAL
| Constructor Detail |
|---|
public MetaserverProcessor(@NotNull
Metaserver metaserver)
metaserver - the metaserver instance to forward to| Method Detail |
|---|
public void disable()
query().
public void query()