[jboss-jira] [JBoss JIRA] (WFLY-12547) Include timer id in timerHasExpired and timerWasCanceled

Cheng Fang (Jira) issues at jboss.org
Mon Oct 7 15:46:00 EDT 2019


    [ https://issues.jboss.org/browse/WFLY-12547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13795777#comment-13795777 ] 

Cheng Fang commented on WFLY-12547:
-----------------------------------

Testing with an adapted version of [this quickstart sample|https://github.com/jboss-developer/jboss-eap-quickstarts/blob/99ee57bd388454629ab6813c2899ab2d9f8edddf/ejb-timer/src/main/java/org/jboss/as/quickstarts/ejbTimer/TimeoutExample.java#L57] , I was able to see the timer id in log message:

WFLYEJB0330: Timer b38543e2-1e99-4f82-9c86-f1e3dcc2acd6 has expired

{code:java}
diff --git a/ejb-timer/src/main/java/org/jboss/as/quickstarts/ejbTimer/TimeoutExample.java b/ejb-timer/src/main/java/org/jboss/as/quickstarts/ejbTimer/TimeoutExample.java
index 782c134a9..674b604ab 100644
--- a/ejb-timer/src/main/java/org/jboss/as/quickstarts/ejbTimer/TimeoutExample.java
+++ b/ejb-timer/src/main/java/org/jboss/as/quickstarts/ejbTimer/TimeoutExample.java
@@ -41,6 +41,8 @@ public class TimeoutExample {
     @Resource
     private TimerService timerService;

+    private Timer singleActionTimer;
+
     @Timeout
     public void scheduler(Timer timer) {
         Date currentTime = new Date();
@@ -54,6 +56,7 @@ public class TimeoutExample {
         // Set schedule to every 3 seconds (starting at second 0 of every minute).
         se.hour("*").minute("*").second("0/3");
         timerService.createCalendarTimer(se, new TimerConfig("EJB timer service timeout at ", false));
+        singleActionTimer = timerService.createSingleActionTimer(1, new TimerConfig("single action timer", false));
     }

     @PreDestroy
@@ -63,5 +66,6 @@ public class TimeoutExample {
             System.out.println("Stopping timer: " + timer.getInfo());
             timer.cancel();
         }
+        singleActionTimer.cancel();
     }
 }
{code}

> Include timer id in timerHasExpired and timerWasCanceled
> --------------------------------------------------------
>
>                 Key: WFLY-12547
>                 URL: https://issues.jboss.org/browse/WFLY-12547
>             Project: WildFly
>          Issue Type: Enhancement
>          Components: EJB
>    Affects Versions: 18.0.0.Beta1
>            Reporter: Cheng Fang
>            Assignee: Cheng Fang
>            Priority: Major
>
> need to include timer id in {{timerWasCanceled}} and {{timerHasExpired}} message.  Currently the generic message does not tell which time has expired or cancelled.
> {code}
> javax.ejb.NoSuchObjectLocalException: WFLYEJB0330: Timer has expired
> 	at org.jboss.as.ejb3.timerservice.TimerImpl.assertTimerState(TimerImpl.java:476) [wildfly-ejb3-18.0.0.Final-SNAPSHOT.jar:18.0.0.Final-SNAPSHOT]
> 	at org.jboss.as.ejb3.timerservice.TimerServiceImpl.cancelTimer(TimerServiceImpl.java:636) [wildfly-ejb3-18.0.0.Final-SNAPSHOT.jar:18.0.0.Final-SNAPSHOT]
> 	at org.jboss.as.ejb3.timerservice.TimerImpl.cancel(TimerImpl.java:164) [wildfly-ejb3-18.0.0.Final-SNAPSHOT.jar:18.0.0.Final-SNAPSHOT]
> 	at com.sun.ts.tests.ejb30.timer.common.TimerBeanBaseWithoutTimeOutMethod.cancelTimer(TimerBeanBaseWithoutTimeOutMethod.java:95) [classes:]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_191]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_191]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_191]
> 	at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_191]
> 	at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
> 	at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
> ...
> {code}



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list