All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fizzed.play.twitter.RefreshJob Maven / Gradle / Ivy

package com.fizzed.play.twitter;

import play.Logger;
import twitter4j.ResponseList;
import twitter4j.Status;
import twitter4j.Twitter;

public class RefreshJob implements Runnable {
	
	private final TwitterPlugin plugin;
	
	public RefreshJob(TwitterPlugin plugin) {
		super();
		this.plugin = plugin;
	}

	@Override
	public void run() {
		Logger.info("Starting twitter update...");
		try {
			Twitter twitter = plugin.createTwitter();
        	ResponseList tweets = twitter.getUserTimeline();
        	// cache the tweets!
        	plugin.setTweets(tweets);
        	Logger.info("Completed update of tweets from twitter");
        } catch (Exception e) {
        	Logger.error("Unable to cleanly fetch new tweets", e);
        }
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy