use of com.datastax.oss.driver.internal.core.metadata.NoopNodeStateListener in project java-driver by datastax.
the class DefaultDriverContext method buildNodeStateListener.
protected NodeStateListener buildNodeStateListener(NodeStateListener nodeStateListenerFromBuilder) {
List<NodeStateListener> listeners = new ArrayList<>();
if (nodeStateListenerFromBuilder != null) {
listeners.add(nodeStateListenerFromBuilder);
}
DefaultDriverOption newOption = DefaultDriverOption.METADATA_NODE_STATE_LISTENER_CLASSES;
@SuppressWarnings("deprecation") DefaultDriverOption legacyOption = DefaultDriverOption.METADATA_NODE_STATE_LISTENER_CLASS;
DriverExecutionProfile profile = config.getDefaultProfile();
if (profile.isDefined(newOption)) {
listeners.addAll(Reflection.buildFromConfigList(this, newOption, NodeStateListener.class, "com.datastax.oss.driver.internal.core.metadata"));
}
if (profile.isDefined(legacyOption)) {
LOG.warn("Option {} has been deprecated and will be removed in a future release; please use option {} instead.", legacyOption, newOption);
Reflection.buildFromConfig(this, legacyOption, NodeStateListener.class, "com.datastax.oss.driver.internal.core.metadata").ifPresent(listeners::add);
}
if (listeners.isEmpty()) {
return new NoopNodeStateListener(this);
} else if (listeners.size() == 1) {
return listeners.get(0);
} else {
return new MultiplexingNodeStateListener(listeners);
}
}
Aggregations