IDEMPIERE-4759 Method to create Trx with other Connection (FHCA-2544) (#654)
This commit is contained in:
parent
355ef166f1
commit
4de94e3d21
|
@ -81,6 +81,27 @@ public class Trx
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Transaction in a Connection
|
||||||
|
* @param trxName trx name
|
||||||
|
* @param createNew if false, null is returned if not found
|
||||||
|
* @param con Connection
|
||||||
|
* @return Transaction or null
|
||||||
|
*/
|
||||||
|
public static Trx get (String trxName, boolean createNew, Connection con)
|
||||||
|
{
|
||||||
|
if (trxName == null || trxName.length() == 0)
|
||||||
|
throw new IllegalArgumentException ("No Transaction Name");
|
||||||
|
|
||||||
|
Trx retValue = (Trx)s_cache.get(trxName);
|
||||||
|
if (retValue == null && createNew)
|
||||||
|
{
|
||||||
|
retValue = new Trx (trxName, con);
|
||||||
|
s_cache.put(trxName, retValue);
|
||||||
|
}
|
||||||
|
return retValue;
|
||||||
|
} // get
|
||||||
|
|
||||||
/** Transaction Cache */
|
/** Transaction Cache */
|
||||||
private static final Map<String,Trx> s_cache = new ConcurrentHashMap<String, Trx>();
|
private static final Map<String,Trx> s_cache = new ConcurrentHashMap<String, Trx>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue