use of com.datastax.oss.driver.internal.core.metadata.schema.MultiplexingSchemaChangeListener in project java-driver by datastax.
the class DefaultDriverContext method buildSchemaChangeListener.
protected SchemaChangeListener buildSchemaChangeListener(SchemaChangeListener schemaChangeListenerFromBuilder) {
List<SchemaChangeListener> listeners = new ArrayList<>();
if (schemaChangeListenerFromBuilder != null) {
listeners.add(schemaChangeListenerFromBuilder);
}
DefaultDriverOption newOption = DefaultDriverOption.METADATA_SCHEMA_CHANGE_LISTENER_CLASSES;
@SuppressWarnings("deprecation") DefaultDriverOption legacyOption = DefaultDriverOption.METADATA_SCHEMA_CHANGE_LISTENER_CLASS;
DriverExecutionProfile profile = config.getDefaultProfile();
if (profile.isDefined(newOption)) {
listeners.addAll(Reflection.buildFromConfigList(this, newOption, SchemaChangeListener.class, "com.datastax.oss.driver.internal.core.metadata.schema"));
}
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, SchemaChangeListener.class, "com.datastax.oss.driver.internal.core.metadata.schema").ifPresent(listeners::add);
}
if (listeners.isEmpty()) {
return new NoopSchemaChangeListener(this);
} else if (listeners.size() == 1) {
return listeners.get(0);
} else {
return new MultiplexingSchemaChangeListener(listeners);
}
}
Aggregations