public void cancel() { connectionTaskWrapper.cancel(); }
@Override protected boolean preClose(String actionId) { connectionTaskWrapper.cancel(); return super.preClose(actionId); }
/** * Cancel running task if there is at the moment. * Launch it again. */ public void restart() { cancel(); Objects.requireNonNull(task, "Task must be specified either in constructor or by passing it to restart() method"); taskHandler = backgroundWorker.handle(task); taskHandler.execute(); }
/** * Cancel running task if there is at the moment. * Launch new task specified as parameter. * * @param task task to start, also will be saved for future restarts */ public void restart(BackgroundTask<T, V> task) { cancel(); this.task = task; taskHandler = backgroundWorker.handle(task); taskHandler.execute(); }