BF [ 1757523 ] Server Processes are using Server's context
http://sourceforge.net/tracker/?func=detail&atid=879332&aid=1757523&group_id=176962
This commit is contained in:
parent
472b764885
commit
e38b3d9ef1
|
@ -20,6 +20,7 @@ import org.compiere.wf.MWorkflow;
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1757523 ]
|
||||||
*/
|
*/
|
||||||
public final class ProcessUtil {
|
public final class ProcessUtil {
|
||||||
|
|
||||||
|
@ -59,7 +60,12 @@ public final class ProcessUtil {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static boolean startJavaProcess(ProcessInfo pi, Trx trx) {
|
public static boolean startJavaProcess(ProcessInfo pi, Trx trx) {
|
||||||
|
return startJavaProcess(Env.getCtx(), pi, trx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean startJavaProcess(Properties ctx, ProcessInfo pi, Trx trx) {
|
||||||
String className = pi.getClassName();
|
String className = pi.getClassName();
|
||||||
//Get Class
|
//Get Class
|
||||||
Class processClass = null;
|
Class processClass = null;
|
||||||
|
@ -94,7 +100,7 @@ public final class ProcessUtil {
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
process.startProcess(Env.getCtx(), pi, trx);
|
process.startProcess(ctx, pi, trx);
|
||||||
if (trx != null)
|
if (trx != null)
|
||||||
{
|
{
|
||||||
trx.commit(true);
|
trx.commit(true);
|
||||||
|
|
|
@ -29,6 +29,8 @@ import org.compiere.util.*;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: MProcess.java,v 1.4 2006/07/30 00:58:04 jjanke Exp $
|
* @version $Id: MProcess.java,v 1.4 2006/07/30 00:58:04 jjanke Exp $
|
||||||
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1757523 ]
|
||||||
*/
|
*/
|
||||||
public class MProcess extends X_AD_Process
|
public class MProcess extends X_AD_Process
|
||||||
{
|
{
|
||||||
|
@ -333,7 +335,7 @@ public class MProcess extends X_AD_Process
|
||||||
{
|
{
|
||||||
log.info(pi.getClassName());
|
log.info(pi.getClassName());
|
||||||
|
|
||||||
return ProcessUtil.startJavaProcess(pi, trx);
|
return ProcessUtil.startJavaProcess(getCtx(), pi, trx);
|
||||||
} // startClass
|
} // startClass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ import org.compiere.wf.*;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
* - Added support for having description and parameter in one dialog
|
* - Added support for having description and parameter in one dialog
|
||||||
* - Added support to run db process remotely on server
|
* - Added support to run db process remotely on server
|
||||||
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1757523 ]
|
||||||
*/
|
*/
|
||||||
public class ProcessCtl implements Runnable
|
public class ProcessCtl implements Runnable
|
||||||
{
|
{
|
||||||
|
@ -615,7 +617,7 @@ public class ProcessCtl implements Runnable
|
||||||
// Run locally
|
// Run locally
|
||||||
if (!started && (!m_IsServerProcess || clientOnly ))
|
if (!started && (!m_IsServerProcess || clientOnly ))
|
||||||
{
|
{
|
||||||
return ProcessUtil.startJavaProcess(m_pi, m_trx);
|
return ProcessUtil.startJavaProcess(Env.getCtx(), m_pi, m_trx);
|
||||||
}
|
}
|
||||||
return !m_pi.isError();
|
return !m_pi.isError();
|
||||||
} // startProcess
|
} // startProcess
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.compiere.acct.*;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
import org.compiere.process.*;
|
import org.compiere.process.*;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.compiere.wf.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Server Bean.
|
* Adempiere Server Bean.
|
||||||
|
@ -60,6 +59,8 @@ import org.compiere.wf.*;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
* - Added remote transaction management
|
* - Added remote transaction management
|
||||||
* - Added support to run db process remotely on server
|
* - Added support to run db process remotely on server
|
||||||
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1757523 ]
|
||||||
*/
|
*/
|
||||||
public class ServerBean implements SessionBean
|
public class ServerBean implements SessionBean
|
||||||
{
|
{
|
||||||
|
@ -257,7 +258,7 @@ public class ServerBean implements SessionBean
|
||||||
String trxName = pi.getTransactionName();
|
String trxName = pi.getTransactionName();
|
||||||
if (trxName == null) trxName = Trx.createTrxName("ServerPrc");
|
if (trxName == null) trxName = Trx.createTrxName("ServerPrc");
|
||||||
Trx trx = Trx.get(trxName, true);
|
Trx trx = Trx.get(trxName, true);
|
||||||
ProcessUtil.startJavaProcess(pi, trx);
|
ProcessUtil.startJavaProcess(ctx, pi, trx);
|
||||||
return pi;
|
return pi;
|
||||||
} // process
|
} // process
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue