Skip to content

Commit

Permalink
Review issues
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kec <[email protected]>
  • Loading branch information
danielkec committed Aug 3, 2020
1 parent 7f86c4a commit 680068c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public Void call() throws IOException {
} finally {
if (closed) {
try {
closeByClient();
onClose();
responseContext.close();
} catch (final Exception e) {
// if no exception remembered before, remember this one
Expand Down Expand Up @@ -334,7 +334,7 @@ public boolean isClosed() {
return closed;
}

protected void closeByClient(){
protected void onClose(){

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
package org.glassfish.jersey.server.model.internal;

import java.security.AccessController;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class SseTypeResolver {
import org.glassfish.jersey.internal.util.ReflectionHelper;

public final class SseTypeResolver {

private static final Set<Class<?>> SUPPORTED_SSE_SINK_TYPES;

private SseTypeResolver() {
}

static {
Set<Class<?>> set = new HashSet<>(8);

set.add(org.glassfish.jersey.internal.jsr166.Flow.Subscriber.class);
set.add(javax.ws.rs.sse.SseEventSink.class);
try {
Class<?> clazz = Class.forName("java.util.concurrent.Flow.Subscriber");
Class<?> clazz = AccessController
.doPrivileged(ReflectionHelper.classForNamePA("java.util.concurrent.Flow.Subscriber", null));

if (clazz != null) {
set.add(clazz);
} catch (ClassNotFoundException e) {
// Not java 9+
}
SUPPORTED_SSE_SINK_TYPES = Collections.unmodifiableSet(set);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void flush() throws IOException {
}

@Override
protected void closeByClient() {
protected void onClose() {
cancelUpstream();
}

Expand Down

0 comments on commit 680068c

Please sign in to comment.