[jboss-cvs] JBossAS SVN: r87717 - in branches/Branch_5_x: testsuite/src/main/org/jboss/test/ejb3 and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 23 05:30:56 EDT 2009
Author: galder.zamarreno at jboss.com
Date: 2009-04-23 05:30:56 -0400 (Thu, 23 Apr 2009)
New Revision: 87717
Added:
branches/Branch_5_x/testsuite/src/main/org/jboss/test/ejb3/timer/
branches/Branch_5_x/testsuite/src/main/org/jboss/test/ejb3/timer/unit/
Modified:
branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/EJBTimerServiceImpl.java
branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/TimerServiceImpl.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/timer/test/TimerCleanUpUnitTestCase.java
Log:
[JBCTS-907] Reverted change while I get a better fix for JBAS-6677 done.
Modified: branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/EJBTimerServiceImpl.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/EJBTimerServiceImpl.java 2009-04-23 09:16:17 UTC (rev 87716)
+++ branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/EJBTimerServiceImpl.java 2009-04-23 09:30:56 UTC (rev 87717)
@@ -52,7 +52,6 @@
*
* @author Thomas.Diesler at jboss.org
* @author Dimitris.Andreadis at jboss.org
- * @author Galder Zamarreño
* @version $Revision$
* @since 07-Apr-2004
*/
@@ -317,7 +316,7 @@
if (timerService == null)
{
timerService = new TimerServiceImpl(timedObjectId, invoker,
- transactionManager, persistencePolicy, retryPolicy, timerIdGenerator, this);
+ transactionManager, persistencePolicy, retryPolicy, timerIdGenerator);
log.debug("createTimerService: " + timerService);
timerServiceMap.put(timedObjectId, timerService);
}
@@ -520,14 +519,4 @@
}
return retBuffer.toString();
}
-
- void noMoreTimers(TimedObjectId timedObjectId)
- {
- if (log.isTraceEnabled())
- {
- log.trace("No active timers available for " + timedObjectId.getContainerId() + " and primary key " + timedObjectId.getInstancePk());
- }
-
- timerServiceMap.remove(timedObjectId);
- }
}
Modified: branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/TimerServiceImpl.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/TimerServiceImpl.java 2009-04-23 09:16:17 UTC (rev 87716)
+++ branches/Branch_5_x/server/src/main/org/jboss/ejb/txtimer/TimerServiceImpl.java 2009-04-23 09:30:56 UTC (rev 87717)
@@ -49,7 +49,6 @@
*
* @author Thomas.Diesler at jboss.org
* @author Dimitris.Andreadis at jboss.org
- * @author Galder Zamarreño
* @version $Revision$
* @since 07-Apr-2004
*/
@@ -74,8 +73,6 @@
// Map<TimerHandleImpl,TimerImpl>
private Map timers = new HashMap();
-
- private EJBTimerServiceImpl ejbTimerService;
// Constructors --------------------------------------------------
@@ -87,16 +84,14 @@
public TimerServiceImpl(
TimedObjectId timedObjectId, TimedObjectInvoker timedObjectInvoker,
TransactionManager transactionManager, PersistencePolicy persistencePolicy,
- RetryPolicy retryPolicy, TimerIdGenerator timerIdGenerator,
- EJBTimerServiceImpl ejbTimerService)
+ RetryPolicy retryPolicy, TimerIdGenerator timerIdGenerator)
{
this.timedObjectId = timedObjectId;
this.timedObjectInvoker = timedObjectInvoker;
this.transactionManager = transactionManager;
this.persistencePolicy = persistencePolicy;
this.timerIdGenerator = timerIdGenerator;
- this.retryPolicy = retryPolicy;
- this.ejbTimerService = ejbTimerService;
+ this.retryPolicy = retryPolicy;
}
// Public --------------------------------------------------------
@@ -331,10 +326,6 @@
{
persistencePolicy.deleteTimer(txtimer.getTimerId(), txtimer.getTimedObjectId());
timers.remove(new TimerHandleImpl(txtimer));
- if (timers.isEmpty())
- {
- ejbTimerService.noMoreTimers(timedObjectId);
- }
}
}
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/timer/test/TimerCleanUpUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/timer/test/TimerCleanUpUnitTestCase.java 2009-04-23 09:16:17 UTC (rev 87716)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/timer/test/TimerCleanUpUnitTestCase.java 2009-04-23 09:30:56 UTC (rev 87717)
@@ -22,6 +22,7 @@
package org.jboss.test.timer.test;
import javax.ejb.EJBHome;
+import javax.ejb.TimerHandle;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -57,80 +58,84 @@
public void testEntityBeanTimerHasTimerServiceAfterCancellationStd() throws Exception
{
- String jndi = "ejb/test/timer/TimerEntityExtStd";
- TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome("ejb/test/timer/TimerEntityExtStd");
- TimerEntityExt entity = home.create(new Integer(333));
- entity.startTimer(SHORT_PERIOD);
- Thread.sleep(12 * SHORT_PERIOD);
- assertTrue("Timer service should be associated with bean." , entity.hasTimerService(jndi));
- entity.stopTimer();
- int lCount = entity.getTimeoutCount();
- assertTrue("Timeout was expected to be called at least 10 times but was "
- + "only called: " + lCount + " times",
- lCount >= 10);
- Thread.sleep(5 * SHORT_PERIOD);
- int lCount2 = entity.getTimeoutCount();
- assertTrue("After the timer was stopped no timeout should happen but "
- + "it was called " + (lCount2 - lCount) + " more times",
- lCount == lCount2);
- assertFalse("Timer service should have been passivated and timer service association removed."
- , entity.hasTimerService(jndi));
- entity.remove();
+// String jndi = "ejb/test/timer/TimerEntityExtStd";
+// TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
+// TimerEntityExt entity = home.create(new Integer(333));
+// entity.startTimer(SHORT_PERIOD);
+// Thread.sleep(12 * SHORT_PERIOD);
+// assertTrue("Timer service should be associated with bean." , entity.hasTimerService(jndi));
+// entity.stopTimer();
+// int lCount = entity.getTimeoutCount();
+// assertTrue("Timeout was expected to be called at least 10 times but was "
+// + "only called: " + lCount + " times",
+// lCount >= 10);
+// Thread.sleep(5 * SHORT_PERIOD);
+// int lCount2 = entity.getTimeoutCount();
+// assertTrue("After the timer was stopped no timeout should happen but "
+// + "it was called " + (lCount2 - lCount) + " more times",
+// lCount == lCount2);
+// Thread.sleep(40 * SHORT_PERIOD);
+// assertFalse("Timer service should have been passivated and timer service association removed."
+// , entity.hasTimerService(jndi));
+// entity.remove();
}
public void testEntityBeanSingleTimerHasTimerServiceAfterExpirationStd() throws Exception
{
- String jndi = "ejb/test/timer/TimerEntityExtStd";
- TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome("ejb/test/timer/TimerEntityExtStd");
- TimerEntityExt entity = home.create(new Integer(444));
- entity.startSingleTimer(SHORT_PERIOD);
- Thread.sleep(5 * SHORT_PERIOD);
- assertFalse("Timer service should be associated with bean." , entity.hasTimerService(jndi));
- int lCount = entity.getTimeoutCount();
- assertTrue("Timeout was expected to be called only once but was called: "
- + lCount + " times",
- lCount == 1);
- entity.remove();
+// String jndi = "ejb/test/timer/TimerEntityExtStd";
+// TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
+// TimerEntityExt entity = home.create(new Integer(444));
+// entity.startSingleTimer(SHORT_PERIOD);
+// Thread.sleep(5 * SHORT_PERIOD);
+// assertFalse("Timer service should be associated with bean." , entity.hasTimerService(jndi));
+// int lCount = entity.getTimeoutCount();
+// assertTrue("Timeout was expected to be called only once but was called: "
+// + lCount + " times",
+// lCount == 1);
+// Thread.sleep(40 * SHORT_PERIOD);
+// assertFalse("Timer service should have been passivated and timer service association removed."
+// , entity.hasTimerService(jndi));
+// entity.remove();
}
public void testEntityBeanTimerHasTimerServiceAfterCancellationInstPerTx() throws Exception
{
- String jndi = "ejb/test/timer/TimerEntityExtInstPerTx";
- TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
- TimerEntityExt entity = home.create(new Integer(555));
- entity.startTimer(SHORT_PERIOD);
- Thread.sleep(12 * SHORT_PERIOD);
- assertTrue("Timer service should be associated with bean." , entity.hasTimerService(jndi));
- entity.stopTimer();
- int lCount = entity.getTimeoutCount();
- assertTrue("Timeout was expected to be called at least 10 times but was "
- + "only called: " + lCount + " times",
- lCount >= 10);
- Thread.sleep(5 * SHORT_PERIOD);
- int lCount2 = entity.getTimeoutCount();
- assertTrue("After the timer was stopped no timeout should happen but "
- + "it was called " + (lCount2 - lCount) + " more times",
- lCount == lCount2);
- assertFalse("Timer service should have been passivated and timer service association removed."
- , entity.hasTimerService(jndi));
- entity.remove();
+// String jndi = "ejb/test/timer/TimerEntityExtInstPerTx";
+// TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
+// TimerEntityExt entity = home.create(new Integer(555));
+// entity.startTimer(SHORT_PERIOD);
+// Thread.sleep(12 * SHORT_PERIOD);
+// assertTrue("Timer service should be associated with bean." , entity.hasTimerService(jndi));
+// entity.stopTimer();
+// int lCount = entity.getTimeoutCount();
+// assertTrue("Timeout was expected to be called at least 10 times but was "
+// + "only called: " + lCount + " times",
+// lCount >= 10);
+// Thread.sleep(5 * SHORT_PERIOD);
+// int lCount2 = entity.getTimeoutCount();
+// assertTrue("After the timer was stopped no timeout should happen but "
+// + "it was called " + (lCount2 - lCount) + " more times",
+// lCount == lCount2);
+// assertFalse("Timer service should have been passivated and timer service association removed."
+// , entity.hasTimerService(jndi));
+// entity.remove();
}
public void testEntityBeanSingleTimerHasTimerServiceAfterExpirationInstPerTx() throws Exception
{
- String jndi = "ejb/test/timer/TimerEntityExtInstPerTx";
- TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
- TimerEntityExt entity = home.create(new Integer(666));
- entity.startSingleTimer(SHORT_PERIOD);
- Thread.sleep(5 * SHORT_PERIOD);
- assertFalse("Timer service should be associated with bean." , entity.hasTimerService(jndi));
- int lCount = entity.getTimeoutCount();
- assertTrue("Timeout was expected to be called only once but was called: "
- + lCount + " times",
- lCount == 1);
- assertFalse("Timer service should have been passivated and timer service association removed."
- , entity.hasTimerService(jndi));
- entity.remove();
+// String jndi = "ejb/test/timer/TimerEntityExtInstPerTx";
+// TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
+// TimerEntityExt entity = home.create(new Integer(666));
+// entity.startSingleTimer(SHORT_PERIOD);
+// Thread.sleep(5 * SHORT_PERIOD);
+// assertFalse("Timer service should be associated with bean." , entity.hasTimerService(jndi));
+// int lCount = entity.getTimeoutCount();
+// assertTrue("Timeout was expected to be called only once but was called: "
+// + lCount + " times",
+// lCount == 1);
+// assertFalse("Timer service should have been passivated and timer service association removed."
+// , entity.hasTimerService(jndi));
+// entity.remove();
}
private EJBHome getEJBHome(String pJNDIName) throws NamingException
More information about the jboss-cvs-commits
mailing list