esper
esper copied to clipboard
Subscriber single-row delivery on NamedWindow produces ClassCastException
Example:
create window AWindow.std:lastevent() as (a A)"
insert into AWindow select a from A as a
on pattern [every timer:at (*, *, *, *, *, */5)] select a from AWindow as a
When attaching the following Subscriber to the last statement:
public void update(A a) {}
I get the following exception:
17:16:55.485 [com.espertech.esper.Timer-default-0] ERROR com.espertech.esper.core.service.ResultDeliveryStrategyImpl - Invocation exception when invoking method 'update' of class 'ch.algotrader.test.esper.EsperDeadlockTest$1' passing parameters [BeanEventBean eventType=BeanEventType name=A clazz=ch.algotrader.test.esper.EsperDeadlockTest$A bean=ch.algotrader.test.esper.EsperDeadlockTest$A@f933c35] for statement '4ab0af25-f070-4d3f-854f-e18069c11c2f': ClassCastException : com.espertech.esper.event.bean.BeanEventBean cannot be cast to ch.algotrader.test.esper.EsperDeadlockTest$A
java.lang.ClassCastException: com.espertech.esper.event.bean.BeanEventBean cannot be cast to ch.algotrader.test.esper.EsperDeadlockTest$A
at ch.algotrader.test.esper.EsperDeadlockTest$1$$FastClassByCGLIB$$27191106.invoke(<generated>) ~[cglib-nodep-3.1.jar:?]
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) ~[cglib-nodep-3.1.jar:?]
What is the "A" type and "a" stream for "select a from A as a". Cannot reproduce and no test case.
public class EsperDeadlockTest {
public static void main(String[] args) throws InterruptedException {
Configuration config = new Configuration();
config.addEventType(A.class);
EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
final EPRuntime runtime = epService.getEPRuntime();
final EPAdministrator administrator = epService.getEPAdministrator();
administrator.createEPL("create window AWindow.std:lastevent() as (a A)");
administrator.createEPL("insert into AWindow select a from A as a");
EPStatement stmt = administrator.createEPL("on pattern [every timer:at (*, *, *, *, *, */5)] select a from AWindow as a");
stmt.setSubscriber(new Object() {
public void update(A a) {
}
});
A a = new A();
runtime.sendEvent(a);
Thread.sleep(1000);
}
public static class A {
}
}
cannot reproduce with above code