/** * {@inheritDoc} * * @see {@link AbstractXWikiRunnable#runInternal()} */ @Override protected void runInternal() { while (true) { update(); if (stopUpdate) { feedPlugin.removeUpdateThread(space, this, getXWikiContext()); break; } try { Thread.sleep(scheduleTimer); } catch (InterruptedException e) { break; } } }
public void update() { if (!stopUpdate) { if (updateInProgress == false) { updateInProgress = true; nbLoadedFeeds = 0; nbLoadedFeedsErrors = 0; exception = null; nbLoadedArticles = 0; endDate = null; startDate = new Date(); XWikiContext context = getXWikiContext(); try { // Make sure store sessions are cleaned up context.getWiki().getStore().cleanUp(context); // update the feeds nbLoadedArticles = feedPlugin.updateFeedsInSpace(space, fullContent, true, false, context); } catch (XWikiException e) { exception = e; e.printStackTrace(); } finally { updateInProgress = false; endDate = new Date(); context.getWiki().getStore().cleanUp(context); } // an update has been schedule.. if ((forceUpdate == true) && (stopUpdate == false)) { forceUpdate = false; update(); } } else { // let's schedule an update at the end of the current update forceUpdate = true; } } }
public void stopUpdate() { if (!updateInProgress) { feedPlugin.removeUpdateThread(space, this, getXWikiContext()); } stopUpdate = true; }