[jBPM] - Fork and join , bug ?
by Hamel Camille
Hamel Camille [http://community.jboss.org/people/chamel] created the discussion
"Fork and join , bug ?"
To view the discussion, visit: http://community.jboss.org/message/554844#554844
--------------------------------------------------------------
Hi ,
I'm a newbie in the jbpm world,
I'm developing a sample process to evaluate Jbpm (4.4 ) but i encounter a lock in my process : i enter a fork ( parallel gateway ) , in this fork , one of the branches has an decision ( XOR Gate ) with 2 branches , and then , every branch goes back to a join.
The problem is that the XOR branches generate a lock on that join , what would be the appropriate solution ?
Here's my jpdl :
> <?xml version="1.0" encoding="UTF-8"?>
> <process name="arriveDepart" xmlns=" http://jbpm.org/4.4/jpdl http://jbpm.org/4.4/jpdl">
> <swimlane candidate-users="alex,mike,${login}" name="Manager"/>
> <swimlane candidate-users="mary" name="Logistique"/>
> <swimlane candidate-users="mary" name="SI-DRI"/>
> <swimlane candidate-users="mary" name="DSEM"/>
> <swimlane candidate-users="mary" name="I-net"/>
>
>
>
> <start form="org/laposte/jbpm/start.html" g="322,16,48,52" name="start1">
> <transition name="to exclusive1" to="exclusive1" g="-68,-18"/>
> </start>
>
> <task form="org/laposte/jbpm/SaisieidRH.html" g="228,184,92,52" name="Saisie idRH" swimlane="Logistique">
> <transition to="join5"/>
> </task>
> <fork g="322,348,48,52" name="fork1">
> <transition to="Saisie badge"/>
> <transition to="Installation poste"/>
> <transition to="Activation i-net"/>
> </fork>
> <task form="org/laposte/jbpm/Saisiebadge.html" g="176,432,92,52" name="Saisie badge" swimlane="Logistique">
> <transition to="join1"/>
> </task>
> <task form="org/laposte/jbpm/Installationposte.html" g="300,432,92,52" name="Installation poste" swimlane="DSEM">
> <transition to="join1"/>
> </task>
> <task form="org/laposte/jbpm/activationI-net.html" g="424,432,92,52" name="Activation i-net" swimlane="I-net">
> <transition to="Création AD"/>
> </task>
> <task form="org/laposte/jbpm/creationAD.html" g="424,516,92,52" name="Création AD" swimlane="DSEM">
> <transition to="exclusive3"/>
> </task>
> <decision g="424,600,92,52" name="exclusive3">
> <transition g="-120,-18" name="to Decision prolongation" to="join1"/>
> <transition to="Liaison PSNEXT">
> <condition expr="#{psnext=="true"}"/>
> </transition>
> </decision>
>
> <task form="org/laposte/jbpm/Liaisonpsnext.html" g="480,699,92,52" name="Liaison PSNEXT" swimlane="SI-DRI">
> <transition g="-120,-18" name="to Decision prolongation" to="join1"/>
> </task>
> <join g="279,848,92,52" name="join1">
> <transition to="Decision prolongation"/>
> </join>
> <task form="org/laposte/jbpm/decisionprolongation.html" g="279,932,92,52" name="Decision prolongation" swimlane="Manager">
> <transition to="exclusive2"/>
> </task>
> <decision g="140,1314,92,52" name="exclusive5">
> <transition to="Document PSNEXT">
> <condition expr="#{psnext=="true"}"/>
> </transition>
> <transition g="-41,-18" name="to join4" to="join4"/>
> </decision>
> <fork g="162,1096,92,52" name="fork2">
> <transition to="exclusive5"/>
> <transition to="Prolongation badge"/>
> </fork>
> <task form="org/laposte/jbpm/documentpsnext.html" g="27,1237,92,52" name="Document PSNEXT" swimlane="Manager">
> <transition to="Prolongation PSNEXT"/>
> </task>
> <task form="org/laposte/jbpm/prolongationpsnext.html" g="-2,1157,92,52" name="Prolongation PSNEXT" swimlane="SI-DRI">
> <transition g="-41,-18" name="to join4" to="join4"/>
> </task>
> <task form="org/laposte/jbpm/prolongationbadge.html" g="113,1040,92,52" name="Prolongation badge" swimlane="Logistique">
> <transition to="join4"/>
> </task>
> <join g="410,1096,92,52" name="join2">
> <transition to="Suppression AD"/>
> <transition to="Editions documents"/>
> <transition to="Reprise badge"/>
> <transition to="Enlevement poste"/>
> </join>
> <task g="435,1185,92,52" name="Suppression AD" swimlane="DSEM">
> <transition to="join3"/>
> </task>
> <task g="283,1203,92,52" name="Editions documents" swimlane="Manager">
> <transition to="Suppression services i-net"/>
> <transition to="exclusive7"/>
> </task>
> <task g="534,1180,92,52" name="Reprise badge" swimlane="Logistique">
> <transition to="join3"/>
> </task>
> <task g="358,1403,92,52" name="Suppression PSNEXT" swimlane="SI-DRI">
> <transition to="join8"/>
> </task>
> <decision g="308,1285,92,52" name="exclusive7">
> <transition to="Suppression PSNEXT">
> <condition expr="#{psnext=="true"}"/>
> </transition>
> <transition to="join8"/>
> </decision>
> <task g="381,1274,92,52" name="Suppression services i-net" swimlane="I-net">
> <transition to="join3"/>
> </task>
> <task g="658,1180,92,52" name="Enlevement poste" swimlane="DSEM">
> <transition to="join3"/>
> </task>
> <join g="505,1512,48,52" name="join3">
> <transition to="end1"/>
> </join>
> <end g="505,1596,48,52" name="end1"/>
> <join g="60,967,92,52" name="join4">
> <transition g="-120,-18" name="to Decision prolongation" to="Decision prolongation"/>
> </join>
> <decision g="301,1016,48,48" name="exclusive2">
> <transition to="fork2">
> <condition expr="#{prolongation=="true"}"/>
> </transition>
> <transition to="join2"/>
> </decision>
> <join g="322,268,48,48" name="join5">
> <transition to="fork1"/>
> </join>
> <join g="287,1483,48,48" name="join8">
> <transition to="join3"/>
> </join>
> <decision name="exclusive1" g="333,121,48,48">
> <transition to="Saisie idRH">
> <condition expr="#{idrh==""}"/>
> </transition>
> <transition to="join5">
> </transition>
> </decision>
> </process>
( the lock is on join1 )
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/554844#554844]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 5 months
Re: [jboss-user] [JBoss Tools Development] - Portlet Development is Effectively Unusable in JBoss Tools
by Max Andersen
Max Andersen [http://community.jboss.org/people/max.andersen%40jboss.com] replied to the discussion
"Portlet Development is Effectively Unusable in JBoss Tools"
To view the discussion, visit: http://community.jboss.org/message/554816#554816
--------------------------------------------------------------
Hi Robert,
You really are having a bad week; lets see if I can make your week better ;)
1) Wizard not recognizing your portlet runtime. As said above, if you say you got a portlet runtime installed that we don't recognize then *please* open a jira with the details of what version and name of the Portlet container you used and what version of jboss tools so we can investigate. Our jira is at http://jira.jboss.org/browse/JBIDE http://jira.jboss.org/browse/JBIDE Without that information my team can't really help since our test shows multiple version of JBoss Portal, GateIn and EPP as being recognized - of course our tests can't cover all combinations that you as an user might do but we can fix this but to know where to start looking please open jira with portal name and version.
2) User libraries - I haven't seen the portal *force* me to select a user library; it should only be warning you that if you continue there are probably going to be compile errors since there is no located runtime (see #1). Note, if Portal is *forcing* you to select a runtime and not allowing you to continue then that is a bug and please report that in jira.
3) Eclipse Facet are supposed to provide this kind of dependency automatically - that is partly true, but how do you expect the portlet facet to provide the runtime dependencies when it is not finding it ? (see #1). If we were to shove down on you a specific jboss portlet version distributed together with jboss tools then we would really be giving you vendor lockin and really bad dependency management (see http://relation.to/Bloggers/NavelgazingClasspathContainersAnEclipseAntiPa... this for background).
4) I opened https://jira.jboss.org/browse/JBIDE-6719 https://jira.jboss.org/browse/JBIDE-6719 and Snjezana came back answering:
There are the following JBoss Portlet Runtimes:
- JBoss Portal 2.x bundled with JBOss AS 4.x
- GateIn Portal 3.x bundled with JBoss AS 5.1
- JBoss Portlet Container 2.0 bundled with JBoss AS 4.2 and Tomcat
- GateIn Portlet Container 2.1 bundled with JBoss AS 4.2, JBoss AS 5.1 and Tomcat
- EPP
The Portlet engine recognizes all these containers except GateIn Portlet Container bundled with JBoss AS 5.1. This server has a different name for simple-portal directory (simple-portal.sar instead of simple-portal).
Can you confirm you are using GateIn Portal 3.x bundled with AS 5.1 ?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/554816#554816]
Start a new discussion in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 5 months
[EJB 3.0] - EJB3.1 in JBoss AS 6.0.0.M4
by Carlo de Wolf
Carlo de Wolf [http://community.jboss.org/people/wolfc] modified the document:
"EJB3.1 in JBoss AS 6.0.0.M4"
To view the document, visit: http://community.jboss.org/docs/DOC-15643
--------------------------------------------------------------
h5. Overview
JBoss AS 6.0.0.M4 introduces support for EJB3.1 Timer Service and EJB3.1 Asynchronous invocations.
h5. What to download and how to use
You can download JBoss AS 6.0.0.M4 from http://www.jboss.org/jbossas/downloads.html here. After downloading the AS, start and stop it once to make sure it boots without any issues.
In the next steps we will see a simple EJB3.1 timerservice example (mainly the calendar expression support)
h5. EJB3.1 Timer Service:
Note that the examples shown below are just for the sake of illustrating the usage of timerservice API and as such don't hold much meaning.
Let's deploy a very simple stateless session bean which exposes a remote business interface view
package org.jboss.ejb3.timerservice.example;
public interface SchedulerOps
{
/**
* Schedules a timer for the passed schedule *
* @param schedule The calendar expression based schedule
*
*
*/
void scheduleTask(ScheduleExpression schedule);
}
package org.jboss.ejb3.timerservice.example;
import java.util.Date;
import javax.annotation.Resource;
import javax.ejb.Remote;
import javax.ejb.ScheduleExpression;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerConfig;
import javax.ejb.TimerService;
import org.jboss.ejb3.annotation.RemoteBinding;
@Stateless
@Remote (SchedulerOps.class)
@RemoteBinding (jndiBinding = "myscheduler")
public class Scheduler implements SchedulerOps
{
@Resource
private TimerService timerService;
@Override
public void scheduleTask(ScheduleExpression schedule)
{
// Use the injected timerservice to create a timer instance,
// for the passed schedule
Timer timer = this.timerService.createCalendarTimer(calendarSchedule);
// that's it, we are done. When the scheduled timeout occurs, the
// timeout callback method on this bean will be invoked by the server
}
/**
* This timeout callback method will be invoked when the timer schedule
* expires
*
* @param timer The {@link Timer} for which the timeout occurred
*/
@Timeout
private void timeout(Timer timer)
{
// Let's just print out to System.out
System.out.println("Timeout method invoked at " + new Date() + " for bean " + this.getClass().getSimpleName());
}
}
In the example above, we have a SchedulerOps interface which is exposed as the remote view for the Scheduler Stateless session bean. The SchedulerOps interface allows scheduling timers based on a javax.ejb.ScheduleExpression. ScheduleExpression is used to express calendar based timeout expressions. Later in this wiki, we'll see how we create a calendar based schedule.
In order to create and operate on timers, we are injecting the TimerService into the bean, through the use of @javax.annotation.Resource annotation:
@Resource
private TimerService timerService;
The important scheduleTask method looks like this:
@Override
public void scheduleTask(ScheduleExpression schedule)
{
// Use the injected timerservice to create a timer instance,
// for the passed schedule
Timer timer = this.timerService.createCalendarTimer(calendarSchedule);
// that's it, we are done. When the scheduled timeout occurs, the
// timeout callback method on this bean will be invoked by the server
}
We use the injected timerservice to create a calendar timer. A calendar timer is a Timer which is created based on a calendar schedule expression.
Please refer to the EJB3.1 spec for more details on ScheduleExpression.
For example, if we want to schedule a timer to fire every Friday at 5:45 in the morning, then we can create the following ScheduleExpression:
ScheduleExpression everyFridayFiveFortyFive = new ScheduleExpression();
everyFridayFiveFortyFive.dayOfWeek("Fri").hour(5).minute(45);
Now that we created a timer in our bean, the timer will be started after the bean's method completes(remember, timers are transactional, so the timer start waits for the transaction to complete). When the schedulded timeout occur, the server will invoke the timeout callback method on the bean. In our example, we have annotated our timeout() method as the timeout callback method (note the @Timeout annotation):
/**
* This timeout callback method will be invoked when the timer schedule
* expires
*
* @param timer The {@link Timer} for which the timeout occurred
*/
@Timeout
private void timeout(Timer timer)
{
// Let's just print out to System.out
System.out.println("Timeout method invoked at " + new Date() + " for bean " + this.getClass().getSimpleName());
}
Here's how the client code is going to schedule the timer through the bean:
package org.jboss.ejb3.timerservice.example.client;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.ejb3.timerservice.example.*;
public class Client
{
public static void main(String[] args) throws Exception
{
Context ctx = new InitialContext();
// lookup the bean
SchedulerOps scheduler = (SchedulerOps) ctx.lookup("myscheduler");
// create a schedule
// Every Tue at 2 and 4 in the afternoon during the month of August
ScheduleExpression everyTueAtTwoAndFourInNoonDuringAugust = new ScheduleExpression();
everyTueAtTwoAndFourInNoonDuringAugust.dayOfMonth("Tue").hour("14,16").month("Aug");
// schedule our task
scheduler.scheduleTask(everyTueAtTwoAndFourInNoonDuringAugust);
}
}
In the client code, we first lookup the SchedulerOps remote business view of the bean. Then we create a calendar schedule which is expected to expire every Tuesday at 2 and 4 in the noon during the month of August. We then invoke the scheduleTask method on the bean. That's it! When the scheduled timeout occurs, you will see the timeout() method on the bean being called.
h5. Auto timers
In the above example, we used a remote business view and a method on that interface just to create a timer. That can be avoided if we use auto timers. Auto timers are created automatically by the EJB container when a bean is deployed. The container looks for the presence of @javax.ejb.Schedule or @javax.ejb.Schedules (or their xml equivalents) to decide whether auto timers are to be created.
Here's an example of the same (using annotations):
package org.jboss.ejb3.timerservice.example;
import javax.ejb.Schedule;
import javax.ejb.ScheduleExpression;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerConfig;
import javax.ejb.TimerService;
import javax.naming.Context;
import javax.naming.InitialContext;
@Stateless
public class AutoTimerBean
{
/**
* This method will be invoked every day at 5:00:00 in the morning
* @param timer The timer instance
*/
@Schedule (hour = "5")
private void executeEveryDayAtFive(Timer timer)
{
// do some task here.
System.out.println("Auto-timer method invoked at " + new Date() + " for bean " + this.getClass().getSimpleName());
}
}
As you can see we have a Stateless (no-interface view) bean which has the executeEveryDayAtFive method. This method is annotated with @Schedule. The server will automatically create the timer when the bean is deployed. The schedule for the timer is passed through the annotation's attribute values. The method on which the @Schedule is used, will be considered the timeout callback method for that auto timer and will be invoked when the timeout occurs.
The example above creates an auto timer which is expected to fire every day at 5 in the morning.
Let's quickly see the use of @javax.ejb.Schedules (note the 's' in the end of that annotation name). That allows you to create multiple auto timers with different schedules for the same timeout callback method.
/**
* Multiple auto timers with different schedules will be created for this
* timeout callback method
* @param timer The timer instance
*/
@Schedules (
{
@Schedule(hour="8", minute="15"),
@Schedule(dayOfMonth="Mon", info="test")
}
)
private void multiAutoTimeoutMethod(Timer timer)
{
// do some task here. for now, let's just print out to System.out
System.out.println("Multi auto-timeout method invoked at " + new Date() + " for timer " + timer);
}
In this example above, we have used @Schedules to create 2 auto timers, each with a different schedule. Note that you can even pass an optional "info" to the created timers. That info will be available through the javax.ejb.Timer in the timeout callback method. In this example, multiAutoTimeoutMethod method will be invoked when either of the scheduled timeout occurs.
h5. What next?
Those were just some examples on EJB3.1 timerservice to get you started. Download http://www.jboss.org/jbossas/downloads.html JBossAS 6.0.0.M4 and try out your own application and/or examples and let us know how it goes. If you run into any issues, feel free to start a discussion in our http://community.jboss.org/community/ejb3 EJB3 user forum or ping us on http://www.jboss.org/ejb3/chat.html IRC.
h5. I have some tutorial for singleton beans, Can I contribute?
Similar to our other EJB3 tutorials, we are going to include a tutorial for EJB3.1 Timer Service. Infact, the example that is posted here in the wiki, can perhaps be just added as a tutorial in SVN. If anyone of you wants to contribute a different tutorial and a chapter in our guide, then feel free to let us know - either through the forums or IRC.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15643]
Create a new document in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 5 months