Moved the token set

This commit is contained in:
Luca Frosini 2020-10-15 17:40:16 +02:00
parent 36c4ea90a9
commit 1a8c5fe14e
1 changed files with 4 additions and 5 deletions

View File

@ -272,6 +272,8 @@ public class EServiceManager extends ApplicationLifecycleHandler {
public void run() {
try {
String state = getState(lc);
String selectedToken = applicationContext.configuration().startTokens().toArray(new String[0])[0];
setContextFromToken(selectedToken);
createOrUpdateServiceStateFacet(state);
} catch (Exception e) {
logger.error("Cannot complete periodic update of EService", e);
@ -401,15 +403,12 @@ public class EServiceManager extends ApplicationLifecycleHandler {
private void createOrUpdateServiceStateFacet(String state) throws ResourceRegistryException {
ResourceRegistryPublisher resourceRegistryPublisher = ResourceRegistryPublisherFactory
.create();
String selectedToken = applicationContext.configuration().startTokens().toArray(new String[0])[0];
setContextFromToken(selectedToken);
EService eService = getEService();
ServiceStateFacet serviceStateFacet = null;
List<ServiceStateFacet> serviceStateFacets = eService.getFacets(ServiceStateFacet.class);