[jboss-cvs] JBossAS SVN: r101818 - in branches/JBPAPP_4_2_0_GA_CP/ejb3: src/main/org/jboss/ejb3 and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 4 07:45:20 EST 2010


Author: wolfc
Date: 2010-03-04 07:45:19 -0500 (Thu, 04 Mar 2010)
New Revision: 101818

Added:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/TimerTxRegistrationInterceptor.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskBean.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskRemote.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/TimerRollbackUnitTestCase.java
Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/EJBContainerInvocation.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml
Log:
JBPAPP-2811: register timer with the current transaction

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2010-03-04 12:45:19 UTC (rev 101818)
@@ -2305,6 +2305,13 @@
 		</jar>
 	</target>
 
+   <target name="jbpapp2811"
+      description="Builds a simple jar files."
+      depends="compile-classes">
+
+      <build-simple-jar name="jbpapp2811"/>
+   </target>
+
 	<target name="jaxws"
       description="Builds a simple jar."
       depends="compile-classes">
@@ -4096,6 +4103,7 @@
       jbpapp1668,
       jbpapp1951,
       jbpapp2260,
+      jbpapp2811,
       jbas4489, epcpropagation, jaccpropagation, 
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
       pkg, securitydomain, enventry, externalpersistenceunit,
@@ -4785,6 +4793,9 @@
 		<antcall target="test" inheritRefs="true">
 			<param name="test" value="jbpapp2260"/>
 		</antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="jbpapp2811"/>
+      </antcall>
 	</target>
 
 	<target name="entity-tests" depends="init" description="Execute all tests">

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/EJBContainerInvocation.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/EJBContainerInvocation.java	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/EJBContainerInvocation.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb3;
 
-import java.lang.reflect.Method;
 import org.jboss.aop.Advisor;
 import org.jboss.aop.MethodInfo;
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 
+import javax.ejb.Timer;
+import java.lang.reflect.Method;
+
 /**
  * Representation of an EJB invocation on the serverside
  *
@@ -41,6 +43,9 @@
    protected T ctx;
    private BeanContextLifecycleCallback<T> callback;
 
+   // set if it's a timer callback
+   private Timer timer;
+
    public EJBContainerInvocation(MethodInfo info)
    {
       super(info, info.getInterceptors());
@@ -85,6 +90,11 @@
       }
    }
 
+   public Timer getTimer()
+   {
+      return timer;
+   }
+
    public Invocation getWrapper(Interceptor[] newchain)
    {
       return new EJBContainerInvocationWrapper<A, T>(this, newchain);
@@ -106,4 +116,9 @@
    {
       this.callback = callback;
    }
+
+   public void setTimer(Timer timer)
+   {
+      this.timer = timer;
+   }
 }

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -24,30 +24,36 @@
 import org.jboss.annotation.ejb.ResourceAdapter;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.MethodInfo;
-import org.jboss.aop.advice.Interceptor;
 import org.jboss.deployment.DeploymentException;
-import org.jboss.ejb3.*;
-import org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3Module;
+import org.jboss.ejb3.ProxyFactoryHelper;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
 import org.jboss.ejb3.jms.JMSDestinationFactory;
+import org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory;
 import org.jboss.ejb3.timerservice.TimedObjectInvoker;
 import org.jboss.ejb3.timerservice.TimerServiceFactory;
 import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ActivationConfigPropertyMetaData;
 
-import javax.ejb.*;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJBException;
 import javax.ejb.Timer;
-import javax.jms.*;
+import javax.ejb.TimerService;
+import javax.jms.Destination;
 import javax.jms.Queue;
+import javax.jms.Topic;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.naming.Context;
-import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Map;
 
 /**
  * @version <tt>$Revision$</tt>
@@ -241,17 +247,27 @@
 
    public Object localInvoke(Method method, Object[] args) throws Throwable
    {
+      return localInvoke(method, args, null);
+   }
+
+   protected Object localInvoke(Method method, Object[] args, Timer timer) throws Throwable
+   {
       MethodInfo info = getMethodInfo(method);
       if (info == null)
       {
          throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
       }
-      return localInvoke(info, args);
+      return localInvoke(info, args, timer);
 
    }
 
    public Object localInvoke(MethodInfo info, Object[] args) throws Throwable
-   {     
+   {
+      return localInvoke(info, args, null);
+   }
+
+   public Object localInvoke(MethodInfo info, Object[] args, Timer timer) throws Throwable
+   {
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
       pushEnc();
       try
@@ -259,6 +275,7 @@
          EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
          nextInvocation.setAdvisor(this);
          nextInvocation.setArguments(args);
+         nextInvocation.setTimer(timer);
          return nextInvocation.invokeNext();
       }
       finally
@@ -286,7 +303,7 @@
       Object[] args = {timer};
       try
       {
-         localInvoke(timeout, args);
+         localInvoke(timeout, args, timer);
       }
       catch (Throwable throwable)
       {

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -99,7 +99,7 @@
       AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
       try
       {
-         localInvoke(timeout, args);
+         localInvoke(timeout, args, null, timer);
       }
       catch(Throwable throwable)
       {
@@ -282,6 +282,11 @@
     */
    public Object localInvoke(Method method, Object[] args, FutureHolder provider) throws Throwable
    {
+      return localInvoke(method, args, provider, null);
+   }
+
+   protected Object localInvoke(Method method, Object args[], FutureHolder provider, Timer timer) throws Throwable
+   {
       long start = System.currentTimeMillis();
       
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
@@ -299,6 +304,7 @@
          EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
          nextInvocation.setAdvisor(this);
          nextInvocation.setArguments(args);
+         nextInvocation.setTimer(timer);
 
          nextInvocation = populateInvocation(nextInvocation);
 

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -150,6 +150,7 @@
             EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
             nextInvocation.setAdvisor(this);
             nextInvocation.setArguments(args);
+            nextInvocation.setTimer(timer);
             nextInvocation.invokeNext();
          }
          catch (Throwable throwable)

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/TimerTxRegistrationInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/TimerTxRegistrationInterceptor.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/TimerTxRegistrationInterceptor.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -0,0 +1,40 @@
+package org.jboss.ejb3.timer;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.aop.AbstractInterceptor;
+import org.jboss.tm.TransactionManagerLocator;
+
+import javax.ejb.Timer;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * Make sure we register a timer into the current transaction.
+ * 
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class TimerTxRegistrationInterceptor extends AbstractInterceptor
+{
+   private TransactionManager tm;
+
+   public TimerTxRegistrationInterceptor()
+   {
+      tm = TransactionManagerLocator.getInstance().locate();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      return invoke((EJBContainerInvocation) invocation);
+   }
+
+   public Object invoke(EJBContainerInvocation invocation) throws Throwable
+   {
+      Transaction tx = tm.getTransaction();
+      Timer timer = invocation.getTimer();
+      if(tx != null && (timer instanceof Synchronization))
+         tx.registerSynchronization((Synchronization) timer);
+      return invocation.invokeNext();
+   }
+}


