cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cxf git commit: CXF-7085: Introduce support for Server Sent Events (Client). Enforced proper reconnection delay settings
Date Sun, 09 Jul 2017 20:05:15 GMT
Repository: cxf
Updated Branches:
  refs/heads/master dffa0df6c -> 550df751b


CXF-7085: Introduce support for Server Sent Events (Client). Enforced proper reconnection
delay settings


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

Branch: refs/heads/master
Commit: 550df751b7d7dcdda1a92a22d80890c573be9998
Parents: dffa0df
Author: reta <drreta@gmail.com>
Authored: Sun Jul 9 16:04:56 2017 -0400
Committer: reta <drreta@gmail.com>
Committed: Sun Jul 9 16:04:56 2017 -0400

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java | 5 ++---
 .../org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java    | 6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/550df751/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java
b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java
index b3fa0dc..5727d56 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceBuilderImpl.java
@@ -21,13 +21,12 @@ package org.apache.cxf.jaxrs.sse.client;
 import java.util.concurrent.TimeUnit;
 
 import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.sse.InboundSseEvent;
 import javax.ws.rs.sse.SseEventSource;
 import javax.ws.rs.sse.SseEventSource.Builder;
 
 public class SseEventSourceBuilderImpl extends SseEventSource.Builder {
-    private static final long DEFAULT_RECONNECT_DELAY_IN_MS = 500;
-    
-    private long delay = DEFAULT_RECONNECT_DELAY_IN_MS;
+    private long delay = InboundSseEvent.RECONNECT_NOT_SET;
     private TimeUnit unit = TimeUnit.MILLISECONDS;
     private WebTarget target;
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/550df751/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java
b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java
index 22f365e..fe5eae7 100644
--- a/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java
+++ b/rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/client/SseEventSourceImpl.java
@@ -74,7 +74,7 @@ public class SseEventSourceImpl implements SseEventSource {
         @Override
         public void onError(Throwable ex) {
             listeners.forEach(listener -> listener.onError(ex));
-            if (delay > 0 && unit != null) {
+            if (delay >= 0 && unit != null) {
                 scheduleReconnect(delay, unit, lastEventId);
             }
         }
@@ -82,7 +82,7 @@ public class SseEventSourceImpl implements SseEventSource {
         @Override
         public void onComplete() {
             listeners.forEach(InboundSseEventListener::onComplete);
-            if (delay > 0 && unit != null) {
+            if (delay >= 0 && unit != null) {
                 scheduleReconnect(delay, unit, lastEventId);
             }
         }
@@ -243,7 +243,7 @@ public class SseEventSourceImpl implements SseEventSource {
     
     private void scheduleReconnect(long delay, TimeUnit unit, String lastEventId) {
         // If delay == RECONNECT_NOT_SET, no reconnection attempt should be performed
-        if (delay <= 0 || executor == null) {
+        if (delay < 0 || executor == null) {
             return;
         }
         


Mime
View raw message