1 /* 2 * Copyright (c) 2003-2008 by Cosylab d. d. 3 * 4 * This file is part of Java-Common. 5 * 6 * Java-Common is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Java-Common is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Java-Common. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package com.cosylab.util; 21 22 /** 23 * Interface that defines a task that can be run by Scheduler. 24 * 25 * @author <a href="mailto:ales.pucelj@cosylab.com">Ales Pucelj</a> 26 * @version $id$ 27 * @deprecated Use concurency from Java 1.5 instead. 28 */ 29 public interface SchedulerTask extends Runnable 30 { 31 /** 32 * This task should be canceled at first available oportunity. 33 */ 34 void cancel(); 35 36 /** 37 * Returns true if this task is scheduled for canceling. One canceled 38 * returns true, this task will never be executed again. If task is 39 * running currently, it will finish, then be destroyed. 40 * 41 * @return True if the task should be destroyed. 42 */ 43 boolean isCanceled(); 44 45 /** 46 * Returns name of this task. This name is for informative purposes only. 47 * Can be null. If specified it can aid in debugging, since the thread 48 * executing this task can be identified. 49 * 50 * @return Name Name of this task or null. 51 */ 52 String getTaskName(); 53 54 /** 55 * Interval between two executions. This value indicates the desired time 56 * between to calls to run() method. If value is negative, the task will 57 * be executed at next available oportunity. 58 * 59 * <p> 60 * If this value is changed while task is already scheduled, changes will 61 * take effect after this task is run next time. 62 * </p> 63 * 64 * @return Time in miliseconds. 65 */ 66 long getInterval(); 67 68 /** 69 * Method that runs this task. Deliberately made to clash with Thread.run() 70 * to prevent this class to be implemented as a Thread or Runnable. 71 */ 72 void run(); 73 } 74 75 /* __oOo__ */