1 8 9 package org.roller.presentation.pings; 10 11 import org.apache.commons.logging.Log; 12 import org.apache.commons.logging.LogFactory; 13 import org.roller.RollerException; 14 import org.roller.model.Roller; 15 import org.roller.model.RollerFactory; 16 import org.roller.presentation.RollerContext; 17 18 import java.util.TimerTask ; 19 20 25 public class PingQueueTask extends TimerTask 26 { 27 private static final Log logger = LogFactory.getLog(PingQueueTask.class); 28 29 long intervalMins; 31 32 38 public void init(RollerContext rc, long intervalMins) throws RollerException 39 { 40 PingQueueProcessor.init(rc); 41 this.intervalMins = intervalMins; 42 } 43 44 49 public long getIntervalMins() 50 { 51 return intervalMins; 52 } 53 54 57 public void run() 58 { 59 Roller roller = null; 61 try 62 { 63 roller = RollerFactory.getRoller(); 64 roller.begin(); 65 PingQueueProcessor.getInstance().processQueue(); 66 roller.commit(); 67 } 68 catch (RollerException e) 69 { 70 logger.error("Error while processing ping queuer", e); 72 } 73 finally 74 { 75 if (roller != null) roller.release(); 76 } 77 } 78 } 79 | Popular Tags |