public void run() { if (this.isActive) { try { perform(); //notify listener if (this.listener != null) { this.listener.onTerminate(); } } catch (Exception e) { logger.error("Could not execute task " + this.taskId + ": "+ e.getMessage(), e); if (this.listener != null) { listener.handlerError(e); } } } }