From 9b2f8b6782bd6b5be7b7e645ea01cfd2d0d9b6c3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 5 Sep 2014 08:42:54 -0500 Subject: [PATCH] IDEMPIERE-2188 Make hardcoded load timeout configurable --- .../i2.0z/oracle/201409050839_IDEMPIERE-2188.sql | 11 +++++++++++ .../i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql | 8 ++++++++ .../src/org/compiere/model/GridTable.java | 8 +++++--- .../src/org/compiere/model/MSysConfig.java | 3 ++- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql create mode 100644 migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql diff --git a/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql b/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql new file mode 100644 index 0000000000..498cc0eb21 --- /dev/null +++ b/migration/i2.0z/oracle/201409050839_IDEMPIERE-2188.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Sep 5, 2014 8:37:41 AM COT +-- IDEMPIERE-2188 Make hardcoded load timeout configurable +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType,Created,Updated) VALUES (200059,'C','30','Load timeout for GridTable','0a5a3606-f25d-4ab2-9e50-a75e50dc931a',0,100,'Y',100,'GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS',0,'D',TO_DATE('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201409050839_IDEMPIERE-2188.sql') FROM dual +; + diff --git a/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql b/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql new file mode 100644 index 0000000000..f09765bac6 --- /dev/null +++ b/migration/i2.0z/postgresql/201409050839_IDEMPIERE-2188.sql @@ -0,0 +1,8 @@ +-- Sep 5, 2014 8:37:41 AM COT +-- IDEMPIERE-2188 Make hardcoded load timeout configurable +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType,Created,Updated) VALUES (200059,'C','30','Load timeout for GridTable','0a5a3606-f25d-4ab2-9e50-a75e50dc931a',0,100,'Y',100,'GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS',0,'D',TO_TIMESTAMP('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-09-05 08:37:41','YYYY-MM-DD HH24:MI:SS')) +; + +SELECT register_migration_script('201409050839_IDEMPIERE-2188.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 83a0c95df4..1bed622ae9 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -1073,13 +1073,14 @@ public class GridTable extends AbstractTableModel public void waitLoadingForRow(int row) { // need to wait for data read into buffer int loops = 0; - //wait for 30 seconds - while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 60) + //wait for [timeout] seconds + int timeout = MSysConfig.getIntValue(MSysConfig.GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS, 30, Env.getAD_Client_ID(Env.getCtx())); + while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < timeout) { if (log.isLoggable(Level.FINE)) log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size()); try { - m_loaderFuture.get(500, TimeUnit.MILLISECONDS); + m_loaderFuture.get(1000, TimeUnit.MILLISECONDS); } catch (Exception ie) {} @@ -1092,6 +1093,7 @@ public class GridTable extends AbstractTableModel throw new IllegalStateException(savedEx); } if (row >= m_sort.size()) { + log.warning("Reached " + timeout + " seconds timeout loading row " + (row+1) + " for SQL=" + m_SQL); throw new IllegalStateException("Timeout loading row " + (row+1)); } } diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 84da9748bb..90d04f1041 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -916592278422470367L; + private static final long serialVersionUID = 1418216769489567455L; public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG"; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; @@ -70,6 +70,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME"; public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount"; public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; + public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS"; public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber"; public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES"; public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT";