[JBoss jBPM] - How to persist the process state to DB before leaving each n
by parchana
Hi,
We have a JBPM process with multiple subprocesses, out of the subprocesses one process can run for number of days. Requirement is that we should persist the process state before leaving each and every node so that if JBoss server goes down in between the process can be re-triggered from the last executed state on server startup.
I have read that JBPM persist the process state on wait nodes and when jbpmContext.close() is called.
Now the problem is we have processes where there is no wait state and the requirement is state should get persisted even before jbpmContext.close(), so as to address recovery from fail-over on server shutdown.
I have tried with following configuration file and managing transactions manually -
<jbpm-configuration>
| <jbpm-context>
| <service name="persistence">
| <factory>
| <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
| <field name="isTransactionEnabled"><false/></field>
| </bean>
| </factory>
| </service>
| <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
| <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
| <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
| <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
| <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
| </jbpm-context>
| </jbpm-configuration>
|
Code for managing transaction is written in each ActionHandler as -
public class MyActionHandler implements ActionHandler{
|
| public void execute(ExecutionContext context) {
| Transaction tx = null;
| try {
| tx = context.getJbpmContext().getSession().beginTransaction();
| //business logic in the action
| if(tx!=null)
| tx.commit();
| context.leaveNode();
| }
| catch(Exception e) {
| logger.error("Error: ",e);
| }
| }
I can see an entry in jbpm_processInstance table after tx.commit() but when process fails in next node and I try to re-trigger the workflow from this last executed state - it says -
| org.jbpm.JbpmException: this token is locked by token[1063]
| at org.jbpm.graph.exe.Token.signal(Token.java:185)
| at org.jbpm.graph.exe.Token.signal(Token.java:140)
Can anyone please help me in this?
-Archana
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150584#4150584
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150584
18 years, 1 month
[JBoss AOP] - jboss-aop.xml is trying to apply an already existing method
by elysch
Hi again.
I do understand the meaning of the error i'm getting now:
2008-05-13 19:16:52,781 ERROR [STDERR] [warn] AOP Instrumentor failed to transform com.mitalteli.bolsaDeTrabajo.vo.VacanteVO
| 2008-05-13 19:16:52,781 ERROR [STDERR] java.lang.RuntimeException: Mixin com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO of pointcut jar:file:/C:/jboss-4.2.1.GA/server/default/tmp/deploy/tmp4165bolsaDeTrabajo-1.0-SNAPSHOT.ear-contents/bolsaDeTrabajo-aop-1.0-SNAPSHOT.aop!/META-INF/jboss-aop.xml7 is trying to apply an already existing methodgetRequisitos for class com.mitalteli.bolsaDeTrabajo.vo.VacanteVO
| ...
The problem is that I'm not doing it on purpose. I guess I don't know how to define introductions-mixins and aspects in the jboss-aop.xml file. I don't get it.
I did read the reference guide and the user manual, but I can't find out why it doesn't work. Maybe I'm skipping the exact paragraph that has the answer, I don't know.
I guess it is correct to define both a mixin to add attributes and method's that the class don't have and also an advice to modify the behavior of other already existing methods. Right?
The original class:
public class VacanteVO
| implements java.io.Serializable
| {
| /**
| * The serial version UID of this class. Needed for serialization.
| */
| private static final long serialVersionUID = -1038158559825459105L;
|
| public VacanteVO()
| {
| this.id = null;
| }
|
| public VacanteVO(java.lang.Long id)
| {
| this.id = id;
| }
|
| /**
| * Copies constructor from other VacanteVO
| *
| * @param otherBean, cannot be <code>null</code>
| * @throws java.lang.NullPointerException if the argument is <code>null</code>
| */
| public VacanteVO(VacanteVO otherBean)
| {
| this(otherBean.getId());
| }
|
| /**
| * Copies all properties from the argument value object into this value object.
| */
| public void copy(VacanteVO otherBean)
| {
| if (otherBean != null)
| {
| this.setId(otherBean.getId());
| }
| }
|
| private java.lang.Long id;
|
| /**
| *
| */
| public java.lang.Long getId()
| {
| return this.id;
| }
|
| public void setId(java.lang.Long id)
| {
| this.id = id;
| }
|
| }
The mixin interface:
public interface IAspectoVacanteVO {
|
| public java.lang.String getNombre();
| public void setNombre(java.lang.String nombre);
|
| public java.lang.String getRequisitos();
| public void setRequisitos(java.lang.String requisitos);
|
| public java.lang.String getDescripcion();
| public void setDescripcion(java.lang.String descripcion);
|
| public com.mitalteli.bolsaDeTrabajo.domain.VacanteHorario getHorario();
| public void setHorario(com.mitalteli.bolsaDeTrabajo.domain.VacanteHorario horario);
|
| public com.mitalteli.bolsaDeTrabajo.domain.RangoSueldo getSueldo();
| public void setSueldo(com.mitalteli.bolsaDeTrabajo.domain.RangoSueldo sueldo);
|
| public java.lang.String getContacto();
| public void setContacto(java.lang.String contacto);
|
| public com.mitalteli.bolsaDeTrabajo.domain.VacanteStatus getStatus();
| public void setStatus(com.mitalteli.bolsaDeTrabajo.domain.VacanteStatus status);
|
| public java.lang.Long getEmpresa();
| public void setEmpresa(java.lang.Long empresa);
| }
I won't put here the implementation since it compiles, and I don't think makes any difference. (Am I right?)
A jboss-aop.xml fragment:
<!-- **************************************************************************** -->
| <!-- INICIO: com.mitalteli.bolsaDeTrabajo.vo.VacanteVO -->
|
| <introduction class="com.mitalteli.bolsaDeTrabajo.vo.VacanteVO">
| <mixin>
| <interfaces>
| com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.IAspectoVacanteVO
| </interfaces>
| <class>com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO</class>
| <construction>new com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO(this)</construction>
| </mixin>
| </introduction>
|
| <aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO" scope="PER_VM"/>
| <bind pointcut="execution(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->new())">
| <advice name="constructorNoParamsAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
| </bind>
| <bind pointcut="execution(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->new(VacanteVO))">
| <advice name="constructorFromOtherAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
| </bind>
| <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->copy(VacanteVO))">
| <advice name="methodCopyAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
| </bind>
|
| <!-- FIN: com.mitalteli.bolsaDeTrabajo.vo.VacanteVO -->
VacanteVO is not used anywhere else, but, here (further down in jboss-aop.xml):
<aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase" scope="PER_VM"/>
| <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->toVacanteVO(com.mitalteli.bolsaDeTrabajo.domain.Vacante, com.mitalteli.bolsaDeTrabajo.vo.VacanteVO))">
| <advice name="methodToVacanteVOAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
| </bind>
| <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->vacanteVOToEntity(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO, com.mitalteli.bolsaDeTrabajo.domain.Vacante, boolean))">
| <advice name="methodVacanteVOToEntityAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
| </bind>
But in these cases it's only used as method parameter. That's the way they are defined in the original coding. It wouldn't be able to catch exactly that method if the pointcut binding is defined differently, right?
I'm getting the same error for another two classes in which I define a mixin and some advices. But there is one that it's not being reported as an error. I can't see any noticeable difference in the coding.
This is the one that is not being reported as an error:
<!-- **************************************************************************** -->
| <!-- INICIO: com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase -->
|
| <introduction class="com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase">
| <mixin>
| <interfaces>
| com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.IAspectoVacanteDaoBase
| </interfaces>
| <class>com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteDaoBase</class>
| <construction>new com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteDaoBase(this)</construction>
| </mixin>
| </introduction>
|
| <aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase" scope="PER_VM"/>
| <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->toVacanteVO(com.mitalteli.bolsaDeTrabajo.domain.Vacante, com.mitalteli.bolsaDeTrabajo.vo.VacanteVO))">
| <advice name="methodToVacanteVOAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
| </bind>
| <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->vacanteVOToEntity(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO, com.mitalteli.bolsaDeTrabajo.domain.Vacante, boolean))">
| <advice name="methodVacanteVOToEntityAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
| </bind>
|
| <!-- FIN: com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase -->
I hope someone knows what is happening.
Thank you all in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150573#4150573
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150573
18 years, 1 month
[Remoting] - Re: Memory leak in remoting objects
by ron.sigal@jboss.com
Hey Trustin,
I'm seeing something different. When I run
| for (int i = 0; i < 1000; i++)
| {
| Client client = new Client(clientLocator, clientConfig);
| client.connect();
| TestCallbackHandler callbackHandler = new TestCallbackHandler();
| client.addListener(callbackHandler, null, null, true);
| // client.removeListener(callbackHandler);
| client.disconnect();
| }
|
I get lots of BisocketClientInvokers and BisocketClientInvoker.PingTimerTasks hanging around. When I uncomment the client.removeListener() line, I see something different. In particular, I still see lots of BisocketClientInvokers hanging around, but the only reference to them is a java.lang.ref.Finalizer weak reference. For some reason, when I force a garbage collection in JProfiler, the garbage collector doesn't collect them. Maybe the program isn't running long enough to do a full garbage collection? When the program concludes (but stays alive in JProfiler) I can garbage collect all of the BisocketClientInvokers and PingTimerTasks.
What I just described happens in Windows with jdk 1.5. When I run the same program in linux, the garbage collector is willing to collect the old BisocketClientInvokers, even when the program is still running.
So it doesn't look like a real leak to me, as long as the program properly disposes of its connections. It looks more like an artifact of the garbage collector behavior.
-Ron
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150567#4150567
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150567
18 years, 1 month