@Override public void beanChangePerformed(BeanEvent<U> evt) { U bean = evt.getBean(); if (!bean.getStatus().isRequest()) return; WeakReference<IConsumerProcess<U>> ref = processes.get(bean.getUniqueId()); try { if (ref == null) { // Might be in submit queue still updateQueue(bean); } else { IConsumerProcess<U> process = ref.get(); if (process != null) { process.getBean().setStatus(bean.getStatus()); process.getBean().setMessage(bean.getMessage()); if (bean.getStatus() == Status.REQUEST_TERMINATE) { processes.remove(bean.getUniqueId()); if (process.isPaused()) process.resume(); process.terminate(); } else if (bean.getStatus() == Status.REQUEST_PAUSE) { process.pause(); } else if (bean.getStatus() == Status.REQUEST_RESUME) { process.resume(); } } } } catch (EventException ne) { logger.error("Internal error, please contact your support representative.", ne); } }
@Override public void beanChangePerformed(BeanEvent<ConsumerCommandBean> evt) { ConsumerCommandBean bean = evt.getBean(); if (isCommandForMe(bean)) { if (bean instanceof KillBean) terminate((KillBean) bean); if (bean instanceof PauseBean) processPause((PauseBean) bean); } }