From 16465643494d80614c6c3f36b61496fda227e7d6 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 21 Mar 2008 01:06:18 +0000 Subject: [PATCH] FR [1921784] --- base/src/org/compiere/util/Trx.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/base/src/org/compiere/util/Trx.java b/base/src/org/compiere/util/Trx.java index b643ca0df7..a9c3052090 100644 --- a/base/src/org/compiere/util/Trx.java +++ b/base/src/org/compiere/util/Trx.java @@ -19,6 +19,7 @@ package org.compiere.util; import java.beans.*; import java.rmi.RemoteException; import java.sql.*; +import java.util.Collection; import java.util.UUID; import java.util.logging.*; @@ -129,6 +130,8 @@ public class Trx implements VetoableChangeListener private String m_trxName = null; private boolean m_active = false; + private long m_startTime; + /** * Get Connection * @return connection @@ -202,9 +205,18 @@ public class Trx implements VetoableChangeListener startRemoteTransaction(); } m_active = true; + m_startTime = System.currentTimeMillis(); return true; } // startTrx + /** + * @return The start time of this transaction + */ + public Date getStartTime() + { + return new Date(m_startTime); + } + private void startRemoteTransaction() { Server server = CConnection.get().getServer(); try @@ -647,5 +659,16 @@ public class Trx implements VetoableChangeListener log.info(evt.toString()); } // vetoableChange + /** + * @return Trx[] + */ + public static Trx[] getActiveTransactions() + { + Collection collections = s_cache.values(); + Trx[] trxs = new Trx[collections.size()]; + collections.toArray(trxs); + + return trxs; + } } // Trx