Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-13051

provide setRemoveOnCancelPolicy on ManagedScheduledExecutorService

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Do
    • Major
    • None
    • 19.0.0.Beta1
    • Concurrency Utilities
    • None

    Description

      Using

      @Resource
      private ManagedScheduledExecutorService executor;
      

      provides no possiblity to setRemoveOnCancelPolicy to true.

      A casting within a method:

      ((ScheduledThreadPoolExecutor) executor).setRemoveOnCancelPolicy(true);
      

      throws the error:

      Caused by: javax.ejb.EJBException: java.lang.ClassCastException: class org.glassfish.enterprise.concurrent.ManagedScheduledExecutorServiceAdapter cannot be cast to class java.util.concurrent.ScheduledThreadPoolExecutor (org.glassfish.enterprise.concurrent.ManagedScheduledExecutorServiceAdapter is in unnamed module of loader 'org.glassfish.javax.enterprise.concurrent' @a93b7af; java.util.concurrent.ScheduledThreadPoolExecutor is in module java.base of loader 'bootstrap')
      	at org.jboss.as.ejb3@17.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:246)
      	at org.jboss.as.ejb3@17.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:388)
      	at org.jboss.as.ejb3@17.0.1.Final//org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:68)
      

      Please provide option to cast or if not possible to add the property

      setRemoveOnCancelPolicy()
      

      within the object ManagedScheduledExecutorService. Because without it, we cannot remove a task from the queue with "future.cancel(false)".

      Attachments

        Activity

          People

            emartins@redhat.com Eduardo Martins
            nimo22 nimo stephan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: