teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
teichmann@5863: * Software engineering by Intevation GmbH
teichmann@5863: *
teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3)
teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the
teichmann@5994: * documentation coming with Dive4Elements River for details.
teichmann@5863: */
teichmann@5863:
teichmann@5831: package org.dive4elements.river.wsplgen;
ingo@1970:
ingo@1970: import java.util.concurrent.FutureTask;
ingo@1970:
ingo@1970: import org.apache.log4j.Logger;
ingo@1970:
ingo@1970:
ingo@1970: /**
ingo@1970: * This FutureTask overrides the cancel() method. Before super.cancel()
ingo@1970: * is called, WSPLGENCallable.cancelWSPLGEN() is executed to kill a running
ingo@1970: * WSPLGEN process.
ingo@1970: *
ingo@1970: * @author Ingo Weinzierl
ingo@1970: */
ingo@1970: public class WSPLGENFuture extends FutureTask {
ingo@1970:
teichmann@8202: private static final Logger log = Logger.getLogger(WSPLGENFuture.class);
ingo@1970:
ingo@1970: protected WSPLGENCallable wsplgenCallable;
ingo@1970:
ingo@1970:
ingo@1970: public WSPLGENFuture(WSPLGENCallable callable) {
ingo@1970: super(callable);
ingo@1970: this.wsplgenCallable = callable;
ingo@1970: }
ingo@1970:
ingo@1970:
ingo@1970: public WSPLGENCallable getWSPLGENCallable() {
ingo@1970: return wsplgenCallable;
ingo@1970: }
ingo@1970:
ingo@1970:
ingo@1970: @Override
ingo@1970: public boolean cancel(boolean mayInterruptIfRunning) {
teichmann@8202: log.debug("WSPLGENFuture.cancel");
ingo@1970:
ingo@1970: wsplgenCallable.cancelWSPLGEN();
ingo@1970: return super.cancel(mayInterruptIfRunning);
ingo@1970: }
ingo@1970: }
ingo@1970: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :