} finally {
NamedResourceAssociation.removeResource(runtimeName);
}
// Install the resource as module if it has not happend already
Runtime runtime = RuntimeLocator.getRequiredRuntime();
Module module = runtime.getModule(resource.getIdentity());
if (module == null) {
ModuleLoader moduleLoader = injectedServiceModuleLoader.getValue();
ModuleIdentifier modid = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + runtimeName);
ClassLoader classLoader = moduleLoader.loadModule(modid).getClassLoader();
module = runtime.installModule(classLoader, resource, null);
}
Resource modres = module != null ? module.adapt(Resource.class) : resource;
return new AbstractResourceHandle(modres, module) {
@Override