}
List<WanTargetClusterConfig> targets = wanReplicationConfig.getTargetClusterConfigs();
WanReplicationEndpoint[] targetEndpoints = new WanReplicationEndpoint[targets.size()];
int count = 0;
for (WanTargetClusterConfig targetClusterConfig : targets) {
WanReplicationEndpoint target;
if (targetClusterConfig.getReplicationImpl() != null) {
try {
target = ClassLoaderUtil
.newInstance(node.getConfigClassLoader(), targetClusterConfig.getReplicationImpl());
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
} else {
target = new WanNoDelayReplication();
}
String groupName = targetClusterConfig.getGroupName();
String password = targetClusterConfig.getGroupPassword();
String[] addresses = new String[targetClusterConfig.getEndpoints().size()];
targetClusterConfig.getEndpoints().toArray(addresses);
target.init(node, groupName, password, addresses);
targetEndpoints[count++] = target;
}
wr = new WanReplicationPublisherDelegate(name, targetEndpoints);
wanReplications.put(name, wr);
return wr;