Package de.jetwick.util

Examples of de.jetwick.util.StopWatch


                return res;
            }
        };

        int counter = 0;
        StopWatch sw = new StopWatch();
        while (true) {
            counter++;
            sw.start();
            int feeded = executeOneBatch();
            sw.stop();
            if (feeded < 10) {
                try {
                    Thread.sleep(400);
                } catch (InterruptedException ex) {
                    logger.error(getName() + " interrupted while sleeping: " + ex.getLocalizedMessage());
                    break;
                }
            }

            // print stats
            if (counter % 1000 == 0) {
                logger.info("time of polling:\t" + sw.getSeconds());
                sw = new StopWatch();

                logger.info("tweetCache size:\t" + tweetCache.size());
                logger.info("tweetTodo size:\t" + resolver.getInputQueue().size());
                for (QueueInfo<JTweet> qi : inputQueues) {
                    logger.info(qi.toString());
View Full Code Here


            @Override
            public void updateSSCounts(AjaxRequestTarget target) {
                try {
                    JUser user = getMySession().getUser();
                    if (user != null) {
                        StopWatch sw = new StopWatch().start();
                        update(getTweetSearch().updateSavedSearches(user.getSavedSearches()));
                        if (target != null)
                            target.addComponent(ssPanel);
                        logger.info("Updated saved search counts for " + user.getScreenName() + " " + sw.stop().getSeconds());
                    }
                } catch (Exception ex) {
                    logger.error("Error while searching in savedSearches", ex);
                }
            }
View Full Code Here

                continue;
            }

            // regularly feed tweets of friends from authenticated user          
            try {
                StopWatch watch = new StopWatch("friends").start();
                Set<JTweet> tweets = new LinkedHashSet<JTweet>();

                // reduce maximal tweets per search when user has too many friends
                int maxTweets = 99;
                if (friends > 500)
                    maxTweets = 25;

                ue.setLastId(ue.getTwitterSearch().getHomeTimeline(tweets, maxTweets, ue.getLastId()));
                if (tweets.size() > 0) {
                    for (JTweet tw : tweets) {
                        if (tw.getFromUser().getScreenName().equalsIgnoreCase(authUser.getScreenName()))
                            tw.makePersistent();

                        // set to protected as we want to store only the article url (not the tweet!)
                        if (tw.getFromUser().isProtected())
                            tw.setProtected(true);

                        resultTweets.put(tw.setFeedSource("friendsOf:" + authUser.getScreenName()));
                    }
                    logger.info("Pushed " + tweets.size() + " friend tweets of " + authUser.getScreenName()
                            + " into queue. Last date " + new Date(ue.getLastId()) + ". " + watch.stop());
                }
            } catch (Exception ex) {
                logger.error("Exception while retrieving friend tweets of "
                        + authUser.getScreenName() + " Error:" + getErrorMsg(ex));
            }
View Full Code Here

                    + tweetCounter / sw.getSeconds() + " per sec. Remaining:"
                    + getTodoObjects().size());
            logger.info("sw1:" + sw1.getSeconds() + "\t sw2:" + sw2.getSeconds()
                    + "\t sw3:" + sw3.getSeconds() + "\t sw4:" + sw4.getSeconds());
            tweetCounter = 0;
            sw = new StopWatch();
        }

        res.addAll(protectedTweets);
        for (AnyExecutor<JTweet> exec : commitListener) {
            for (JTweet tw : res) {
View Full Code Here

TOP

Related Classes of de.jetwick.util.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.