cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Fixing SSE related build failures
Date Mon, 06 Mar 2017 15:31:49 GMT
Repository: cxf
Updated Branches:
  refs/heads/master ad18f5aef -> f2fe6260e


Fixing SSE related  build failures


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f2fe6260
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f2fe6260
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f2fe6260

Branch: refs/heads/master
Commit: f2fe6260e87fc71e43075730bee99cf564d2711a
Parents: ad18f5a
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Mar 6 15:31:36 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Mar 6 15:31:36 2017 +0000

----------------------------------------------------------------------
 .../cxf/jaxrs/sse/SseBroadcasterImpl.java       |  4 ++--
 .../atmosphere/SseAtmosphereEventSinkImpl.java  | 21 ++++++++++++--------
 .../apache/cxf/systest/jaxrs/sse/BookStore.java |  3 +--
 .../cxf/systest/jaxrs/sse/BookStore2.java       |  3 +--
 4 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f2fe6260/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
index 7ff6f6f..ceeaee2 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/SseBroadcasterImpl.java
@@ -38,7 +38,7 @@ public class SseBroadcasterImpl implements SseBroadcaster {
     private final Set<Consumer<Subscriber<? super OutboundSseEvent>>> closers
=
             new CopyOnWriteArraySet<>();
 
-    private final Set<BiConsumer<Subscriber<? super OutboundSseEvent>, Exception>>
exceptioners =
+    private final Set<BiConsumer<Subscriber<? super OutboundSseEvent>, Throwable>>
exceptioners =
             new CopyOnWriteArraySet<>();
 
     @Override
@@ -77,7 +77,7 @@ public class SseBroadcasterImpl implements SseBroadcaster {
     }
 
     @Override
-    public void onException(BiConsumer<Subscriber<? super OutboundSseEvent>, Exception>
exceptioner) {
+    public void onError(BiConsumer<Subscriber<? super OutboundSseEvent>, Throwable>
exceptioner) {
         exceptioners.add(exceptioner);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/f2fe6260/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventSinkImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventSinkImpl.java
b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventSinkImpl.java
index 035d98d..c58e58c 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventSinkImpl.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/atmosphere/SseAtmosphereEventSinkImpl.java
@@ -58,7 +58,7 @@ public class SseAtmosphereEventSinkImpl implements SseEventSink {
     }
 
     @Override
-    public void close() throws IOException {
+    public void close() {
         if (!closed) {
             closed = true;
 
@@ -75,12 +75,21 @@ public class SseAtmosphereEventSinkImpl implements SseEventSink {
                 final AtmosphereResponse response = resource.getResponse();
                 if (!response.isCommitted()) {
                     LOG.fine("Response is not committed, flushing buffer");
-                    response.flushBuffer();
+                    try {
+                        response.flushBuffer();
+                    } catch (IOException ex) {
+                        //REVISIT: and throw a runtime exception ?
+                        LOG.warning("Failed to flush AtmosphereResponse buffer");
+                    }
                 }
 
                 response.closeStreamOrWriter();
             } finally {
-                resource.close();
+                try {
+                    resource.close();
+                } catch (IOException ex) {
+                    // ignore
+                }
                 broadcaster.destroy();
                 LOG.fine("Atmosphere SSE event output is closed");
             }
@@ -125,11 +134,7 @@ public class SseAtmosphereEventSinkImpl implements SseEventSink {
 
     @Override
     public void onComplete() {
-        try {
-            close();
-        } catch (final IOException ex) {
-            LOG.warning("While closing the SSE connection, an exception was raised: " + ex);
-        }
+        close();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/f2fe6260/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
index 1aa8a14..b336cc9 100644
--- a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.systest.jaxrs.sse;
 
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
@@ -87,7 +86,7 @@ public class BookStore {
                     sink.onNext(createStatsEvent(builder.name("book"), id + 4));
                     Thread.sleep(200);
                     sink.close();
-                } catch (final InterruptedException | IOException ex) {
+                } catch (final InterruptedException ex) {
                     LOG.error("Communication error", ex);
                 }
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f2fe6260/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore2.java
----------------------------------------------------------------------
diff --git a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore2.java
b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore2.java
index 68603f9..b14e86a 100644
--- a/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore2.java
+++ b/systests/rs-sse/src/test/java/org/apache/cxf/systest/jaxrs/sse/BookStore2.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.systest.jaxrs.sse;
 
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
@@ -86,7 +85,7 @@ public class BookStore2 {
                     sink.onNext(createStatsEvent(builder.name("book"), id + 4));
                     Thread.sleep(200);
                     sink.close();
-                } catch (final InterruptedException | IOException ex) {
+                } catch (final InterruptedException ex) {
                     LOG.error("Communication error", ex);
                 }
             }


Mime
View raw message