use of com.hazelcast.wan.impl.WanReplicationService in project hazelcast by hazelcast.
the class HttpPostCommandProcessor method handleWanResumePublisher.
/**
* Resumes a WAN publisher on this member only. The publisher is identified
* by the WAN replication name and publisher ID passed as parameters to
* the HTTP command.
*
* @param cmd the HTTP command
* @see WanPublisherState#REPLICATING
*/
@SuppressWarnings("checkstyle:magicnumber")
private void handleWanResumePublisher(HttpPostCommand cmd) throws Throwable {
String[] params = decodeParamsAndAuthenticate(cmd, 4);
String wanReplicationName = params[2];
String publisherId = params[3];
WanReplicationService service = getNode().getNodeEngine().getWanReplicationService();
service.resume(wanReplicationName, publisherId);
prepareResponse(cmd, response(SUCCESS, "message", "WAN publisher resumed"));
}
use of com.hazelcast.wan.impl.WanReplicationService in project hazelcast by hazelcast.
the class HttpPostCommandProcessor method handleWanPausePublisher.
/**
* Pauses a WAN publisher on this member only. The publisher is identified
* by the WAN replication name and publisher ID passed as parameters to
* the HTTP command.
*
* @param cmd the HTTP command
* @see WanPublisherState#PAUSED
*/
@SuppressWarnings("checkstyle:magicnumber")
private void handleWanPausePublisher(HttpPostCommand cmd) throws Throwable {
String[] params = decodeParamsAndAuthenticate(cmd, 4);
String wanReplicationName = params[2];
String publisherId = params[3];
WanReplicationService service = getNode().getNodeEngine().getWanReplicationService();
service.pause(wanReplicationName, publisherId);
prepareResponse(cmd, response(SUCCESS, "message", "WAN publisher paused"));
}
use of com.hazelcast.wan.impl.WanReplicationService in project hazelcast by hazelcast.
the class MapContainer method initWanReplication.
public void initWanReplication(NodeEngine nodeEngine) {
WanReplicationRef wanReplicationRef = mapConfig.getWanReplicationRef();
if (wanReplicationRef == null) {
return;
}
String wanReplicationRefName = wanReplicationRef.getName();
Config config = nodeEngine.getConfig();
if (!TRUE.equals(mapConfig.getMerkleTreeConfig().getEnabled()) && hasPublisherWithMerkleTreeSync(config, wanReplicationRefName)) {
throw new InvalidConfigurationException("Map " + name + " has disabled merkle trees but the WAN replication scheme " + wanReplicationRefName + " has publishers that use merkle trees." + " Please enable merkle trees for the map.");
}
WanReplicationService wanReplicationService = nodeEngine.getWanReplicationService();
wanReplicationDelegate = wanReplicationService.getWanReplicationPublishers(wanReplicationRefName);
SplitBrainMergePolicyProvider mergePolicyProvider = nodeEngine.getSplitBrainMergePolicyProvider();
wanMergePolicy = mergePolicyProvider.getMergePolicy(wanReplicationRef.getMergePolicyClassName());
checkMapMergePolicy(mapConfig, wanReplicationRef.getMergePolicyClassName(), mergePolicyProvider);
WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
if (wanReplicationConfig != null) {
WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getConsumerConfig();
if (wanConsumerConfig != null) {
persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
}
}
}
use of com.hazelcast.wan.impl.WanReplicationService in project hazelcast by hazelcast.
the class HttpPostCommandProcessor method handleWanStopPublisher.
/**
* Stops a WAN publisher on this member only. The publisher is identified
* by the WAN replication name and publisher ID passed as parameters to
* the HTTP command.
*
* @param cmd the HTTP command
* @see WanPublisherState#STOPPED
*/
@SuppressWarnings("checkstyle:magicnumber")
private void handleWanStopPublisher(HttpPostCommand cmd) throws Throwable {
String[] params = decodeParamsAndAuthenticate(cmd, 4);
String wanReplicationName = params[2];
String publisherId = params[3];
WanReplicationService service = getNode().getNodeEngine().getWanReplicationService();
service.stop(wanReplicationName, publisherId);
prepareResponse(cmd, response(SUCCESS, "message", "WAN publisher stopped"));
}
use of com.hazelcast.wan.impl.WanReplicationService in project hazelcast by hazelcast.
the class ChangeWanStateOperation method run.
@Override
public void run() throws Exception {
NodeEngine nodeEngine = getNodeEngine();
WanReplicationService wanReplicationService = nodeEngine.getWanReplicationService();
switch(state) {
case REPLICATING:
wanReplicationService.resume(wanReplicationName, wanPublisherId);
break;
case PAUSED:
wanReplicationService.pause(wanReplicationName, wanPublisherId);
break;
case STOPPED:
wanReplicationService.stop(wanReplicationName, wanPublisherId);
break;
default:
break;
}
}
Aggregations