com.hazelcast.config.Config.getWanReplicationConfig()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中com.hazelcast.config.Config.getWanReplicationConfig()方法的一些代码示例,展示了Config.getWanReplicationConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getWanReplicationConfig()方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:getWanReplicationConfig

Config.getWanReplicationConfig介绍

[英]Returns the WAN replication configuration with the given name.
[中]返回具有给定名称的WAN复制配置。

代码示例

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public WanReplicationConfig getWanReplicationConfig(String name) {
  return staticConfig.getWanReplicationConfig(name);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public WanReplicationConfig getWanReplicationConfig(String name) {
  return staticConfig.getWanReplicationConfig(name);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
  public WanReplicationPublisherDelegate createNew(String name) {
    final WanReplicationConfig wanReplicationConfig = node.getConfig().getWanReplicationConfig(name);
    if (wanReplicationConfig == null) {
      return null;
    }
    final List<WanPublisherConfig> publisherConfigs = wanReplicationConfig.getWanPublisherConfigs();
    return new WanReplicationPublisherDelegate(name, createPublishers(wanReplicationConfig, publisherConfigs));
  }
};

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
  public WanReplicationPublisherDelegate createNew(String name) {
    final WanReplicationConfig wanReplicationConfig = node.getConfig().getWanReplicationConfig(name);
    if (wanReplicationConfig == null) {
      return null;
    }
    final List<WanPublisherConfig> publisherConfigs = wanReplicationConfig.getWanPublisherConfigs();
    return new WanReplicationPublisherDelegate(name, createPublishers(wanReplicationConfig, publisherConfigs));
  }
};

代码示例来源:origin: hazelcast/hazelcast-jet

private boolean canPersistWanReplicatedData(CacheConfig cacheConfig, NodeEngine nodeEngine) {
  boolean persistWanReplicatedData = false;
  WanReplicationRef wanReplicationRef = cacheConfig.getWanReplicationRef();
  if (wanReplicationRef != null) {
    String wanReplicationRefName = wanReplicationRef.getName();
    Config config = nodeEngine.getConfig();
    WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
    if (wanReplicationConfig != null) {
      WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getWanConsumerConfig();
      if (wanConsumerConfig != null) {
        persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
      }
    }
  }
  return persistWanReplicatedData;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private boolean canPersistWanReplicatedData(CacheConfig cacheConfig, NodeEngine nodeEngine) {
  boolean persistWanReplicatedData = false;
  WanReplicationRef wanReplicationRef = cacheConfig.getWanReplicationRef();
  if (wanReplicationRef != null) {
    String wanReplicationRefName = wanReplicationRef.getName();
    Config config = nodeEngine.getConfig();
    WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
    if (wanReplicationConfig != null) {
      WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getWanConsumerConfig();
      if (wanConsumerConfig != null) {
        persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
      }
    }
  }
  return persistWanReplicatedData;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

/**
 * Returns {@code true} if at least one of the WAN publishers has
 * Merkle tree consistency check configured for the given WAN
 * replication configuration
 *
 * @param config                configuration
 * @param wanReplicationRefName The name of the WAN replication
 * @return {@code true} if there is at least one publisher has Merkle
 * tree configured
 */
private boolean hasPublisherWithMerkleTreeSync(Config config, String wanReplicationRefName) {
  WanReplicationConfig replicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
  if (replicationConfig != null) {
    for (WanPublisherConfig publisherConfig : replicationConfig.getWanPublisherConfigs()) {
      if (publisherConfig.getWanSyncConfig() != null
          && ConsistencyCheckStrategy.MERKLE_TREES.equals(publisherConfig.getWanSyncConfig()
          .getConsistencyCheckStrategy())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: hazelcast/hazelcast-jet

/**
 * Returns {@code true} if at least one of the WAN publishers has
 * Merkle tree consistency check configured for the given WAN
 * replication configuration
 *
 * @param config                configuration
 * @param wanReplicationRefName The name of the WAN replication
 * @return {@code true} if there is at least one publisher has Merkle
 * tree configured
 */
private boolean hasPublisherWithMerkleTreeSync(Config config, String wanReplicationRefName) {
  WanReplicationConfig replicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
  if (replicationConfig != null) {
    for (WanPublisherConfig publisherConfig : replicationConfig.getWanPublisherConfigs()) {
      if (publisherConfig.getWanSyncConfig() != null
          && ConsistencyCheckStrategy.MERKLE_TREES.equals(publisherConfig.getWanSyncConfig()
          .getConsistencyCheckStrategy())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public void initWanReplication(NodeEngine nodeEngine) {
  WanReplicationRef wanReplicationRef = mapConfig.getWanReplicationRef();
  if (wanReplicationRef == null) {
    return;
  }
  String wanReplicationRefName = wanReplicationRef.getName();
  Config config = nodeEngine.getConfig();
  if (!config.findMapMerkleTreeConfig(name).isEnabled()
      && 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();
  wanReplicationPublisher = wanReplicationService.getWanReplicationPublisher(wanReplicationRefName);
  wanMergePolicy = mapServiceContext.getMergePolicyProvider().getMergePolicy(wanReplicationRef.getMergePolicy());
  WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
  if (wanReplicationConfig != null) {
    WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getWanConsumerConfig();
    if (wanConsumerConfig != null) {
      persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

public void initWanReplication(NodeEngine nodeEngine) {
  WanReplicationRef wanReplicationRef = mapConfig.getWanReplicationRef();
  if (wanReplicationRef == null) {
    return;
  }
  String wanReplicationRefName = wanReplicationRef.getName();
  Config config = nodeEngine.getConfig();
  if (!config.findMapMerkleTreeConfig(name).isEnabled()
      && 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();
  wanReplicationPublisher = wanReplicationService.getWanReplicationPublisher(wanReplicationRefName);
  wanMergePolicy = mapServiceContext.getMergePolicyProvider().getMergePolicy(wanReplicationRef.getMergePolicy());
  WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
  if (wanReplicationConfig != null) {
    WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getWanConsumerConfig();
    if (wanConsumerConfig != null) {
      persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
    }
  }
}

相关文章

Config类方法