+ @Override
+ public void onFailure(@Nonnull final Throwable throwable) {
+ executeInSelf(() -> {
+ if (slaveSalManager == localSlaveSalManager) {
+ final Throwable cause = Throwables.getRootCause(throwable);
+ if (cause instanceof AskTimeoutException) {
+ if (tries <= 5 || tries % 10 == 0) {
+ LOG.warn("{}: Failed to resolve schema context - retrying...", id, throwable);
+ }
+
+ resolveSchemaContext(schemaContextFactory, localSlaveSalManager,
+ masterReference, tries + 1);
+ } else {
+ LOG.error("{}: Failed to resolve schema context - unable to register slave mount point",
+ id, throwable);
+ closeSchemaSourceRegistrations();
+ }
+ }
+ });
+ }
+ }, MoreExecutors.directExecutor());
+ }
+
+ private void closeSchemaSourceRegistrations() {
+ if (registeredSchemas != null) {
+ registeredSchemas.forEach(SchemaSourceRegistration::close);
+ registeredSchemas = null;
+ }