Added explicit invocation of addEserviceToContext
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/resource-registry-handlers@148246 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2f56c934df
commit
7453f3239d
|
@ -335,16 +335,6 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
try {
|
||||
eService = resourceRegistryPublisher.createResource(EService.class,
|
||||
eService);
|
||||
try {
|
||||
createHostsRelation(eService, resourceRegistryPublisher);
|
||||
} catch (Exception ex) {
|
||||
String error = String.format(
|
||||
"Unable to Create %s relation from % to % (%s : %s)",
|
||||
Hosts.NAME, HostingNode.NAME, EService.NAME,
|
||||
applicationContext.name(), eService.getHeader().getUUID());
|
||||
logger.error(error, ex);
|
||||
throw new ResourceRegistryException(error, ex);
|
||||
}
|
||||
} catch (ResourceAlreadyPresentException e) {
|
||||
ResourceRegistryClient registryClient = ResourceRegistryClientFactory.create();
|
||||
eService = registryClient.getInstance(EService.class, eService.getHeader().getUUID());
|
||||
|
@ -352,11 +342,27 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
logger.debug("Moving app {} to {}", applicationContext.name(), state);
|
||||
createOrUpdateServiceStateFacet(eService, state);
|
||||
} catch (ResourceAvailableInAnotherContextException e) {
|
||||
// Adding the HostingNode I also add the EService thanks to propagationConstraint
|
||||
// Adding the HostingNode I also add the EService thanks to propagationConstraint
|
||||
String token = SecurityTokenProvider.instance.get();
|
||||
// If hosts was not created we need to add eService and HostingNode, otherwise
|
||||
// addHostingnode is sufficient. Because we cannot be sure of it we invoke both
|
||||
addToContext(eService, token);
|
||||
addHostingNodeToCurrentContext();
|
||||
ResourceRegistryClient registryClient = ResourceRegistryClientFactory.create();
|
||||
eService = registryClient.getInstance(EService.class, eService.getHeader().getUUID());
|
||||
}
|
||||
|
||||
try {
|
||||
createHostsRelation(eService, resourceRegistryPublisher);
|
||||
} catch (Exception ex) {
|
||||
String error = String.format(
|
||||
"Unable to Create %s relation from % to % (%s : %s)",
|
||||
Hosts.NAME, HostingNode.NAME, EService.NAME,
|
||||
applicationContext.name(), eService.getHeader().getUUID());
|
||||
logger.error(error, ex);
|
||||
throw new ResourceRegistryException(error, ex);
|
||||
}
|
||||
|
||||
return eService;
|
||||
}
|
||||
|
||||
|
@ -540,6 +546,7 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
Thread.currentThread().setContextClassLoader(contextCL);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void addToContext(EService eService, String token) {
|
||||
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
|
||||
|
@ -574,7 +581,6 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
Thread.currentThread().setContextClassLoader(contextCL);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Reference in New Issue