Class OfflineStatus

  • @ThreadSafe
    public class OfflineStatus
    extends Object
    Keeps state needed for knowing when a site needs to be taken offline.

    Thread safety: This class is updated from multiple threads so the access to it is synchronized by object's intrinsic lock.

    Impl detail: As this class's state changes constantly, the equals and hashCode haven't been overridden. This shouldn't affect performance significantly as the number of site backups should be relatively small (1-3).

    Mircea Markus, Pedro Ruivo
    • Method Detail

      • updateOnCommunicationFailure

        public void updateOnCommunicationFailure​(long sendTimeMillis)
      • isOffline

        public boolean isOffline()
      • minTimeHasElapsed

        public boolean minTimeHasElapsed()
      • millisSinceFirstFailure

        public long millisSinceFirstFailure()
      • bringOnline

        public boolean bringOnline()
      • getFailureCount

        public int getFailureCount()
      • isEnabled

        public boolean isEnabled()
      • amend

        public void amend​(TakeOfflineConfiguration takeOffline)
        Configures the site to use the supplied configuration for determining when to take a site offline. Also triggers a state reset.
      • reset

        public void reset()
      • forceOffline

        public boolean forceOffline()
      • amend

        public void amend​(Integer afterFailures,
                          Long minTimeToWait)