List of usage examples for javax.jms ObjectMessage getObject
Serializable getObject() throws JMSException;
From source file:ubic.gemma.core.job.executor.worker.TaskSubmissionListener.java
@Override public void onMessage(Message message) { log.info("Received new remote task command!"); ObjectMessage objectMessage = (ObjectMessage) message; TaskCommand taskCommand = null;// www. ja va2s . c o m try { taskCommand = (TaskCommand) objectMessage.getObject(); } catch (JMSException e) { e.printStackTrace(); } log.info("Submitting task command for execution."); remoteTaskRunningService.submit(taskCommand); }
From source file:ubic.gemma.job.executor.worker.TaskControlListener.java
@Override public void onMessage(Message message) { ObjectMessage objectMessage = (ObjectMessage) message; try {/*www . ja v a 2 s . c om*/ TaskControl taskControl = (TaskControl) objectMessage.getObject(); String taskId = taskControl.getTaskId(); assert taskId != null; SubmittedTaskRemote submittedTask = remoteTaskRunningService.getSubmittedTask(taskControl.getTaskId()); if (submittedTask == null) { log.warn("Got control request for taskId:" + taskId + ", but no submitted task found."); return; } switch (taskControl.getRequest()) { case CANCEL: log.info("Received CANCEL control message for task: " + taskControl.getTaskId()); submittedTask.requestCancellation(); break; case ADD_EMAIL_NOTIFICATION: log.info("Received ADD_EMAIL_NOTIFICATION control message for task: " + taskControl.getTaskId()); submittedTask.addEmailAlertNotificationAfterCompletion(); break; } } catch (JMSException e) { log.warn("Got JMSException: " + e.getMessage()); } }