+ private Module getModuleBlocking(final Class<?> modeledClass) {
+ final QNameModule moduleName = BindingReflections.getQNameModule(modeledClass);
+ final URI namespace = moduleName.getNamespace();
+ final Date revision = moduleName.getRevision();
+ Module module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
+ if((module == null) && this.futureSchema.waitForSchema(namespace,revision)) {
+ module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
+ }
+ Preconditions.checkState(module != null, "Schema for %s is not available.", modeledClass);
+ return module;
+ }
+
+ private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException e) {
+ LOG.warn("Blocking thread to wait for schema convergence updates for {} {}", this.futureSchema.getDuration(),
+ this.futureSchema.getUnit());
+ if(this.futureSchema.waitForSchema(binding)) {
+ return;
+ }
+
+ throw e;
+ }
+