Package org.infinispan.xsite
Class OfflineStatus
java.lang.Object
org.infinispan.xsite.OfflineStatus
- All Implemented Interfaces:
CacheEventFilter<Object,Object>
Keeps the 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 the 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
ConstructorsConstructorDescriptionOfflineStatus(TakeOfflineConfiguration takeOfflineConfiguration, Supplier<org.infinispan.commons.time.TimeService> timeService, SiteStatusListener listener, ScopedState key, Cache<ScopedState, Long> globalState) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(Object key, Object oldValue, Metadata oldMetadata, Object newValue, Metadata newMetadata, EventType eventType) Whether or not this event should be raised to the listener it is attached to.voidbooleanbooleanintbooleanbooleanlongbooleanvoidvoidreset()voidstart()voidstop()toString()voidupdateOnCommunicationFailure(long sendTimeMillis) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.notifications.cachelistener.filter.CacheEventFilter
format
-
Constructor Details
-
OfflineStatus
public OfflineStatus(TakeOfflineConfiguration takeOfflineConfiguration, Supplier<org.infinispan.commons.time.TimeService> timeService, SiteStatusListener listener, ScopedState key, Cache<ScopedState, Long> globalState)
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
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() -
reset
public void reset() -
getTakeOffline
-
forceOffline
public boolean forceOffline() -
toString
-
amend
-
accept
public boolean accept(Object key, Object oldValue, Metadata oldMetadata, Object newValue, Metadata newMetadata, EventType eventType) Description copied from interface:CacheEventFilterWhether or not this event should be raised to the listener it is attached to.- Specified by:
acceptin interfaceCacheEventFilter<Object,Object> - Parameters:
key- The key for the entry that was changed for the eventoldValue- The previous value before the event takes placeoldMetadata- The old value before the event takes placenewValue- The new value for the entry after the event takes placenewMetadata- The new metadata for the entry after the event takes placeeventType- The type of event that is being raised- Returns:
- Whether or not to notify the listener
-
onStatusChanged
-