how to stop and kill the Twitter4j stream correctly

前端 未结 2 1685
离开以前
离开以前 2021-01-23 21:20

I try to use the Twitter4j streaming features. So my implementation is in the following class :

public class TweetsStream {

    private TwitterStream m_twitters         


        
2条回答
  •  感情败类
    2021-01-23 22:10

    Here's the solution :

    The method TwitterStreamFactory.getSingleton() returns the same instance of the TwitterStream.

    Even if you delete properly your TwitterStream object, the listeners are stored in your TwitterStream Singleton config... So you have to create differents instances of the TwitterStream object with :

    TwitterStreamFactory l_Twitterfactory = new TwitterStreamFactory();
    m_twitterstream = l_Twitterfactory.getInstance();
    

提交回复
热议问题