Class XSiteStateTransferManagerImpl
- java.lang.Object
-
- org.infinispan.xsite.statetransfer.XSiteStateTransferManagerImpl
-
- All Implemented Interfaces:
XSiteStateTransferManager
public class XSiteStateTransferManagerImpl extends Object implements XSiteStateTransferManager
XSiteStateTransferManager
implementation.- Since:
- 7.0
- Author:
- Pedro Ruivo
-
-
Field Summary
-
Fields inherited from interface org.infinispan.xsite.statetransfer.XSiteStateTransferManager
STATUS_CANCELED, STATUS_ERROR, STATUS_OK, STATUS_SENDING
-
-
Constructor Summary
Constructors Constructor Description XSiteStateTransferManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener()
void
becomeCoordinator(String siteName)
Makes this node the coordinator for the state transfer to the site name.void
cancelPushState(String siteName)
It cancels a running state transfer.void
cancelReceive(String siteName)
Sets the cluster to normal state.void
clearClusterStatus()
Clears the completed state transfer status in all the cluster.void
clearStatus()
Clears the completed state transfer status.Map<String,String>
getClusterStatus()
List<String>
getRunningStateTransfers()
String
getSendingSiteName()
Map<String,String>
getStatus()
<K,V>
voidhandleTopology(TopologyChangedEvent<K,V> topologyChangedEvent)
void
notifyStatePushFinished(String siteName, Address node, boolean statusOk)
It receives the notifications from local site when some node finishes pushing the state to the remote site.void
removeListener()
void
startPushState(String siteName)
It notifies all nodes from local site to start transfer the state to the remote site.
-
-
-
Method Detail
-
addListener
public void addListener()
-
removeListener
public void removeListener()
-
notifyStatePushFinished
public void notifyStatePushFinished(String siteName, Address node, boolean statusOk) throws Throwable
Description copied from interface:XSiteStateTransferManager
It receives the notifications from local site when some node finishes pushing the state to the remote site.- Specified by:
notifyStatePushFinished
in interfaceXSiteStateTransferManager
- Parameters:
siteName
- the remote site namenode
- theAddress
from the node that finishes.statusOk
-true
if no error or exception occurred during the state transfer.- Throws:
Throwable
- If some unexpected behavior occurs.
-
startPushState
public final void startPushState(String siteName) throws Throwable
Description copied from interface:XSiteStateTransferManager
It notifies all nodes from local site to start transfer the state to the remote site.- Specified by:
startPushState
in interfaceXSiteStateTransferManager
- Parameters:
siteName
- the remote site name- Throws:
Throwable
- If some unexpected behavior occurs.
-
getRunningStateTransfers
public List<String> getRunningStateTransfers()
- Specified by:
getRunningStateTransfers
in interfaceXSiteStateTransferManager
- Returns:
- a list of site names in which this cache is pushing state.
-
getStatus
public Map<String,String> getStatus()
- Specified by:
getStatus
in interfaceXSiteStateTransferManager
- Returns:
- the completed state transfer status for which this node is the coordinator.
-
clearStatus
public void clearStatus()
Description copied from interface:XSiteStateTransferManager
Clears the completed state transfer status.- Specified by:
clearStatus
in interfaceXSiteStateTransferManager
-
cancelPushState
public void cancelPushState(String siteName) throws Throwable
Description copied from interface:XSiteStateTransferManager
It cancels a running state transfer.- Specified by:
cancelPushState
in interfaceXSiteStateTransferManager
- 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.
-
getClusterStatus
public Map<String,String> getClusterStatus() throws Exception
- Specified by:
getClusterStatus
in interfaceXSiteStateTransferManager
- Returns:
- the completed state transfer status from all the coordinators in the cluster.
- Throws:
Exception
- if some exception during the remote invocation occurs.
-
clearClusterStatus
public void clearClusterStatus() throws Exception
Description copied from interface:XSiteStateTransferManager
Clears the completed state transfer status in all the cluster.- Specified by:
clearClusterStatus
in interfaceXSiteStateTransferManager
- Throws:
Exception
- if some exception occurs during the remote invocation.
-
getSendingSiteName
public String getSendingSiteName()
- Specified by:
getSendingSiteName
in interfaceXSiteStateTransferManager
- Returns:
null
if this node is not receiving state or the site name which is sending the state.
-
cancelReceive
public void cancelReceive(String siteName) throws Exception
Description copied from interface:XSiteStateTransferManager
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.- Specified by:
cancelReceive
in interfaceXSiteStateTransferManager
- Parameters:
siteName
- the site name which is sending the state.- Throws:
Exception
- if some exception occurs during the remote invocation.
-
becomeCoordinator
public void becomeCoordinator(String siteName)
Description copied from interface:XSiteStateTransferManager
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.- Specified by:
becomeCoordinator
in interfaceXSiteStateTransferManager
- Parameters:
siteName
- the site name.
-
handleTopology
public <K,V> void handleTopology(TopologyChangedEvent<K,V> topologyChangedEvent)
-
-