Adds a handler for this thread.
(final Consumer<T> handler)
| 153 | |
| 154 | /** Adds a handler for this thread. */ |
| 155 | public <T> Closeable addThread(final Consumer<T> handler) { |
| 156 | //noinspection unchecked |
| 157 | threadHandlers.get().add((Consumer<Object>) handler); |
| 158 | return () -> removeThread(handler); |
| 159 | } |
| 160 | |
| 161 | // CHECKSTYLE: IGNORE 1 |
| 162 | /** @deprecated Use {@link #addThread(Consumer)}. */ |