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,6 +335,23 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
try {
|
||||
eService = resourceRegistryPublisher.createResource(EService.class,
|
||||
eService);
|
||||
} catch (ResourceAlreadyPresentException e) {
|
||||
ResourceRegistryClient registryClient = ResourceRegistryClientFactory.create();
|
||||
eService = registryClient.getInstance(EService.class, eService.getHeader().getUUID());
|
||||
String state = applicationContext.lifecycle().state().remoteForm().toLowerCase();
|
||||
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
|
||||
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) {
|
||||
|
@ -345,18 +362,7 @@ public class EServiceManager extends ApplicationLifecycleHandler {
|
|||
logger.error(error, ex);
|
||||
throw new ResourceRegistryException(error, ex);
|
||||
}
|
||||
} catch (ResourceAlreadyPresentException e) {
|
||||
ResourceRegistryClient registryClient = ResourceRegistryClientFactory.create();
|
||||
eService = registryClient.getInstance(EService.class, eService.getHeader().getUUID());
|
||||
String state = applicationContext.lifecycle().state().remoteForm().toLowerCase();
|
||||
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
|
||||
addHostingNodeToCurrentContext();
|
||||
ResourceRegistryClient registryClient = ResourceRegistryClientFactory.create();
|
||||
eService = registryClient.getInstance(EService.class, eService.getHeader().getUUID());
|
||||
}
|
||||
|
||||
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