From 8f31506ac75368e1cd88c27f8121835f99078a86 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 19 Apr 2021 14:41:34 +0200 Subject: [PATCH] IDEMPIERE-4764 Hazelcast distributed cache can be an issue in some environments (#655) * IDEMPIERE-4764 Hazelcast distributed cache can be an issue in some environments - Change setting for all caches to be non-distributed * IDEMPIERE-4764 Hazelcast distributed cache can be an issue in some environments * TC-324 Fix cache related monitoring and performance issues - PO & GridTable call to CacheMgt reset should be async. Co-authored-by: hengsin --- org.adempiere.base/src/org/compiere/model/GridTable.java | 2 +- org.adempiere.base/src/org/compiere/model/MAcctSchema.java | 4 ++-- org.adempiere.base/src/org/compiere/model/MClient.java | 2 +- org.adempiere.base/src/org/compiere/model/MSysConfig.java | 2 +- org.adempiere.base/src/org/compiere/model/MSystem.java | 2 +- org.adempiere.base/src/org/compiere/model/PO.java | 6 +++--- .../src/org/compiere/model/TranslationTable.java | 2 +- .../src/main/server/org/compiere/server/Scheduler.java | 2 +- .../org/adempiere/webui/editor/WChosenboxListEditor.java | 2 +- .../src/org/adempiere/webui/editor/WTableDirEditor.java | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 8da167036d..be58584c06 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -2159,7 +2159,7 @@ public class GridTable extends AbstractTableModel return SAVE_ERROR; } - CacheMgt.get().reset(m_tableName); + Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(m_tableName)); // everything ok m_rowData = null; diff --git a/org.adempiere.base/src/org/compiere/model/MAcctSchema.java b/org.adempiere.base/src/org/compiere/model/MAcctSchema.java index a6335c4a65..3f23d6add3 100644 --- a/org.adempiere.base/src/org/compiere/model/MAcctSchema.java +++ b/org.adempiere.base/src/org/compiere/model/MAcctSchema.java @@ -181,9 +181,9 @@ public class MAcctSchema extends X_C_AcctSchema implements ImmutablePOSupport } // getClientAcctSchema /** Cache of Client AcctSchema Arrays **/ - private static CCache s_schema = new CCache(I_AD_ClientInfo.Table_Name, I_AD_ClientInfo.Table_Name+"|MAcctSchema[]", 3, 120, true); // 3 clients + private static CCache s_schema = new CCache(I_AD_ClientInfo.Table_Name, I_AD_ClientInfo.Table_Name+"|MAcctSchema[]", 3, 120, false); // 3 clients /** Cache of AcctSchemas **/ - private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(Table_Name, 3, 120, true); // 3 accounting schemas + private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(Table_Name, 3, 120); // 3 accounting schemas /************************************************************************** diff --git a/org.adempiere.base/src/org/compiere/model/MClient.java b/org.adempiere.base/src/org/compiere/model/MClient.java index f0f6b17c53..9d47d6ed53 100644 --- a/org.adempiere.base/src/org/compiere/model/MClient.java +++ b/org.adempiere.base/src/org/compiere/model/MClient.java @@ -135,7 +135,7 @@ public class MClient extends X_AD_Client implements ImmutablePOSupport @SuppressWarnings("unused") private static CLogger s_log = CLogger.getCLogger (MClient.class); /** Cache */ - private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(Table_Name, 3, 120, true); + private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(Table_Name, 3, 120); /************************************************************************** diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index acd96572ba..977aa2c18d 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -238,7 +238,7 @@ public class MSysConfig extends X_AD_SysConfig /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MSysConfig.class); /** Cache */ - private static CCache s_cache = new CCache(Table_Name, 40, 0, true); + private static CCache s_cache = new CCache(Table_Name, 40, 0); /** * Get system configuration property of type string diff --git a/org.adempiere.base/src/org/compiere/model/MSystem.java b/org.adempiere.base/src/org/compiere/model/MSystem.java index cad83c1ae4..c770b64704 100644 --- a/org.adempiere.base/src/org/compiere/model/MSystem.java +++ b/org.adempiere.base/src/org/compiere/model/MSystem.java @@ -83,7 +83,7 @@ public class MSystem extends X_AD_System } // get /** System - cached */ - private static CCache s_system = new CCache(Table_Name, 1, -1, true); + private static CCache s_system = new CCache(Table_Name, 1, -1); /************************************************************************** * Default Constructor diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 6e892a02f5..ae9e955b7e 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -2456,10 +2456,10 @@ public abstract class PO m_createNew = false; } if (!newRecord) { - CacheMgt.get().reset(p_info.getTableName(), get_ID()); + Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(p_info.getTableName())); MRecentItem.clearLabel(p_info.getAD_Table_ID(), get_ID()); } else if (get_ID() > 0 && success) - CacheMgt.get().newRecord(p_info.getTableName(), get_ID()); + Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().newRecord(p_info.getTableName(), get_ID())); return success; } // saveFinish @@ -3640,7 +3640,7 @@ public abstract class PO int size = p_info.getColumnCount(); m_oldValues = new Object[size]; m_newValues = new Object[size]; - CacheMgt.get().reset(p_info.getTableName(), Record_ID); + Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(p_info.getTableName())); } } finally diff --git a/org.adempiere.base/src/org/compiere/model/TranslationTable.java b/org.adempiere.base/src/org/compiere/model/TranslationTable.java index 1b2a39d590..b2e33c3d66 100644 --- a/org.adempiere.base/src/org/compiere/model/TranslationTable.java +++ b/org.adempiere.base/src/org/compiere/model/TranslationTable.java @@ -106,7 +106,7 @@ public class TranslationTable private static Integer s_activeLanguages = null; /** Cache */ - private static CCache s_cache = new CCache(null, "TranslationTable", 20, true); + private static CCache s_cache = new CCache(null, "TranslationTable", 20); /** diff --git a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java index 0d91a4584f..2ac6a27eb8 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java @@ -85,7 +85,7 @@ public class Scheduler extends AdempiereServer protected int AD_Scheduler_ID; - private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(MScheduler.Table_Name, 10, 60, true); + private static ImmutableIntPOCache s_cache = new ImmutableIntPOCache(MScheduler.Table_Name, 10, 60); /** * Work diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChosenboxListEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChosenboxListEditor.java index 78a1c5c25d..8ba56ab659 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChosenboxListEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WChosenboxListEditor.java @@ -591,7 +591,7 @@ public class WChosenboxListEditor extends WEditor implements ContextMenuListener private WChosenboxListEditor editor; protected CCacheListener(String tableName, WChosenboxListEditor editor) { - super(tableName, tableName, 0, true); + super(tableName, tableName+"|CCacheListener", 0, false); this.editor = editor; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java index 3f55128c4e..12b35135fe 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java @@ -949,7 +949,7 @@ ContextMenuListener, IZoomableEditor private WTableDirEditor editor; protected CCacheListener(String tableName, WTableDirEditor editor) { - super(tableName, tableName+"|CCacheListener", 0, 0, true); + super(tableName, tableName+"|CCacheListener", 0, 0, false); this.editor = editor; }