public class DefaultTakeOfflineManager extends Object implements TakeOfflineManager, XSiteResponse.XSiteResponseCompleted
TakeOfflineManager.
It automatically takes a site offline when certain failures condition happens.
| Constructor and Description |
|---|
DefaultTakeOfflineManager(String cacheName) |
| Modifier and Type | Method and Description |
|---|---|
void |
amendConfiguration(String siteName,
Integer afterFailures,
Long minTimeToWait)
It changes the
TakeOfflineConfiguration for site siteName. |
BringSiteOnlineResponse |
bringSiteOnline(String siteName)
It changes the site
siteName to online. |
TakeOfflineConfiguration |
getConfiguration(String siteName)
It returns the current
TakeOfflineConfiguration for site siteName. |
OfflineStatus |
getOfflineStatus(String siteName) |
SiteState |
getSiteState(String siteName)
Returns the site state for site
siteName. |
static boolean |
isCommunicationError(Throwable throwable) |
void |
onCompleted(XSiteBackup backup,
long sendTimeNanos,
long durationNanos,
Throwable throwable) |
void |
registerRequest(XSiteResponse response)
Registers a cross-site request made.
|
void |
start() |
Map<String,Boolean> |
status()
It returns a
Map with the sites name and their state (Online or Offline). |
TakeSiteOfflineResponse |
takeSiteOffline(String siteName)
It changes the site
siteName to offline. |
String |
toString() |
public DefaultTakeOfflineManager(String cacheName)
public static boolean isCommunicationError(Throwable throwable)
public void start()
public void registerRequest(XSiteResponse response)
TakeOfflineManagerHandles the response for the request and takes action in case of failure.
registerRequest in interface TakeOfflineManagerresponse - The cross-site response.public SiteState getSiteState(String siteName)
TakeOfflineManagersiteName.
The site can be SiteState.ONLINE or SiteState.OFFLINE. If it doesn't exist, SiteState.NOT_FOUND is returned.
getSiteState in interface TakeOfflineManagersiteName - The remote site name.SiteState.public void amendConfiguration(String siteName, Integer afterFailures, Long minTimeToWait)
TakeOfflineManagerTakeOfflineConfiguration for site siteName.
If the siteName doesn't exist, this method is a no-op.
amendConfiguration in interface TakeOfflineManagersiteName - The remote site name.afterFailures - The new TakeOfflineConfigurationBuilder.afterFailures(int) or null for no
changes.minTimeToWait - The new TakeOfflineConfigurationBuilder.minTimeToWait(long) or null for no
changes.public TakeOfflineConfiguration getConfiguration(String siteName)
TakeOfflineManagerTakeOfflineConfiguration for site siteName.getConfiguration in interface TakeOfflineManagersiteName - The remote site name.TakeOfflineConfiguration or null if the site siteName doesn't exist.public Map<String,Boolean> status()
TakeOfflineManagerMap with the sites name and their state (Online or Offline).
If a site is online, then its value is Boolean.TRUE, otherwise is Boolean.FALSE.
status in interface TakeOfflineManagerMap with the site state.public BringSiteOnlineResponse bringSiteOnline(String siteName)
TakeOfflineManagersiteName 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.
bringSiteOnline in interface TakeOfflineManagersiteName - The remote site name.BringSiteOnlineResponse.public TakeSiteOfflineResponse takeSiteOffline(String siteName)
TakeOfflineManagersiteName 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.
takeSiteOffline in interface TakeOfflineManagersiteName - The remote site name.TakeSiteOfflineResponse.public void onCompleted(XSiteBackup backup, long sendTimeNanos, long durationNanos, Throwable throwable)
onCompleted in interface XSiteResponse.XSiteResponseCompletedpublic OfflineStatus getOfflineStatus(String siteName)
Copyright © 2022 JBoss by Red Hat. All rights reserved.