File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
examples/src/main/java/com/twitter/clientlib Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public static void main(String[] args) {
4444 .executeListeners ();
4545 while (tsle .getError () == null ) {
4646 try {
47- System .err .println ("==> sleeping 5 " );
47+ System .out .println ("==> sleeping 5 " );
4848 Thread .sleep (5000 );
4949 } catch (InterruptedException e ) {
5050 e .printStackTrace ();
Original file line number Diff line number Diff line change 2222
2323package com .twitter .clientlib ;
2424
25+ import java .io .InputStream ;
26+
2527import com .twitter .clientlib .api .TwitterApi ;
2628
27- public abstract class StreamingHandler <T > implements IStreamingHandler < T > {
29+ public abstract class StreamingHandler <T > {
2830protected final TwitterApi apiInstance ;
2931
3032 public StreamingHandler (TwitterApi apiInstance ) {
3133 this .apiInstance = apiInstance ;
3234 }
3335
34- @ Override
36+ public abstract InputStream connectStream () throws ApiException ;
37+ public abstract void actionOnStreamingObject (T streamingTweet ) throws ApiException ;
38+ public abstract T getStreamingObject (String tweetString ) throws Exception ;
39+ public abstract boolean hasReconnectErrors (T streamingTweet );
40+
3541 public boolean processAndVerifyStreamingObject (String tweetString ) throws Exception {
3642 T tweet = getStreamingObject (tweetString );
3743 actionOnStreamingObject (tweet );
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public class TweetsStreamListenersExecutor {
4141 private final AtomicBoolean isRunning = new AtomicBoolean (true );
4242 private final AtomicLong tweetStreamedTime = new AtomicLong (0 );
4343 private Exception caughtException ;
44- private IStreamingHandler <?> streamingHandler ;
44+ private StreamingHandler <?> streamingHandler ;
4545 private long reconnecting = 0 ;
4646
4747 public StreamListenersExecutorBuilder stream () {
@@ -173,7 +173,7 @@ public void checkTimes() {
173173 }
174174
175175 public class StreamListenersExecutorBuilder {
176- public StreamListenersExecutorBuilder streamingHandler (IStreamingHandler <?> streamHandler ) {
176+ public StreamListenersExecutorBuilder streamingHandler (StreamingHandler <?> streamHandler ) {
177177 streamingHandler = streamHandler ;
178178 return this ;
179179 }
You can’t perform that action at this time.
0 commit comments