twitterStream.sample() from twitter4j library returns only one tweet

twitter4j
java
api

#1

Hi, I’m using the twitter4j library in java to get a sample of random tweets from the public, however I’m only getting one tweet repeated over and over again.

StatusListener listener = new StatusListener(){

			@Override
			public void onException(Exception ex) {
				ex.printStackTrace();
				
			}

			@Override
			public void onStatus(Status status) {
				//System.out.println(status.getId() + " " + status.getText());
				try {
					writeTweetsToFile(status);
				} catch (InterruptedException | IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}

			@Override
			public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
				System.out.println("Status deletion notice " + statusDeletionNotice.getStatusId());
				
			}

			@Override
			public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
				System.out.println("Got track limitation notice " + numberOfLimitedStatuses);
				
			}

			@Override
			public void onScrubGeo(long userId, long upToStatusId) {
				System.out.println("Got scrub_geo event userId: " + userId + "upToStatusId:" + upToStatusId);
				
			}

			@Override
			public void onStallWarning(StallWarning warning) {
				System.out.println("Got stall warning " + warning);
				
			}
			
		};
		
		TwitterStream twitterStream = config();
		
		twitterStream.sample();

Here is a snippet of my code that streams the tweets