Search in sources :

Example 1 with XSiteStateTransferMode

use of org.infinispan.configuration.cache.XSiteStateTransferMode in project infinispan by infinispan.

the class XSiteAutoTransferStatusCommand method invokeAsync.

@Override
public CompletionStage<AutoStateTransferResponse> invokeAsync(ComponentRegistry registry) throws Throwable {
    boolean offline = registry.getTakeOfflineManager().running().getSiteState(site) == SiteState.OFFLINE;
    XSiteStateTransferMode mode = registry.getXSiteStateTransferManager().running().stateTransferMode(site);
    return CompletableFuture.completedFuture(new AutoStateTransferResponse(offline, mode));
}
Also used : XSiteStateTransferMode(org.infinispan.configuration.cache.XSiteStateTransferMode) AutoStateTransferResponse(org.infinispan.xsite.response.AutoStateTransferResponse)

Example 2 with XSiteStateTransferMode

use of org.infinispan.configuration.cache.XSiteStateTransferMode in project infinispan by infinispan.

the class XSiteAdminOperations method asyncSetStateTransferMode.

public CompletionStage<Boolean> asyncSetStateTransferMode(String site, String mode) {
    authorizer.checkPermission(AuthorizationPermission.ADMIN);
    XSiteStateTransferMode stateTransferMode = XSiteStateTransferMode.valueOf(mode);
    // update locally first
    if (!stateTransferManager.setAutomaticStateTransfer(site, stateTransferMode)) {
        // failed
        return CompletableFutures.completedFalse();
    }
    ReplicableCommand cmd = commandsFactory.buildXSiteSetStateTransferModeCommand(site, stateTransferMode);
    return rpcManager.invokeCommandOnAll(cmd, org.infinispan.remoting.transport.impl.VoidResponseCollector.ignoreLeavers(), rpcManager.getSyncRpcOptions()).thenApply(o -> Boolean.TRUE);
}
Also used : ReplicableCommand(org.infinispan.commands.ReplicableCommand) XSiteStateTransferMode(org.infinispan.configuration.cache.XSiteStateTransferMode)

Aggregations

XSiteStateTransferMode (org.infinispan.configuration.cache.XSiteStateTransferMode)2 ReplicableCommand (org.infinispan.commands.ReplicableCommand)1 AutoStateTransferResponse (org.infinispan.xsite.response.AutoStateTransferResponse)1