diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-07 11:02:26 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-07 11:02:26 +0200 |
commit | d56af15b3e343930f6674868c1d9be8a48f002ff (patch) | |
tree | 05d92dbff120785a8b83475f2f238cf8ae786f3e /src/main/TweetShell.java | |
parent | 30ed4171fa09923d9b3c0365a3f1a4bc7a1658b0 (diff) | |
download | TwitterDataAnalytics-d56af15b3e343930f6674868c1d9be8a48f002ff.tar.gz |
Allow commit to disconnect for empty keywords, detect dead connection
Diffstat (limited to 'src/main/TweetShell.java')
-rw-r--r-- | src/main/TweetShell.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java index 2b3b078..608a15a 100644 --- a/src/main/TweetShell.java +++ b/src/main/TweetShell.java @@ -6,6 +6,7 @@ import io.OAuthRequester; import io.StreamImpl; import java.io.Closeable; import java.io.IOException; +import java.net.SocketTimeoutException; import java.util.Arrays; import java.util.Map; import java.util.NoSuchElementException; @@ -68,6 +69,20 @@ public class TweetShell implements TwitterApi.PinSupplier { @Override public void exceptionGenerated(Exception ex) { System.err.println("Stream closed due to " + ex); + /* Disabled because it deadlocks in WorkerContainer.finish + // to solve that if necessary, start commit in a new thread + if (ex instanceof SocketTimeoutException + || (ex instanceof IOException + && ex.getMessage().endsWith("Read timed out"))) { + try { + System.err.println("Trying to reconnect."); + getStream().commit(); + } catch (IOException ioex) { + System.err.println("Failed to re-connect: " + + ioex.getMessage()); + } + } + */ } } |