IDEMPIERE-3416 Implement the ability to track open DB connections

This commit is contained in:
Carlos Ruiz 2017-06-30 16:45:12 +02:00
parent 9bfe040d9b
commit fb35ec9d68
11 changed files with 18 additions and 7 deletions

View File

@ -209,6 +209,7 @@ public class RequestEMailProcessor extends SvrProcess implements ProcessEmailHan
Trx trxRequest = null;
try {
trxRequest = Trx.get(Trx.createTrxName("SvrProcess-makerequest"), true);
trxRequest.setDisplayName(getClass().getName()+"_processEmailContent");
trxRequest.start();
createRequest(emailHeader, trxRequest.getTrxName());

View File

@ -225,8 +225,10 @@ public final class ProcessUtil {
MRule.setContext(engine, ctx, 0); // no window
// now add the method arguments to the engine
engine.put(MRule.ARGUMENTS_PREFIX + "Ctx", ctx);
if (trx == null)
if (trx == null) {
trx = Trx.get(Trx.createTrxName(pi.getTitle()+"_"+pi.getAD_PInstance_ID()), true);
trx.setDisplayName(ProcessUtil.class.getName()+"_startScriptProcess");
}
engine.put(MRule.ARGUMENTS_PREFIX + "Trx", trx);
engine.put(MRule.ARGUMENTS_PREFIX + "TrxName", trx.getTrxName());
engine.put(MRule.ARGUMENTS_PREFIX + "Record_ID", pi.getRecord_ID());

View File

@ -258,6 +258,7 @@ public abstract class Doc
String error = null;
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(Env.getCtx(), AD_Client_ID);
Trx trx = Trx.get(Trx.createTrxName("ManulPosting"), true);
trx.setDisplayName(Doc.class.getName()+"_manualPosting");
try
{
//Costing: Post MatchPO before MR

View File

@ -279,6 +279,7 @@ public class MPaySelectionCheck extends X_C_PaySelectionCheck
localTrx = true;
trxName = Trx.createTrxName("ConfirmPrintSingle");
trx = Trx.get(trxName, true);
trx.setDisplayName(MPaySelectionCheck.class.getName()+"_confirmPrint");
check.set_TrxName(trxName);
}
try {
@ -397,6 +398,7 @@ public class MPaySelectionCheck extends X_C_PaySelectionCheck
localTrx = true;
trxName = Trx.createTrxName("ConfirmPrintMulti");
trx = Trx.get(trxName, true);
trx.setDisplayName(MPaySelectionCheck.class.getName()+"_confirmPrints");
}
int lastDocumentNo = 0;
try {

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 8251867765594097812L;
private static final long serialVersionUID = -5006794875155447942L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@ -59,6 +59,9 @@ public class MSysConfig extends X_AD_SysConfig
public static final String APPLICATION_MAIN_VERSION = "APPLICATION_MAIN_VERSION";
public static final String APPLICATION_MAIN_VERSION_SHOWN = "APPLICATION_MAIN_VERSION_SHOWN";
public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN";
public static final String AUTOMATIC_PACKIN_PROCESSING = "AUTOMATIC_PACKIN_PROCESSING";
public static final String AUTOMATIC_PACKIN_TIMEOUT = "AUTOMATIC_PACKIN_TIMEOUT";
public static final String AUTOMATIC_PACKIN_RETRIES = "AUTOMATIC_PACKIN_RETRIES";
public static final String ATTACH_EMBEDDED_2PACK = "ATTACH_EMBEDDED_2PACK";
public static final String BACKGROUND_JOB_ALLOWED = "BACKGROUND_JOB_ALLOWED";
public static final String BACKGROUND_JOB_BY_DEFAULT = "BACKGROUND_JOB_BY_DEFAULT";
@ -133,6 +136,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE";
public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG";
public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE";
public static final String TRACE_ALL_TRX_CONNECTION_GET = "TRACE_ALL_TRX_CONNECTION_GET";
public static final String TWOPACK_COMMIT_DDL = "2PACK_COMMIT_DDL";
public static final String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
public static final String USE_EMAIL_FOR_LOGIN = "USE_EMAIL_FOR_LOGIN";
@ -199,10 +203,6 @@ public class MSysConfig extends X_AD_SysConfig
/** Cache */
private static CCache<String, String> s_cache = new CCache<String, String>(Table_Name, 40, 0, true);
public static final String AUTOMATIC_PACKIN_PROCESSING = "AUTOMATIC_PACKIN_PROCESSING";
public static final String AUTOMATIC_PACKIN_TIMEOUT = "AUTOMATIC_PACKIN_TIMEOUT";
public static final String AUTOMATIC_PACKIN_RETRIES = "AUTOMATIC_PACKIN_RETRIES";
/**
* Get system configuration property of type string
* @param Name

View File

@ -194,7 +194,7 @@ public class Trx
}
if (!isActive())
start();
if (MSysConfig.getBooleanValue("TRACE_ALL_TRX_CONNECTION_GET", false))
if (MSysConfig.getBooleanValue(MSysConfig.TRACE_ALL_TRX_CONNECTION_GET, false))
trace = new Exception();
return m_connection;
} // getConnection

View File

@ -77,6 +77,7 @@ public class OrderTest implements Runnable
for (int i = 0; i < m_numberOrders; i++)
{
Trx trx = Trx.get(Trx.createTrxName("Test" + m_no + "_" + i),true);
trx.setDisplayName(getClass().getName()+"_run");
trx.start();
//
MOrder order = new MOrder(Env.getCtx(),0,trx.getTrxName());

View File

@ -847,6 +847,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
String trxName = Trx.createTrxName("InfoPanelLoad:");
trx = Trx.get(trxName, true);
trx.setDisplayName(getClass().getName()+"_readLine");
m_pstmt = DB.prepareStatement(dataSql, trxName);
setParameters (m_pstmt, false); // no count
if (log.isLoggable(Level.FINE))

View File

@ -422,6 +422,7 @@ public class PaySelect
try {
trxName = Trx.createTrxName("PaySelect");
trx = Trx.get(trxName, true);
trx.setDisplayName(getClass().getName()+"_generatePaySelect");
String PaymentRule = paymentRule.getValue();

View File

@ -239,6 +239,7 @@ public class RunProcess extends TableFixture {
if (process.isJavaProcess() && !jasperreport)
{
Trx trx = Trx.get(Trx.createTrxName("FixturePrc"), true);
trx.setDisplayName(getClass().getName()+"_doStaticTable");
try
{
processOK = process.processIt(pi, trx);

View File

@ -97,6 +97,7 @@ public class SetDocAction extends TableFixture {
}
Trx trx = Trx.get(Trx.createTrxName("FixtureSetDocAction"), true);
trx.setDisplayName(getClass().getName()+"_doStaticTable");
gpo = table.getPO(recordID, trx.getTrxName());
if (gpo == null) {