1 16 17 package org.apache.axis2.deployment.scheduler; 18 19 import org.apache.axis2.deployment.DeploymentEngine; 20 import org.apache.axis2.deployment.listener.RepositoryListener; 21 import org.apache.axis2.deployment.listener.RepositoryListenerImpl; 22 23 import java.util.TimerTask ; 24 25 public class SchedulerTask implements Runnable { 26 27 final Object lock = new Object (); 28 29 private RepositoryListener wsListener; 30 31 int state = 0; 32 static final int SCHEDULED = 1; 33 static final int CANCELLED = 2; 34 35 TimerTask timerTask; 36 37 40 41 public SchedulerTask(DeploymentEngine deploy_engine, String folderName) { 42 wsListener = new RepositoryListenerImpl(folderName, deploy_engine); 43 } 44 45 48 49 public void run() { 50 checkRepositary(); 51 } 52 53 private void checkRepositary() { 54 ((RepositoryListenerImpl) wsListener).startListent(); 55 } 56 57 64 65 public boolean cancel() { 66 synchronized (lock) { 67 if (timerTask != null) { 68 timerTask.cancel(); 69 } 70 boolean result = (state == SCHEDULED); 71 state = CANCELLED; 72 return result; 73 } 74 } 75 76 } 77 | Popular Tags |