I opened https://issues.apache.org/jira/browse/OPENEJB-1520 and
uploaded a new patch according to Ivan's suggestion.


diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerData.java
b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerData.java
index e6326e6..e161243 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerData.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/TimerData.java
@@ -122,6 +122,7 @@ public abstract class TimerData {
     public void newTimer() {
         //Initialize the Quartz Trigger
         trigger = initializeTrigger();
+        trigger.computeFirstFireTime(null);
         trigger.setGroup(OPEN_EJB_TIMEOUT_TRIGGER_GROUP_NAME);
         trigger.setName(OPEN_EJB_TIMEOUT_TRIGGER_NAME_PREFIX +
deploymentId + "_" + id);
         newTimer = true;



On Tue, Apr 12, 2011 at 4:07 PM, Shawn Jiang <[email protected]> wrote:

> The single action timer data set the expiration as start time of the simple
> trigger, so that nextFireTime of simple trigger is still null after the
> initialization process.
>
> org.apache.openejb.core.timer.SingleActionTimerData.initializeTrigger()
>
>  @Override
>     public Trigger initializeTrigger() {
>         final SimpleTrigger simpleTrigger = new SimpleTrigger();
>         simpleTrigger.*setStartTime*(expiration);
>         return simpleTrigger;
>     }
>
>
> As a result,  following method will always throw NoMoreTimeoutsException
> exceptions for single action timer.
>
> org.apache.openejb.core.timer.TimerData.getNextTimeout() {
> ...
>         Date nextTimeout = trigger.getNextFireTime();
>         if (nextTimeout == null) {
>             throw new NoMoreTimeoutsException("The timer has no future
> timeouts");
> ...
>
> }
>
>
> To correct this,
>
> simpleTrigger.*setStartTime*(expiration);
>
> should be updated to
>
> simpleTrigger.*setNextFireTime*(expiration);
>
>
> comments ?   I'll open a jira and attach a patch for it.
>
> --
> Shawn
>



-- 
Shawn

Reply via email to