From 09202c5769db9ab867fa3e92b361572fb36e94c1 Mon Sep 17 00:00:00 2001 From: nhthinh-axonivy Date: Tue, 17 Dec 2024 15:55:50 +0700 Subject: [PATCH] feature/IVYPORTAL-18050-Create-cache-mechanism-for-dashboard-converter-to-enhance-performance --- .../portal/src/ch/addon/portal/generic/menu/MenuView.java | 2 +- .../src/ch/ivy/addon/portalkit/util/DashboardUtils.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AxonIvyPortal/portal/src/ch/addon/portal/generic/menu/MenuView.java b/AxonIvyPortal/portal/src/ch/addon/portal/generic/menu/MenuView.java index e56ded8a3a..59f81315b5 100644 --- a/AxonIvyPortal/portal/src/ch/addon/portal/generic/menu/MenuView.java +++ b/AxonIvyPortal/portal/src/ch/addon/portal/generic/menu/MenuView.java @@ -268,7 +268,7 @@ public PortalDashboardItemWrapper getDashboardCache() { } if (portalDashboardItemWrapper == null) { - synchronized (PortalDashboardItemWrapper.class) { + synchronized (this) { portalDashboardItemWrapper = new PortalDashboardItemWrapper(DashboardUtils.collectDashboards()); cacheService.setSessionCache(IvyCacheIdentifier.PORTAL_DASHBOARDS, sessionUserId, portalDashboardItemWrapper); } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java index 7fc57b2b58..c8dd6cdf6b 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java @@ -66,7 +66,7 @@ public static List getPublicDashboards() { } if (portalPublicDashboardWrapper == null) { - synchronized (PortalPublicDashboardWrapper.class) { + synchronized (sessionUserId.intern()) { List dashboards = new ArrayList<>(); try { String dashboardJson = Ivy.var().get(PortalVariable.DASHBOARD.key); @@ -100,7 +100,7 @@ public static List getPrivateDashboards() { } if (portalPrivateDashboardWrapper == null) { - synchronized (PortalPublicDashboardWrapper.class) { + synchronized (sessionUserId.intern()) { List dashboards = new ArrayList<>(); try { String dashboardInUserProperty = readDashboardBySessionUser();