X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportalapp%2Fservice%2Fsessionmgt%2FTimeoutHandler.java;h=2b8d6d43c058e280341fd20f0562432230567b5b;hb=230c71614b1d2fb71a8fb482c749ff5a6dad65d8;hp=fe1d29d62bdcdb6301b87dd6151523e6d500a925;hpb=2edaa4d6a5f7066e0c718f85a7bf7b8dabd0c59b;p=portal.git diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java index fe1d29d6..2b8d6d43 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/service/sessionmgt/TimeoutHandler.java @@ -54,9 +54,9 @@ import org.springframework.scheduling.quartz.QuartzJobBean; import org.onap.portalapp.portal.logging.aop.EPMetricsLog; import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; import org.onap.portalapp.portal.logging.logic.EPLogUtil; +import org.onap.portalapp.portal.service.AppsCacheService; import org.onap.portalapp.portal.service.EPAppService; import org.onap.portalapp.portal.transport.OnboardingApp; -import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalsdk.core.domain.sessionmgt.TimeoutVO; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; @@ -89,6 +89,7 @@ public class TimeoutHandler extends QuartzJobBean { @Autowired private SessionCommunication sessionCommunication; + @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { try { @@ -102,8 +103,9 @@ public class TimeoutHandler extends QuartzJobBean { ManageService manageService = (ManageService) applicationContext.getBean("manageService"); EPAppService appService = (EPAppService) applicationContext.getBean("epAppService"); - - List appList = appService.getEnabledNonOpenOnboardingApps(); + AppsCacheService appsCacheService = (AppsCacheService)applicationContext.getBean("appsCacheService"); + + List appList = appsCacheService.getAppsFullList(); onboardedAppList = appList; TypeReference> typeRef = new TypeReference>() { }; @@ -130,19 +132,19 @@ public class TimeoutHandler extends QuartzJobBean { Map> appSessionTimeOutMap = new Hashtable>(); // determine the Max TimeOut Time for each of the managed sessions for (OnboardingApp app : appList) { - if (app.restUrl == null) { - logger.info(EELFLoggerDelegate.debugLogger, "Session Management: null restUrl, not fetching from app " + app.name); + if (app.getRestUrl() == null) { + logger.info(EELFLoggerDelegate.debugLogger, "Session Management: null restUrl, not fetching from app " + app.getAppName()); continue; } - logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Calling App " + app.name + " at URL " + app.restUrl); + logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Calling App " + app.getAppName() + " at URL " + app.getRestUrl()); String jsonSessionStr = fetchAppSessions(app); - logger.info(EELFLoggerDelegate.debugLogger, "Session Management: App " + app.name + " returned " + jsonSessionStr); + logger.info(EELFLoggerDelegate.debugLogger, "Session Management: App " + app.getAppName() + " returned " + jsonSessionStr); if (jsonSessionStr == null || jsonSessionStr.isEmpty()) continue; try { Map sessionTimeoutMap = mapper.readValue(jsonSessionStr, typeRef); - appSessionTimeOutMap.put(app.id, sessionTimeoutMap); + appSessionTimeOutMap.put(app.getId(), sessionTimeoutMap); for (String portalJSessionId : sessionTimeoutMap.keySet()) { final TimeoutVO maxTimeoutVO = portalSessionTimeoutMap.get(portalJSessionId); final TimeoutVO compareTimeoutVO = sessionTimeoutMap.get(portalJSessionId); @@ -166,12 +168,12 @@ public class TimeoutHandler extends QuartzJobBean { // post the updated session timeouts back to the Apps for (OnboardingApp app : appList) { - if (app.restUrl == null) { - logger.warn(EELFLoggerDelegate.errorLogger, "Session Management: null restUrl, not posting back to app " + app.name); + if (app.getRestUrl() == null) { + logger.warn(EELFLoggerDelegate.errorLogger, "Session Management: null restUrl, not posting back to app " + app.getAppName()); continue; } - Map sessionTimeoutMap = appSessionTimeOutMap.get(app.id); + Map sessionTimeoutMap = appSessionTimeOutMap.get(app.getId()); if (sessionTimeoutMap == null || sessionTimeoutMap.isEmpty()) continue; @@ -182,7 +184,7 @@ public class TimeoutHandler extends QuartzJobBean { if (maxTimeoutVO == null || setTimeoutVO == null) { String message = String.format( "Session Management: Failed to update the session timeouts for the app: %s and the sessionId: %s.", - app.name, portalJSessionId); + app.getAppName(), portalJSessionId); logger.warn(EELFLoggerDelegate.errorLogger, message); continue; } @@ -192,7 +194,7 @@ public class TimeoutHandler extends QuartzJobBean { continue; } } - logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Updating App " + app.restUrl); + logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Updating App " + app.getRestUrl()); String sessionTimeoutMapStr = ""; try { sessionTimeoutMapStr = mapper.writeValueAsString(sessionTimeoutMap);