(Callable<T> c)
| 301 | CompletableFuture<T> f = new CompletableFuture<>(); |
| 302 | try { |
| 303 | T t = c.call(); |
| 304 | f.complete(t); |
| 305 | } catch (Throwable tt) { |
| 306 | f.completeExceptionally(tt); |
| 307 | } |
| 308 | return f; |
| 309 | } else { |
| 310 | CompletableFuture<T> f = new CompletableFuture<>(); |
| 311 | this.queue.add(() -> { |
| 312 | try { |
| 313 | T t = c.call(); |
| 314 | f.complete(t); |
| 315 | } catch (Throwable tt) { |
| 316 | tt.printStackTrace(); |
| 317 | f.completeExceptionally(tt); |
| 318 | } |
| 319 | }); |
| 320 | return f; |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | public void queue(Runnable c) { |
| 325 | this.queue.add(c); |
| 326 | } |
| 327 | |
| 328 | |
| 329 | public void broadcast(String message) { |
no test coverage detected