|
14 | 14 | import java.util.List; |
15 | 15 | import java.util.concurrent.*; |
16 | 16 | import java.util.concurrent.atomic.AtomicReference; |
17 | | -import java.util.logging.Level; |
18 | 17 |
|
19 | 18 | // EventSource class modified from |
20 | 19 | // https://github.com/jersey/jersey/blob/master/media/sse/src/main/java/org/glassfish/jersey/media/sse/EventSource.java |
@@ -55,15 +54,15 @@ private static enum State { |
55 | 54 | /** |
56 | 55 | * Event source internal state. |
57 | 56 | */ |
58 | | - private final AtomicReference<State> state = new AtomicReference<State>(State.READY); |
| 57 | + private final AtomicReference<State> state = new AtomicReference<>(State.READY); |
59 | 58 | /** |
60 | 59 | * List of all listeners not bound to receive only events of a particular name. |
61 | 60 | */ |
62 | | - private final List<EventListener> unboundListeners = new CopyOnWriteArrayList<EventListener>(); |
| 61 | + private final List<EventListener> unboundListeners = new CopyOnWriteArrayList<>(); |
63 | 62 | /** |
64 | 63 | * A map of listeners bound to receive only events of a particular name. |
65 | 64 | */ |
66 | | - private final ConcurrentMap<String, List<EventListener>> boundListeners = new ConcurrentHashMap<String, List<EventListener>>(); |
| 65 | + private final ConcurrentMap<String, List<EventListener>> boundListeners = new ConcurrentHashMap<>(); |
67 | 66 |
|
68 | 67 | private final MultivaluedMap<String, Object> headers; |
69 | 68 |
|
@@ -96,7 +95,7 @@ private Builder(final WebTarget endpoint) { |
96 | 95 | this.endpoint = endpoint; |
97 | 96 | } |
98 | 97 |
|
99 | | - private MultivaluedMap<String, Object> headers = new StringKeyIgnoreCaseMultivaluedMap<Object>(); |
| 98 | + private MultivaluedMap<String, Object> headers = new StringKeyIgnoreCaseMultivaluedMap<>(); |
100 | 99 |
|
101 | 100 | /** |
102 | 101 | * Set a custom name for the event source. |
@@ -233,7 +232,7 @@ public static Builder target(WebTarget endpoint) { |
233 | 232 | * @throws NullPointerException in case the supplied web target is {@code null}. |
234 | 233 | */ |
235 | 234 | public EventSource(final WebTarget endpoint) { |
236 | | - this(endpoint, true, new StringKeyIgnoreCaseMultivaluedMap<Object>()); |
| 235 | + this(endpoint, true, new StringKeyIgnoreCaseMultivaluedMap<>()); |
237 | 236 | } |
238 | 237 |
|
239 | 238 | /** |
@@ -293,7 +292,7 @@ public Thread newThread(Runnable r) { |
293 | 292 | } |
294 | 293 | }); |
295 | 294 |
|
296 | | - this.headers = new StringKeyIgnoreCaseMultivaluedMap<Object>(); |
| 295 | + this.headers = new StringKeyIgnoreCaseMultivaluedMap<>(); |
297 | 296 | this.headers.putAll(headers); |
298 | 297 |
|
299 | 298 | if (open) { |
@@ -373,7 +372,7 @@ public void register(final EventListener listener, final String eventName, final |
373 | 372 |
|
374 | 373 | private void addBoundListener(final String name, final EventListener listener) { |
375 | 374 | List<EventListener> listeners = boundListeners.putIfAbsent(name, |
376 | | - new CopyOnWriteArrayList<EventListener>(Collections.singleton(listener))); |
| 375 | + new CopyOnWriteArrayList<>(Collections.singleton(listener))); |
377 | 376 | if (listeners != null) { |
378 | 377 | // alas, new listener collection registration conflict: |
379 | 378 | // need to add the new listener to the existing listener collection |
|
0 commit comments