IDEMPIERE-4679 SvrProcess: ensure unlock and flushBufferLog happens after transaction commit and close (#560)
This commit is contained in:
parent
c5c08a8b87
commit
4009c9c8ca
|
@ -39,6 +39,7 @@ import org.compiere.util.DB;
|
|||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.TrxEventListener;
|
||||
import org.osgi.service.event.Event;
|
||||
|
||||
/**
|
||||
|
@ -176,15 +177,39 @@ public abstract class SvrProcess implements ProcessCall
|
|||
m_trx.close();
|
||||
m_trx = null;
|
||||
m_pi.setTransactionName(null);
|
||||
|
||||
unlock();
|
||||
|
||||
// outside transaction processing [ teo_sarca, 1646891 ]
|
||||
postProcess(!m_pi.isError());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Event eventPP = sendProcessEvent(IEventTopics.POST_PROCESS);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_trx.addTrxEventListener(new TrxEventListener() {
|
||||
|
||||
unlock();
|
||||
@Override
|
||||
public void afterRollback(Trx trx, boolean success) {
|
||||
}
|
||||
|
||||
// outside transaction processing [ teo_sarca, 1646891 ]
|
||||
postProcess(!m_pi.isError());
|
||||
@Override
|
||||
public void afterCommit(Trx trx, boolean success) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Event eventPP = sendProcessEvent(IEventTopics.POST_PROCESS);
|
||||
@Override
|
||||
public void afterClose(Trx trx) {
|
||||
unlock();
|
||||
|
||||
// outside transaction processing [ teo_sarca, 1646891 ]
|
||||
postProcess(!m_pi.isError());
|
||||
@SuppressWarnings("unused")
|
||||
Event eventPP = sendProcessEvent(IEventTopics.POST_PROCESS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Thread.currentThread().setContextClassLoader(contextLoader);
|
||||
}
|
||||
|
@ -245,8 +270,23 @@ public abstract class SvrProcess implements ProcessCall
|
|||
if(msg != null && msg.startsWith("@Error@"))
|
||||
success = false;
|
||||
|
||||
if (success)
|
||||
flushBufferLog();
|
||||
if (success) {
|
||||
m_trx.addTrxEventListener(new TrxEventListener() {
|
||||
@Override
|
||||
public void afterRollback(Trx trx, boolean success) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCommit(Trx trx, boolean success) {
|
||||
if (success)
|
||||
flushBufferLog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterClose(Trx trx) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Parse Variables
|
||||
msg = Msg.parseTranslation(m_ctx, msg);
|
||||
|
|
Loading…
Reference in New Issue