Property changes on: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/timer/TimerTxRegistrationInterceptor.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml	2010-03-04 12:27:54 UTC (rev 101817)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/ejb3-interceptors-aop.xml	2010-03-04 12:45:19 UTC (rev 101818)
@@ -85,7 +85,9 @@
    <interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
    <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
    <interceptor factory="org.jboss.ejb3.connectionmanager.CachedConnectionInterceptorFactory" scope="PER_CLASS"/>
-    <interceptor class="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor" scope="PER_VM"/>
+   <interceptor class="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor" scope="PER_VM"/>
+   <interceptor class="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor" scope="PER_VM"/>
+   
    <domain name="Stateless Bean">
       <bind pointcut="execution(public * *->*(..))">
          <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
@@ -106,6 +108,7 @@
          <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
          <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.connectionmanager.CachedConnectionInterceptorFactory"/>
@@ -135,6 +138,7 @@
          <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
          <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.connectionmanager.CachedConnectionInterceptorFactory"/>
@@ -293,6 +297,7 @@
          <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3TCCLInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.mdb.MDBInstanceInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>         
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.connectionmanager.CachedConnectionInterceptorFactory"/>
@@ -310,6 +315,7 @@
       <bind pointcut="execution(public * *->*(..))">
          <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
       </bind>
@@ -342,6 +348,7 @@
       <bind pointcut="execution(public * *->*(..))">
          <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
       </bind>
@@ -368,6 +375,7 @@
       <bind pointcut="execution(public * *->*(..))">
          <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.timer.TimerTxRegistrationInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
          <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
       </bind>

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskBean.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.jbpapp2811;
+
+import org.jboss.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import java.util.Date;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Stateless
+public class TimerTaskBean implements TimerTaskRemote
+{
+   private static final Logger log = Logger.getLogger(TimerTaskBean.class);
+   
+   // これは不適当である。
+   private static AtomicInteger timeouts = new AtomicInteger(0);
+
+   @Resource
+   private SessionContext ctx;
+
+   @Resource
+   private TimerService timerService;
+
+   public int getTimeouts()
+   {
+      return timeouts.intValue();
+   }
+
+   public void startTask(long timeout)
+   {
+      // たった一度だけ行う。
+      timerService.createTimer(timeout, new Date());
+   }
+
+   @Timeout
+   public void timeout(Timer timer)
+   {
+      log.info("timeout " + timer);
+      
+      timeouts.incrementAndGet();
+
+      // 常にロールバック。
+      ctx.setRollbackOnly();
+   }
+}


Property changes on: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskRemote.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskRemote.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskRemote.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.jbpapp2811;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Remote
+public interface TimerTaskRemote
+{
+   int getTimeouts();
+   
+   void startTask(long timeout);
+}


Property changes on: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/TimerTaskRemote.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/TimerRollbackUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/TimerRollbackUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/TimerRollbackUnitTestCase.java	2010-03-04 12:45:19 UTC (rev 101818)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.jbpapp2811.unit;
+
+import junit.framework.Test;
+import org.jboss.ejb3.test.common.EJB3TestCase;
+import org.jboss.ejb3.test.jbpapp2811.TimerTaskRemote;
+
+/**
+ * @author <a href="cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class TimerRollbackUnitTestCase extends EJB3TestCase
+{
+   public TimerRollbackUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test1() throws Exception
+   {
+      TimerTaskRemote bean = lookup("TimerTaskBean/remote", TimerTaskRemote.class);
+
+      bean.startTask(100);
+
+      Thread.sleep(1000);
+
+      int timeouts = bean.getTimeouts();
+      assertTrue("expected timeouts > 1, but was " + timeouts, timeouts > 1);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(TimerRollbackUnitTestCase.class, "jbpapp2811.jar");
+   }
+}


Property changes on: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp2811/unit/TimerRollbackUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list