Search in sources :

Example 6 with WanReplicationService

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"));
}
Also used : WanReplicationService(com.hazelcast.wan.impl.WanReplicationService)

Example 7 with WanReplicationService

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"));
}
Also used : WanReplicationService(com.hazelcast.wan.impl.WanReplicationService)

Example 8 with WanReplicationService

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();
        }
    }
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) MapConfig(com.hazelcast.config.MapConfig) IndexConfig(com.hazelcast.config.IndexConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanSyncConfig(com.hazelcast.config.WanSyncConfig) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationService(com.hazelcast.wan.impl.WanReplicationService) SplitBrainMergePolicyProvider(com.hazelcast.spi.merge.SplitBrainMergePolicyProvider) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Example 9 with WanReplicationService

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"));
}
Also used : WanReplicationService(com.hazelcast.wan.impl.WanReplicationService)

Example 10 with WanReplicationService

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;
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) WanReplicationService(com.hazelcast.wan.impl.WanReplicationService)

Aggregations

WanReplicationService (com.hazelcast.wan.impl.WanReplicationService)10 NodeEngine (com.hazelcast.spi.impl.NodeEngine)3 CacheConfig (com.hazelcast.config.CacheConfig)2 Config (com.hazelcast.config.Config)2 CacheService (com.hazelcast.cache.impl.CacheService)1 PreJoinCacheConfig.asCacheConfig (com.hazelcast.cache.impl.PreJoinCacheConfig.asCacheConfig)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 ConfigAccessor.getActiveMemberNetworkConfig (com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig)1 EventJournalConfig (com.hazelcast.config.EventJournalConfig)1 IndexConfig (com.hazelcast.config.IndexConfig)1 InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)1 ManagementCenterConfig (com.hazelcast.config.ManagementCenterConfig)1 MapConfig (com.hazelcast.config.MapConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 SocketInterceptorConfig (com.hazelcast.config.SocketInterceptorConfig)1 WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 WanReplicationRef (com.hazelcast.config.WanReplicationRef)1 WanSyncConfig (com.hazelcast.config.WanSyncConfig)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1