Fixing handlers

This commit is contained in:
Luca Frosini 2022-06-07 18:00:02 +02:00
parent a8f4791949
commit 07fe3ed96e
3 changed files with 3 additions and 5 deletions

View File

@ -105,12 +105,12 @@ public class EServiceHandler extends ApplicationLifecycleHandler {
Set<UUID> startContextsUUID = new HashSet<>();
ContextCache contextCache = ContextCache.getInstance();
for (String token : startTokens) {
ContextUtility.setContextFromToken(token);
String contextFullName = ContextUtility.getContextName(token);
UUID contextUUID = contextCache.getUUIDByFullName(contextFullName);
startContextsUUID.add(contextUUID);
try {
if (create) {
ContextUtility.setContextFromToken(token);
eServiceManager = new EServiceManager(applicationContext);
eServiceManager.createEService();
applicationContext.properties()
@ -147,8 +147,7 @@ public class EServiceHandler extends ApplicationLifecycleHandler {
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
String previousToken = SecurityTokenProvider.instance.get();
if (previousToken == null) {
ContextUtility
.setContextFromToken(applicationContext.configuration().startTokens().iterator().next());
ContextUtility.setContextFromToken(applicationContext.configuration().startTokens().iterator().next());
}
try {
Thread.currentThread().setContextClassLoader(EServiceHandler.class.getClassLoader());

View File

@ -105,12 +105,12 @@ public class HostingNodeHandler extends ContainerHandler {
Set<UUID> startContextsUUID = new HashSet<>();
ContextCache contextCache = ContextCache.getInstance();
for (String token : startTokens) {
ContextUtility.setContextFromToken(token);
String contextFullName = ContextUtility.getContextName(token);
UUID contextUUID = contextCache.getUUIDByFullName(contextFullName);
startContextsUUID.add(contextUUID);
try {
if (create) {
ContextUtility.setContextFromToken(token);
hostingNodeManager = new HostingNodeManager(containerContext);
hostingNodeManager.createHostingNode();
containerContext.properties()

View File

@ -47,7 +47,6 @@ import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activa
import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.handler.resourceregistry.Constants;
import org.gcube.smartgears.handler.resourceregistry.ContextUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;