Running JBoss 4.0.3 SP1
TimerTest.java
| package jadex.adapter.j2ee.examples.test;
|
| import javax.ejb.Remote;
|
| @Remote
| public interface TimerTest {
|
| public void run();
| }
|
TimerTestBean.java
| package jadex.adapter.j2ee.examples.test;
|
| import java.util.Properties;
|
| import javax.annotation.Resource;
| import javax.ejb.Stateless;
| import javax.ejb.TimedObject;
| import javax.ejb.Timeout;
| import javax.ejb.Timer;
| import javax.ejb.TimerService;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.TransactionAttributeType;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
|
| @Stateless
| public class TimerTestBean implements TimerTest, TimedObject {
|
| private static int counter = 0;
|
| @Resource
| private TimerService _timerService;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void run() {
| _timerService.createTimer(1000, counter++);
| }
|
| @Timeout
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void ejbTimeout(Timer timer) {
| int count = (Integer) timer.getInfo();
| System.out.println(count + ": Timer activated.");
|
| _timerService.createTimer(1000, counter++);
| System.out.println(count + ": new Timer created.");
|
| try {
| Thread.currentThread().sleep(5000);
| } catch (InterruptedException e) {
| }
|
| System.out.println(count + ": Timer ends.");
| }
|
| public static void main(String[] args) throws NamingException {
| Properties props = new Properties();
| props.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
| props.put("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
|
| InitialContext ctx = new InitialContext(props);
| TimerTest test = (TimerTest) ctx.lookup(TimerTest.class.getName());
| test.run();
| }
| }
|
>From my point of view every ejbTimeout() have to finish before another one can
>be fired. But JBoss fires the Timer, even the creation transaction has not
>committed yet.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919195#3919195
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3919195
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user