@Override
 protected void done() {
   super.done();
   try {
     this.get();
     listener.done();
   } catch (InterruptedException e) {
     listener.setStatus("Interrupted Exception: " + e.getMessage());
     e.printStackTrace(new PrintStream(callbacks.getStderr()));
   } catch (ExecutionException e) {
     listener.setStatus("Execution Exception: " + e.getMessage());
     e.printStackTrace(new PrintStream(callbacks.getStderr()));
   } catch (Throwable e) {
     listener.setStatus(e.getMessage());
     e.printStackTrace(new PrintStream(callbacks.getStderr()));
   }
 }
  @Override
  protected void process(List<Object> chunks) {
    super.process(chunks);
    String lastMessage = null;
    int lastPercent = -1;

    for (Object chunk : chunks) {
      if (chunk instanceof String) {
        lastMessage = (String) chunk;
      } else if (chunk instanceof Integer) {
        lastPercent = (Integer) chunk;
      }
    }

    if (lastMessage != null) {
      listener.setStatus(lastMessage);
    }
    if (lastPercent > -1) {
      listener.setProgress(lastPercent);
    }
  }