Package org.infinispan.xsite.status
Class DefaultTakeOfflineManager
java.lang.Object
org.infinispan.xsite.status.DefaultTakeOfflineManager
- All Implemented Interfaces:
org.infinispan.metrics.impl.CustomMetricsSupplier
,XSiteResponse.XSiteResponseCompleted
,TakeOfflineManager
public class DefaultTakeOfflineManager
extends Object
implements TakeOfflineManager, XSiteResponse.XSiteResponseCompleted
The default implementation of
TakeOfflineManager
.
It automatically takes a site offline when certain failures condition happens.
- Since:
- 11.0
- Author:
- Pedro Ruivo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
amendConfiguration
(String siteName, Integer afterFailures, Long minTimeToWait) It changes theTakeOfflineConfiguration
for sitesiteName
.bringSiteOnline
(String siteName) It changes the sitesiteName
to online.getConfiguration
(String siteName) It returns the currentTakeOfflineConfiguration
for sitesiteName
.getCustomMetrics
(GlobalMetricsConfiguration configuration) org.infinispan.xsite.OfflineStatus
getOfflineStatus
(String siteName) getSiteState
(String siteName) Returns the site state for sitesiteName
.static boolean
isCommunicationError
(Throwable throwable) void
onCompleted
(org.infinispan.xsite.XSiteBackup backup, long sendTimeNanos, long durationNanos, Throwable throwable) void
registerRequest
(XSiteResponse<?> response) Registers a cross-site request made.void
start()
status()
It returns aMap
with the sites name and their state (Online or Offline).takeSiteOffline
(String siteName) It changes the sitesiteName
to offline.toString()
-
Constructor Details
-
DefaultTakeOfflineManager
-
-
Method Details
-
isCommunicationError
-
start
public void start() -
registerRequest
Description copied from interface:TakeOfflineManager
Registers a cross-site request made.Handles the response for the request and takes action in case of failure.
- Specified by:
registerRequest
in interfaceTakeOfflineManager
- Parameters:
response
- The cross-site response.
-
getSiteState
Description copied from interface:TakeOfflineManager
Returns the site state for sitesiteName
.The site can be
SiteState.ONLINE
orSiteState.OFFLINE
. If it doesn't exist,SiteState.NOT_FOUND
is returned.- Specified by:
getSiteState
in interfaceTakeOfflineManager
- Parameters:
siteName
- The remote site name.- Returns:
- The
SiteState
.
-
amendConfiguration
Description copied from interface:TakeOfflineManager
It changes theTakeOfflineConfiguration
for sitesiteName
.If the
siteName
doesn't exist, this method is a no-op.- Specified by:
amendConfiguration
in interfaceTakeOfflineManager
- Parameters:
siteName
- The remote site name.afterFailures
- The newTakeOfflineConfigurationBuilder.afterFailures(int)
ornull
for no changes.minTimeToWait
- The newTakeOfflineConfigurationBuilder.minTimeToWait(long)
ornull
for no changes.
-
getConfiguration
Description copied from interface:TakeOfflineManager
It returns the currentTakeOfflineConfiguration
for sitesiteName
.- Specified by:
getConfiguration
in interfaceTakeOfflineManager
- Parameters:
siteName
- The remote site name.- Returns:
- The current
TakeOfflineConfiguration
ornull
if the sitesiteName
doesn't exist.
-
status
Description copied from interface:TakeOfflineManager
It returns aMap
with the sites name and their state (Online or Offline).If a site is online, then its value is
Boolean.TRUE
, otherwise isBoolean.FALSE
.- Specified by:
status
in interfaceTakeOfflineManager
- Returns:
- A
Map
with the site state.
-
bringSiteOnline
Description copied from interface:TakeOfflineManager
It changes the sitesiteName
to online.If the site is already online, then
BringSiteOnlineResponse.ALREADY_ONLINE
is returned. If it doesn't exits,BringSiteOnlineResponse.NO_SUCH_SITE
is returned.- Specified by:
bringSiteOnline
in interfaceTakeOfflineManager
- Parameters:
siteName
- The remote site name.- Returns:
- The
BringSiteOnlineResponse
.
-
takeSiteOffline
Description copied from interface:TakeOfflineManager
It changes the sitesiteName
to offline.If the site is already offline, then
TakeSiteOfflineResponse.ALREADY_OFFLINE
is returned. If it doesn't exits,TakeSiteOfflineResponse.NO_SUCH_SITE
is returned.- Specified by:
takeSiteOffline
in interfaceTakeOfflineManager
- Parameters:
siteName
- The remote site name.- Returns:
- The
TakeSiteOfflineResponse
.
-
getCustomMetrics
- Specified by:
getCustomMetrics
in interfaceTakeOfflineManager
-
onCompleted
public void onCompleted(org.infinispan.xsite.XSiteBackup backup, long sendTimeNanos, long durationNanos, Throwable throwable) - Specified by:
onCompleted
in interfaceXSiteResponse.XSiteResponseCompleted
-
getOfflineStatus
-
toString
-