- off by default, enable with the -Dorg.adempiere.po.useTimeoutForUpdate=true jvm parameter
This commit is contained in:
parent
257d12d77d
commit
a15e6a2718
|
@ -78,6 +78,10 @@ import org.w3c.dom.Element;
|
||||||
public abstract class PO
|
public abstract class PO
|
||||||
implements Serializable, Comparator, Evaluatee
|
implements Serializable, Comparator, Evaluatee
|
||||||
{
|
{
|
||||||
|
private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate";
|
||||||
|
|
||||||
|
private static final int QUERY_TIME_OUT = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -2375,7 +2379,11 @@ public abstract class PO
|
||||||
/** @todo status locking goes here */
|
/** @todo status locking goes here */
|
||||||
|
|
||||||
log.finest(sql.toString());
|
log.finest(sql.toString());
|
||||||
int no = DB.executeUpdate(sql.toString(), m_trxName);
|
int no = 0;
|
||||||
|
if (isUseTimeoutForUpdate())
|
||||||
|
no = DB.executeUpdateEx(sql.toString(), m_trxName, QUERY_TIME_OUT);
|
||||||
|
else
|
||||||
|
no = DB.executeUpdate(sql.toString(), m_trxName);
|
||||||
boolean ok = no == 1;
|
boolean ok = no == 1;
|
||||||
if (ok)
|
if (ok)
|
||||||
ok = lobSave();
|
ok = lobSave();
|
||||||
|
@ -2395,6 +2403,10 @@ public abstract class PO
|
||||||
return saveFinish (false, true);
|
return saveFinish (false, true);
|
||||||
} // saveUpdate
|
} // saveUpdate
|
||||||
|
|
||||||
|
private boolean isUseTimeoutForUpdate() {
|
||||||
|
return "true".equalsIgnoreCase(System.getProperty(USE_TIMEOUT_FOR_UPDATE, "false"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create New Record
|
* Create New Record
|
||||||
* @return true if new record inserted
|
* @return true if new record inserted
|
||||||
|
@ -2785,7 +2797,11 @@ public abstract class PO
|
||||||
.append(p_info.getTableName())
|
.append(p_info.getTableName())
|
||||||
.append(" WHERE ")
|
.append(" WHERE ")
|
||||||
.append(get_WhereClause(true));
|
.append(get_WhereClause(true));
|
||||||
int no = DB.executeUpdate(sql.toString(), localTrxName);
|
int no = 0;
|
||||||
|
if (isUseTimeoutForUpdate())
|
||||||
|
no = DB.executeUpdateEx(sql.toString(), localTrxName, QUERY_TIME_OUT);
|
||||||
|
else
|
||||||
|
no = DB.executeUpdate(sql.toString(), localTrxName);
|
||||||
success = no == 1;
|
success = no == 1;
|
||||||
|
|
||||||
// Save ID
|
// Save ID
|
||||||
|
@ -3285,7 +3301,11 @@ public abstract class PO
|
||||||
String sql = "UPDATE " + p_info.getTableName()
|
String sql = "UPDATE " + p_info.getTableName()
|
||||||
+ " SET Processing='Y' WHERE (Processing='N' OR Processing IS NULL) AND "
|
+ " SET Processing='Y' WHERE (Processing='N' OR Processing IS NULL) AND "
|
||||||
+ get_WhereClause(true);
|
+ get_WhereClause(true);
|
||||||
boolean success = DB.executeUpdate(sql, null) == 1; // outside trx
|
boolean success = false;
|
||||||
|
if (isUseTimeoutForUpdate())
|
||||||
|
success = DB.executeUpdateEx(sql, null, QUERY_TIME_OUT) == 1; // outside trx
|
||||||
|
else
|
||||||
|
success = DB.executeUpdate(sql, null) == 1; // outside trx
|
||||||
if (success)
|
if (success)
|
||||||
log.fine("success");
|
log.fine("success");
|
||||||
else
|
else
|
||||||
|
@ -3318,7 +3338,11 @@ public abstract class PO
|
||||||
m_newValues[index] = Boolean.FALSE; // direct
|
m_newValues[index] = Boolean.FALSE; // direct
|
||||||
String sql = "UPDATE " + p_info.getTableName()
|
String sql = "UPDATE " + p_info.getTableName()
|
||||||
+ " SET Processing='N' WHERE " + get_WhereClause(true);
|
+ " SET Processing='N' WHERE " + get_WhereClause(true);
|
||||||
boolean success = DB.executeUpdate(sql, trxName) == 1;
|
boolean success = false;
|
||||||
|
if (isUseTimeoutForUpdate())
|
||||||
|
success = DB.executeUpdateEx(sql, trxName, QUERY_TIME_OUT) == 1;
|
||||||
|
else
|
||||||
|
success = DB.executeUpdate(sql, trxName) == 1;
|
||||||
if (success)
|
if (success)
|
||||||
log.fine("success" + (trxName == null ? "" : "[" + trxName + "]"));
|
log.fine("success" + (trxName == null ? "" : "[" + trxName + "]"));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue