+ CheckedFuture<T, SchemaSourceException> fetchSourceFuture = fetchSource(id, regs);
+ // Add callback to notify cache listeners about encountered schema
+ Futures.addCallback(fetchSourceFuture, new FutureCallback<T>() {
+ @Override
+ public void onSuccess(final T result) {
+ for (final SchemaListenerRegistration listener : listeners) {
+ listener.getInstance().schemaSourceEncountered(result);
+ }
+ }
+
+ @Override
+ public void onFailure(final Throwable t) {
+ LOG.trace("Skipping notification for encountered source {}, fetching source failed", id, t);
+ }
+ });
+
+ return fetchSourceFuture;