/*
 * ################################################################
 *
 * ProActive Parallel Suite(TM): The Java(TM) library for
 *    Parallel, Distributed, Multi-Core Computing for
 *    Enterprise Grids & Clouds 
 *
 * Copyright (C) 1997-2010 INRIA/University of 
 * 				Nice-Sophia Antipolis/ActiveEon
 * Contact: proactive@ow2.org or contact@activeeon.com
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 3 of
 * the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * If needed, contact us to obtain a release under GPL Version 2 
 * or a different license than the GPL.
 *
 *  Initial developer(s):               The ProActive Team
 *                        http://proactive.inria.fr/team_members.htm
 *  Contributor(s): ActiveEon Team - http://www.activeeon.com
 *
 * ################################################################
 * $$ACTIVEEON_CONTRIBUTOR$$
 */
package org.ow2.proactive.scheduler.core;

import java.util.TimerTask;
import org.ow2.proactive.scheduler.job.InternalJob;
import org.ow2.proactive.scheduler.task.internal.InternalTask;


/**
 * RestartJobTimerTask is used to manage the timeout from which a task can be restarted after an error.
 * This timeout will increase according to a function defined in the job.
 *
 * @author The ProActiveTeam
 * @since ProActiveScheduling 0.9
 *
 * $Id$
 */
public class RestartJobTimerTask extends TimerTask {

    /** The job on which to restart the task */
    private InternalJob job;
    /** The task that have to be restarted */
    private InternalTask task;

    /**
     * Create a new instance of RestartJobTimerTask using given job and task.
     *
     * @param job The job on which to restart the task
     * @param task The task that have to be restarted
     */
    public RestartJobTimerTask(InternalJob job, InternalTask task) {
        super();
        this.job = job;
        this.task = task;
    }

    /**
     * @see java.util.TimerTask#run()
     */
    @Override
    public void run() {
        job.reStartTask(task);
    }

}

@@ -1505,16 +1505,111 @@
 merTask;
+%0A%0Aimport org.apache.log4j.Logger;%0Aimport org.objectweb.proactive.core.util.log.ProActiveLogger;
 %0Aimport 
@@ -1716,16 +1716,77 @@
 alTask;%0A
+import org.ow2.proactive.scheduler.util.SchedulerDevLoggers;%0A
 %0A%0A/**%0A *
@@ -2096,16 +2096,118 @@
 Task %7B%0A%0A
+    private static final Logger logger_dev = ProActiveLogger.getLogger(SchedulerDevLoggers.SCHEDULE);%0A
     /** 
@@ -2794,24 +2794,42 @@
 oid run() %7B%0A
+        try %7B%0A    
         job.
@@ -2847,16 +2847,194 @@
 (task);%0A
+        %7D catch (Throwable t) %7B%0A            logger_dev.fatal(%22Error while restarting task ! Job '%22 + job.getId() +%0A                %22' should be killed manually !%22, t);%0A        %7D%0A
     %7D%0A%0A%7D

Fix SCHEDULING-665, SCHEDULING-668 * Avoid restart task timer to be cancelled !