Example usage for twitter4j TwitterStream removeListener

List of usage examples for twitter4j TwitterStream removeListener

Introduction

In this page you can find the example usage for twitter4j TwitterStream removeListener.

Prototype

TwitterStream removeListener(StreamListener listener);

Source Link

Usage

From source file:de.botshield.CaptureFilterStream.java

License:Apache License

public void execute(long[] followArray, String[] trackArray) {
    // try to set up new stream, when the listener fails due to HTTP timeout
    // for example

    this.initializeStreamListener();

    TwitterStream twitterStream = new TwitterStreamFactory().getInstance();
    twitterStream.addListener(listener);
    try {/*from ww w.  ja  v a 2s  .c  o m*/
        // filter() method internally creates a thread which manipulates
        // TwitterStream and calls these adequate listener methods
        // continuously.
        twitterStream.filter(new FilterQuery(0, followArray, trackArray));
    } catch (Exception ex) {
        twitterStream.removeListener(listener);
        twitterStream.cleanUp();
    }
}

From source file:me.timothy.twittertoreddit.TwitterToReddit.java

License:Open Source License

public void stopStreaming(TwitterStream stream) {
    stream.removeListener(listener);
}