1 31 32 package org.opencms.scheduler; 33 34 import org.quartz.Job; 35 import org.quartz.JobExecutionContext; 36 37 40 public class TestCmsJob implements Job { 41 42 43 private int m_myCount; 44 45 46 public static int m_count = 0; 47 48 49 public static int m_running = 0; 50 51 54 public TestCmsJob() { 55 56 TestCmsJob.m_count++; 57 m_myCount = TestCmsJob.m_count; 58 } 59 60 63 public void execute(JobExecutionContext context) { 64 65 System.out.println(getClass().getName() + " " + m_myCount + " is starting (running: " + TestCmsJob.m_running + ")."); 66 TestCmsJob.m_running++; 67 try { 68 Thread.sleep(1000 + (long)(4000.0 * Math.random())); 69 } catch (InterruptedException e) { 70 e.printStackTrace(); 72 } 73 TestCmsJob.m_running--; 74 System.out.println(getClass().getName() + " " + m_myCount + " is finished (running: " + TestCmsJob.m_running + ")."); 75 } 76 } | Popular Tags |