view flys-artifacts/src/main/java/de/intevation/flys/wsplgen/WSPLGENFuture.java @ 1970:368040e5c400

Improved the Scheduler to be able to cancel running WSPLGEN jobs. flys-artifacts/trunk@3384 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 12 Dec 2011 08:15:12 +0000
parents
children
line wrap: on
line source
package de.intevation.flys.wsplgen;

import java.util.concurrent.FutureTask;

import org.apache.log4j.Logger;


/**
 * This FutureTask overrides the <i>cancel()</i> method. Before super.cancel()
 * is called, WSPLGENCallable.cancelWSPLGEN() is executed to kill a running
 * WSPLGEN process.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class WSPLGENFuture extends FutureTask {

    private static final Logger logger = Logger.getLogger(WSPLGENFuture.class);

    protected WSPLGENCallable wsplgenCallable;


    public WSPLGENFuture(WSPLGENCallable callable) {
        super(callable);
        this.wsplgenCallable = callable;
    }


    public WSPLGENCallable getWSPLGENCallable() {
        return wsplgenCallable;
    }


    @Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        logger.debug("WSPLGENFuture.cancel");

        wsplgenCallable.cancelWSPLGEN();
        return super.cancel(mayInterruptIfRunning);
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org