Package org.infinispan.xsite
Class OfflineStatus
- java.lang.Object
-
- org.infinispan.xsite.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).- Since:
- 5.2
- Author:
- Mircea Markus, Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description OfflineStatus(TakeOfflineConfiguration takeOfflineConfiguration, TimeService timeService, SiteStatusListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
amend(Integer afterFailures, Long minTimeToWait)
void
amend(TakeOfflineConfiguration takeOffline)
Configures the site to use the supplied configuration for determining when to take a site offline.boolean
bringOnline()
boolean
forceOffline()
int
getFailureCount()
TakeOfflineConfiguration
getTakeOffline()
boolean
isEnabled()
boolean
isOffline()
long
millisSinceFirstFailure()
boolean
minTimeHasElapsed()
void
reset()
String
toString()
void
updateOnCommunicationFailure(long sendTimeMillis)
-
-
-
Constructor Detail
-
OfflineStatus
public OfflineStatus(TakeOfflineConfiguration takeOfflineConfiguration, TimeService timeService, SiteStatusListener listener)
-
-
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()
-
getTakeOffline
public TakeOfflineConfiguration getTakeOffline()
-
forceOffline
public boolean forceOffline()
-
-