org.hd.d.pg2k.svrCore
Class GenUtils.RemoteFlagInfo

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.GenUtils.RemoteFlagInfo
Enclosing class:
GenUtils

private static final class GenUtils.RemoteFlagInfo
extends java.lang.Object

Immutable information about each remote URI flag.


Field Summary
(package private)  long checkStarted
          Time we started (re)checking the status of this flag, or zero if no check is underway.
(package private)  java.lang.Boolean flagIsPresent
          Status of the remote flag; null if not known.
(package private)  java.net.URI flagURI
          Flag URI; not null.
(package private)  long lastPollCompleted
          Time of the last completed poll, or zero if none.
(package private)  long lastStateChange
          Time of last state change, or zero if none.
 
Constructor Summary
(package private) GenUtils.RemoteFlagInfo(java.net.URI flagURI)
          Construct an (initial) instance with unknown status and no check underway.
private GenUtils.RemoteFlagInfo(java.net.URI flagURI, java.lang.Boolean flagIsPresent, long lastPollCompleted, long checkStarted, long lastStateChange)
          Create a new instance from scratch.
 
Method Summary
 GenUtils.RemoteFlagInfo checkComplete(java.lang.Boolean remoteFlagIsNowPresent)
          Mark remote flag check complete with the given status.
 boolean checkIsNeeded()
          Returns true if a new check should be started.
 boolean checkIsRunning()
          Returns true iff a check is currently being run.
 boolean isStale()
          Returns true if the last check was so long ago that any data held is probably stale.
(package private)  GenUtils.RemoteFlagInfo startCheckNow()
          Note the start of a status check (called just before starting a check).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flagURI

final java.net.URI flagURI
Flag URI; not null.


flagIsPresent

final java.lang.Boolean flagIsPresent
Status of the remote flag; null if not known. TRUE indicates that the remote flag is definitely present and thus we should be in low-power mode.

FALSE indicates that the remote flag is definitely absent and thus we need not be in low-power mode (if no other flags are present).

A null value indicates that the remote value is unknown.


lastPollCompleted

final long lastPollCompleted
Time of the last completed poll, or zero if none.


checkStarted

final long checkStarted
Time we started (re)checking the status of this flag, or zero if no check is underway.


lastStateChange

final long lastStateChange
Time of last state change, or zero if none.

Constructor Detail

GenUtils.RemoteFlagInfo

private GenUtils.RemoteFlagInfo(java.net.URI flagURI,
                                java.lang.Boolean flagIsPresent,
                                long lastPollCompleted,
                                long checkStarted,
                                long lastStateChange)
Create a new instance from scratch. Private so that only instance methods can call it to provide modified versions of existing instances for example.


GenUtils.RemoteFlagInfo

GenUtils.RemoteFlagInfo(java.net.URI flagURI)
Construct an (initial) instance with unknown status and no check underway.

Method Detail

checkIsRunning

public boolean checkIsRunning()
Returns true iff a check is currently being run. We consider a check to be running if started at all(non-zero) and if started recently enough.


checkIsNeeded

public boolean checkIsNeeded()
Returns true if a new check should be started. This is taken never to be true if a check is running, nor if the last poll very recently completed.


isStale

public boolean isStale()
Returns true if the last check was so long ago that any data held is probably stale.


startCheckNow

GenUtils.RemoteFlagInfo startCheckNow()
Note the start of a status check (called just before starting a check). Returns new instance with all values unchanged except 'checkStarted' which is set to 'now'.


checkComplete

public GenUtils.RemoteFlagInfo checkComplete(java.lang.Boolean remoteFlagIsNowPresent)
Mark remote flag check complete with the given status. Marks the time of the poll completion, and clears the 'being checked' flag.

If the status has changed, this is noted.


DHD Multimedia Gallery V1.57.21

Copyright (c) 1996-2011, Damon Hart-Davis. All rights reserved.