code: private void cancelOrKillExecution(boolean cancel) {
  		final Thread executingThread = this.environment.getExecutingThread();
  
  		if (executingThread == null) {
  			return;
  		}
  
  		if (this.executionState != ExecutionState.RUNNING && this.executionState != ExecutionState.FINISHING) {
  			return;
  		}
  
  		LOG.info((cancel ? "Canceling " : "Killing ") + this.environment.getTaskNameWithIndex());
  
  		if (cancel) {
  			this.isCanceled = true;
  			// Change state
  			executionStateChanged(ExecutionState.CANCELING, null);
  
  			// Request user code to shut down
  			try {
  				final AbstractInvokable invokable = this.environment.getInvokable();
  				if (invokable != null) {
  					invokable.cancel();
  				}
  			} catch (Throwable e) {
  				LOG.error(StringUtils.stringifyException(e));
  			}
  		}
  
  		// Continuously interrupt the user thread until it changed to state CANCELED
  		while (true) {
  
  			executingThread.interrupt();
  
  			if (!executingThread.isAlive()) {
  				break;
  			}
  
  			try {
  				executingThread.join(1000);
  			} catch (InterruptedException e) {}
  
  			if (!executingThread.isAlive()) {
  				break;
  			}
  
  			if (LOG.isDebugEnabled()) {
  				LOG.debug("Sending repeated " + (cancel == true ? "canceling" : "killing") + " signal to " +
  						this.environment.getTaskName() + " with state " + this.executionState);
  			}
  		}
  	}
docs: Cancels or kills the task.
  
  @param cancel <code>true/code> if the task shall be canceled, <code>false</code> if it shall be killed