in modules/core/src/main/java/org/apache/fluo/core/observer/v2/ObserverRegistry.java [81:110]
private void register(Column col, NotificationType nt, String alias, Observer obs) {
try {
Method closeMethod = obs.getClass().getMethod("close");
if (!closeMethod.getDeclaringClass().equals(Observer.class)) {
log.warn(
"Observer {} implements close(). Close is not called on Observers registered using ObserverProvider."
+ " Close is only called on Observers configured the old way.",
obs.getClass().getName());
}
} catch (NoSuchMethodException | SecurityException e) {
throw new RuntimeException("Failed to check if close() is implemented", e);
}
if (nt == NotificationType.STRONG && !strongColumns.contains(col)) {
throw new IllegalArgumentException(
"Column " + col + " not previously configured for strong notifications");
}
if (nt == NotificationType.WEAK && !weakColumns.contains(col)) {
throw new IllegalArgumentException(
"Column " + col + " not previously configured for weak notifications");
}
if (observers.containsKey(col)) {
throw new IllegalArgumentException("Duplicate observed column " + col);
}
observers.put(col, obs);
aliases.put(col, alias);
}