From f30a2bd71ec57cf2bcb872c4021b0f238db52b35 Mon Sep 17 00:00:00 2001 From: Michael McLellan Date: Fri, 14 Oct 2016 13:23:30 -0400 Subject: [PATCH] When a replay stream finishes, close the stream --- .../gnip4j/api/impl/DefaultGnipStream.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java index 719788ae..c858c273 100644 --- a/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/impl/DefaultGnipStream.java @@ -224,10 +224,15 @@ public void run() { while (!shuttingDown.get() && !Thread.interrupted()) { try { if(is == null) { - if (disconnectedSinceTime == null){ - disconnectedSinceTime = new AtomicLong(System.currentTimeMillis()); - } + if (disconnectedSinceTime == null) { + disconnectedSinceTime = new AtomicLong(System.currentTimeMillis()); + } + if (streamURI.toString().contains("replay")) { + // When a replay stream is finished, close the stream + doClose(); + } else { reconnect(); + } } if(is != null) { processor.process(is,stats);