IDEMPIERE-2188 Make hardcoded load timeout configurable

This commit is contained in:
Carlos Ruiz 2014-09-05 08:42:54 -05:00
parent 991167cfc2
commit 9b2f8b6782
4 changed files with 26 additions and 4 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -1073,13 +1073,14 @@ public class GridTable extends AbstractTableModel
public void waitLoadingForRow(int row) { public void waitLoadingForRow(int row) {
// need to wait for data read into buffer // need to wait for data read into buffer
int loops = 0; int loops = 0;
//wait for 30 seconds //wait for [timeout] seconds
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 60) 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()); if (log.isLoggable(Level.FINE)) log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try try
{ {
m_loaderFuture.get(500, TimeUnit.MILLISECONDS); m_loaderFuture.get(1000, TimeUnit.MILLISECONDS);
} }
catch (Exception ie) catch (Exception ie)
{} {}
@ -1092,6 +1093,7 @@ public class GridTable extends AbstractTableModel
throw new IllegalStateException(savedEx); throw new IllegalStateException(savedEx);
} }
if (row >= m_sort.size()) { 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)); throw new IllegalStateException("Timeout loading row " + (row+1));
} }
} }

View File

@ -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_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; 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 DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME";
public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount"; public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount";
public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; 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 Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES"; public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT"; public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT";