|
26 | 26 | import java.util.List;
|
27 | 27 | import java.util.Optional;
|
28 | 28 | import java.util.concurrent.Executor;
|
29 |
| -import java.util.concurrent.RejectedExecutionException; |
30 | 29 | import java.util.concurrent.locks.ReadWriteLock;
|
31 | 30 | import java.util.concurrent.locks.ReentrantReadWriteLock;
|
32 | 31 | import java.util.function.Consumer;
|
@@ -108,20 +107,16 @@ public void distribute(Consumer<ProcessorListener<T>> operation, boolean isSync)
|
108 | 107 | } finally {
|
109 | 108 | lock.readLock().unlock();
|
110 | 109 | }
|
111 |
| - try { |
112 |
| - executor.execute(() -> { |
113 |
| - for (ProcessorListener<T> listener : toCall) { |
114 |
| - try { |
115 |
| - operation.accept(listener); |
116 |
| - } catch (Exception ex) { |
117 |
| - log.error("{} failed invoking {} event handler: {}", informerDescription, listener.getHandler(), ex.getMessage(), |
118 |
| - ex); |
119 |
| - } |
| 110 | + executor.execute(() -> { |
| 111 | + for (ProcessorListener<T> listener : toCall) { |
| 112 | + try { |
| 113 | + operation.accept(listener); |
| 114 | + } catch (Exception ex) { |
| 115 | + log.error("{} failed invoking {} event handler: {}", informerDescription, listener.getHandler(), ex.getMessage(), |
| 116 | + ex); |
120 | 117 | }
|
121 |
| - }); |
122 |
| - } catch (RejectedExecutionException e) { |
123 |
| - // do nothing |
124 |
| - } |
| 118 | + } |
| 119 | + }); |
125 | 120 | }
|
126 | 121 |
|
127 | 122 | public boolean shouldResync() {
|
@@ -202,11 +197,8 @@ public Optional<Long> getMinimalNonZeroResyncPeriod() {
|
202 | 197 | }
|
203 | 198 | }
|
204 | 199 |
|
205 |
| - public void executeIfPossible(Runnable runnable) { |
206 |
| - try { |
207 |
| - this.executor.execute(runnable); |
208 |
| - } catch (RejectedExecutionException e) { |
209 |
| - // already shutdown |
210 |
| - } |
| 200 | + public SerialExecutor getSerialExecutor() { |
| 201 | + return executor; |
211 | 202 | }
|
| 203 | + |
212 | 204 | }
|
0 commit comments