+ 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 && futureSchema != null && 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) {
+ if(futureSchema != null) {
+ LOG.warn("Blocking thread to wait for schema convergence updates for {} {}",futureSchema.getDuration(), futureSchema.getUnit());
+ if(!futureSchema.waitForSchema(binding)) {
+ return;
+ }
+ }
+ throw e;
+ }
+