BF [ 1801842 ] DB connection fix & improvements for concurrent threads
* error when try to manage a WF activity
This commit is contained in:
parent
fb081de3ff
commit
3486276cbd
|
@ -291,7 +291,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
|||
{
|
||||
if (m_audit != null)
|
||||
return m_audit;
|
||||
MWFEventAudit[] events = MWFEventAudit.get(getCtx(), getAD_WF_Process_ID(), getAD_WF_Node_ID());
|
||||
MWFEventAudit[] events = MWFEventAudit.get(getCtx(), getAD_WF_Process_ID(), getAD_WF_Node_ID(), get_TrxName());
|
||||
if (events == null || events.length == 0)
|
||||
m_audit = new MWFEventAudit(this);
|
||||
else
|
||||
|
@ -1557,7 +1557,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
|||
{
|
||||
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.DateTime);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
MWFEventAudit[] events = MWFEventAudit.get(getCtx(), getAD_WF_Process_ID());
|
||||
MWFEventAudit[] events = MWFEventAudit.get(getCtx(), getAD_WF_Process_ID(), get_TrxName());
|
||||
for (int i = 0; i < events.length; i++)
|
||||
{
|
||||
MWFEventAudit audit = events[i];
|
||||
|
|
|
@ -27,17 +27,34 @@ import org.compiere.util.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MWFEventAudit.java,v 1.3 2006/07/30 00:51:06 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1801842 ] DB connection fix & improvements for concurrent threads
|
||||
*/
|
||||
public class MWFEventAudit extends X_AD_WF_EventAudit
|
||||
{
|
||||
/**
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @param AD_WF_Node_ID optional node
|
||||
* @return event audit or null
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @param AD_WF_Node_ID optional node
|
||||
* @return event audit or null
|
||||
* @deprecated Deprecated since 3.4.0. Use instead {@link #get(Properties, int, int, String)}
|
||||
*/
|
||||
public static MWFEventAudit[] get (Properties ctx, int AD_WF_Process_ID, int AD_WF_Node_ID)
|
||||
{
|
||||
return get(ctx, AD_WF_Process_ID, AD_WF_Node_ID, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @param AD_WF_Node_ID optional node
|
||||
* @param trxName
|
||||
* @return event audit or null
|
||||
*/
|
||||
public static MWFEventAudit[] get (Properties ctx, int AD_WF_Process_ID, int AD_WF_Node_ID, String trxName)
|
||||
{
|
||||
ArrayList<MWFEventAudit> list = new ArrayList<MWFEventAudit>();
|
||||
String sql = "SELECT * FROM AD_WF_EventAudit "
|
||||
|
@ -46,32 +63,24 @@ public class MWFEventAudit extends X_AD_WF_EventAudit
|
|||
sql += " AND AD_WF_Node_ID=?";
|
||||
sql += " ORDER BY AD_WF_EventAudit_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, AD_WF_Process_ID);
|
||||
if (AD_WF_Node_ID > 0)
|
||||
pstmt.setInt (2, AD_WF_Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MWFEventAudit (ctx, rs, null));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
list.add (new MWFEventAudit (ctx, rs, trxName));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
finally {
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
//
|
||||
MWFEventAudit[] retValue = new MWFEventAudit[list.size()];
|
||||
|
@ -80,14 +89,27 @@ public class MWFEventAudit extends X_AD_WF_EventAudit
|
|||
} // get
|
||||
|
||||
/**
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @return event audit or null
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @return event audit or null
|
||||
* @deprecated Deprecated since 3.4.0. Use instead {@link #get(Properties, int, String)}
|
||||
*/
|
||||
public static MWFEventAudit[] get (Properties ctx, int AD_WF_Process_ID)
|
||||
{
|
||||
return get(ctx, AD_WF_Process_ID, 0);
|
||||
return get(ctx, AD_WF_Process_ID, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Event Audit for node
|
||||
* @param ctx context
|
||||
* @param AD_WF_Process_ID process
|
||||
* @param trxName
|
||||
* @return event audit or null
|
||||
*/
|
||||
public static MWFEventAudit[] get (Properties ctx, int AD_WF_Process_ID, String trxName)
|
||||
{
|
||||
return get(ctx, AD_WF_Process_ID, 0, trxName);
|
||||
} // get
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue