Robert Panzer created OPENEJB-2115: -------------------------------------- Summary: Asynchronous EJB method invocation fails with Asynchronous.QueueType=PRIORITY Key: OPENEJB-2115 URL: https://issues.apache.org/jira/browse/OPENEJB-2115 Project: OpenEJB Issue Type: Bug Components: ejb31 Affects Versions: 4.7.2 Environment: TomEE 1.7.2 Reporter: Robert Panzer Priority: Minor
When setting the option {{Asynchronous.QueueType=PRIORITY}} TomEE will set a {{java.util.concurrent.PriorityQueue}} as work queue on the ThreadPoolExecutor. A PriorityQueue expects that objects added to it are {{java.lang.Comparable}}. As {{ThreadPoolExecutor}} adds a {{java.util.concurrent.RunnableFuture}} that wraps the {{Callable}} created by TomEE the invocation fails with a ClassCastException: {quote} java.lang.ClassCastException: java.util.concurrent.FutureTask cannot be cast to java.lang.Comparable at java.util.concurrent.PriorityBlockingQueue.siftUpComparable(PriorityBlockingQueue.java:357) at java.util.concurrent.PriorityBlockingQueue.offer(PriorityBlockingQueue.java:489) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1361) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) at org.apache.openejb.async.AsynchronousPool.invoke(AsynchronousPool.java:76) at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:263) at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92) at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:322) at foo.bar.asyncejb.AsyncEJB1$$LocalBeanProxy.simpleCall(foo/bar/asyncejb/AsyncEJB1.java) at foo.bar.AsyncTest.test(AsyncTest.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) {quote} Therefore I think that offering the option {{AsynchronousPool.QueueType=PRIORITY}} does not make any sense at all and could be completely removed. -- This message was sent by Atlassian JIRA (v6.3.4#6332)