Improving code
This commit is contained in:
parent
721e69034b
commit
604856b4d2
|
@ -103,29 +103,23 @@ public class EServiceHandler extends ApplicationLifecycleHandler {
|
|||
Set<String> startTokens = applicationContext.configuration().startTokens();
|
||||
|
||||
Set<UUID> startContextsUUID = new HashSet<>();
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
for (String token : startTokens) {
|
||||
|
||||
UUID contextUUID = ContextUtility.getContextUUID(token);
|
||||
if (create) {
|
||||
ContextUtility.setContextFromToken(token);
|
||||
eServiceManager = new EServiceManager(applicationContext);
|
||||
eServiceManager.createEService();
|
||||
// applicationContext.properties()
|
||||
// .add(new Property(Constants.ESERVICE_MANAGER_PROPERTY, eServiceManager));
|
||||
create = false;
|
||||
} else {
|
||||
try {
|
||||
UUID contextUUID = ContextUtility.getContextUUID(token);
|
||||
eServiceManager.addToContext(contextUUID);
|
||||
} catch (Exception e) {
|
||||
UUID uuid = UUID.fromString(applicationContext.id());
|
||||
logger.error("Unable to add {} with UUID {} to current context ({})", EService.NAME, uuid,
|
||||
ContextUtility.getContextName(token), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
String contextFullName = ContextUtility.getContextName(token);
|
||||
UUID contextUUID = contextCache.getUUIDByFullName(contextFullName);
|
||||
startContextsUUID.add(contextUUID);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,28 +103,23 @@ public class HostingNodeHandler extends ContainerHandler {
|
|||
List<String> startTokens = containerContext.configuration().startTokens();
|
||||
|
||||
Set<UUID> startContextsUUID = new HashSet<>();
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
for (String token : startTokens) {
|
||||
UUID contextUUID = ContextUtility.getContextUUID(token);
|
||||
if (create) {
|
||||
ContextUtility.setContextFromToken(token);
|
||||
hostingNodeManager = new HostingNodeManager(containerContext);
|
||||
hostingNodeManager.createHostingNode();
|
||||
// containerContext.properties()
|
||||
// .add(new Property(Constants.HOSTING_NODE_MANAGER_PROPERTY, hostingNodeManager));
|
||||
create = false;
|
||||
} else {
|
||||
try {
|
||||
UUID contextUUID = ContextUtility.getContextUUID(token);
|
||||
hostingNodeManager.addToContext(contextUUID);
|
||||
} catch (Exception e) {
|
||||
UUID uuid = UUID.fromString(containerContext.id());
|
||||
logger.error("Unable to add {} with UUID {} to current context ({})", HostingNode.NAME, uuid,
|
||||
ContextUtility.getContextName(token), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
String contextFullName = ContextUtility.getContextName(token);
|
||||
UUID contextUUID = contextCache.getUUIDByFullName(contextFullName);
|
||||
startContextsUUID.add(contextUUID);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue