Interface XSiteStateTransferManager
- All Known Implementing Classes:
NoOpXSiteStateTransferManager,XSiteStateTransferManagerImpl
public interface XSiteStateTransferManager
It manages the state transfer between sites.
- Since:
- 7.0
- Author:
- Pedro Ruivo
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidbecomeCoordinator(String siteName) Makes this node the coordinator for the state transfer to the site name.voidcancelPushState(String siteName) It cancels a running state transfer.voidcancelReceive(String siteName) Sets the cluster to normal state.voidClears the completed state transfer status in all the cluster.voidClears the completed state transfer status.voidnotifyStatePushFinished(String siteName, Address node, boolean statusOk) It receives the notifications from local site when some node finishes pushing the state to the remote site.voidonTopologyUpdated(CacheTopology cacheTopology, boolean stateTransferInProgress) NotifiesXSiteStateTransferManagerthat a newCacheTopologyis installed and if the local cluster state transfer is in progress (or about to start)booleansetAutomaticStateTransfer(String site, XSiteStateTransferMode mode) Sets theXSiteStateTransferModeto the remote site.voidstartAutomaticStateTransferTo(ByteString remoteSite, boolean ignoreStatus) Starts the automatic cross-site state transfer if available and if required.voidstartPushState(String siteName) It notifies all nodes from local site to start transfer the state to the remote site.stateTransferMode(String site)
-
Field Details
-
STATUS_OK
- See Also:
-
STATUS_ERROR
- See Also:
-
STATUS_SENDING
- See Also:
-
STATUS_CANCELED
- See Also:
-
-
Method Details
-
notifyStatePushFinished
It receives the notifications from local site when some node finishes pushing the state to the remote site.- Parameters:
siteName- the remote site namenode- theAddressfrom the node that finishes.statusOk-trueif no error or exception occurred during the state transfer.
-
startPushState
It notifies all nodes from local site to start transfer the state to the remote site.- Parameters:
siteName- the remote site name- Throws:
Throwable- If some unexpected behavior occurs.
-
cancelPushState
It cancels a running state transfer.- Parameters:
siteName- the site name to where the state is being sent.- Throws:
Throwable- if some exception occurs during the remote invocation with the local cluster or remote site.
-
getRunningStateTransfers
- Returns:
- a list of site names in which this cache is pushing state.
-
getStatus
Map<String,StateTransferStatus> getStatus()- Returns:
- the completed state transfer status for which this node is the coordinator.
-
clearStatus
void clearStatus()Clears the completed state transfer status. -
getClusterStatus
Map<String,StateTransferStatus> getClusterStatus()- Returns:
- the completed state transfer status from all the coordinators in the cluster.
-
clearClusterStatus
void clearClusterStatus()Clears the completed state transfer status in all the cluster. -
getSendingSiteName
String getSendingSiteName()- Returns:
nullif this node is not receiving state or the site name which is sending the state.
-
cancelReceive
Sets the cluster to normal state. The main use for this method is when the link between the sites is broken and the receiver site keeps it state transfer state forever.- Parameters:
siteName- the site name which is sending the state.- Throws:
Exception- if some exception occurs during the remote invocation.
-
becomeCoordinator
Makes this node the coordinator for the state transfer to the site name. This method is invoked when the coordinator dies and this node receives a late start state transfer request.- Parameters:
siteName- the site name.
-
onTopologyUpdated
NotifiesXSiteStateTransferManagerthat a newCacheTopologyis installed and if the local cluster state transfer is in progress (or about to start)- Parameters:
cacheTopology- The newCacheTopology.stateTransferInProgress-trueif the state transfer is in progress or starting.
-
getStateProvider
XSiteStateProvider getStateProvider()- Returns:
- The
XSiteStateProviderinstance.
-
getStateConsumer
XSiteStateConsumer getStateConsumer()- Returns:
- The
XSiteStateConsumerinstance.
-
startAutomaticStateTransferTo
Starts the automatic cross-site state transfer if available and if required.- Parameters:
remoteSite- The remote site to send state to.ignoreStatus- Iftrue, it starts the state transfer based only onXSiteStateTransferMode.
-
stateTransferMode
- Parameters:
site- The remote site.- Returns:
- The
XSiteStateTransferModeconfigured for the remote site.
-
setAutomaticStateTransfer
Sets theXSiteStateTransferModeto the remote site.If the configuration for the remote site does not support the
XSiteStateTransferMode, then this method returnsfalse.- Parameters:
site- The remote site.mode- The newXSiteStateTransferMode.- Returns:
falseif the site does not support the correspondingXSiteStateTransferMode.
-