92 dispatchers = list.isEmpty() ? EventDispatcher.NO_DISPATCHERS : list.toArray(new EventDispatcher[0]); |
92 dispatchers = list.isEmpty() ? EventDispatcher.NO_DISPATCHERS : list.toArray(new EventDispatcher[0]); |
93 dispatcherLookup.put(type.getId(), dispatchers); |
93 dispatcherLookup.put(type.getId(), dispatchers); |
94 } |
94 } |
95 cacheDispatchers = dispatchers; |
95 cacheDispatchers = dispatchers; |
96 } |
96 } |
|
97 // Expected behavior if exception occurs in onEvent: |
|
98 // |
|
99 // Synchronous: |
|
100 // - User has added onError action: |
|
101 // Catch exception, call onError and continue with next event |
|
102 // Let Errors propagate to caller of EventStream::start |
|
103 // - Default action |
|
104 // Catch exception, e.printStackTrace() and continue with next event |
|
105 // Let Errors propagate to caller of EventStream::start |
|
106 // |
|
107 // Asynchronous |
|
108 // - User has added onError action |
|
109 // Catch exception, call onError and continue with next event |
|
110 // Let Errors propagate, shutdown thread and stream |
|
111 // - Default action |
|
112 // Catch exception, e.printStackTrace() and continue with next event |
|
113 // Let Errors propagate and shutdown thread and stream |
|
114 // |
97 for (int i = 0; i < dispatchers.length; i++) { |
115 for (int i = 0; i < dispatchers.length; i++) { |
98 try { |
116 try { |
99 dispatchers[i].offer(event); |
117 dispatchers[i].offer(event); |
100 } catch (Exception e) { |
118 } catch (Exception e) { |
101 handleError(e); |
119 handleError(e); |