use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class FrameCollectingScannable method getRequester.
private IRequester<AcquireRequest> getRequester() throws EventException {
if (acquireRequester == null) {
final IEventService eventService = org.eclipse.scanning.sequencer.ServiceHolder.getEventService();
try {
final var uri = new URI(LocalProperties.getActiveMQBrokerURI());
acquireRequester = eventService.createRequestor(uri, EventConstants.ACQUIRE_REQUEST_TOPIC, EventConstants.ACQUIRE_RESPONSE_TOPIC);
acquireRequester.setTimeout(5, TimeUnit.SECONDS);
} catch (URISyntaxException e) {
throw new EventException(e);
}
}
return acquireRequester;
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class RunExperimentNewQueueCommandHandler method submitCommandToQueue.
@Override
protected void submitCommandToQueue(ExperimentCommandProvider commandProvider) throws ExecutionException {
// create the command bean
final Command command = commandProvider.getCommand();
CommandBean bean = createCommandBean(command);
// submit the bean
try {
getSubmitter().submitScan(bean);
} catch (EventException e) {
logger.error("Exception adding ExperimentCommandProvider to queue", e);
throw new ExecutionException("Exception adding ExperimentCommandProvider to queue.", e);
}
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class ApplicationActionBarAdvisor method buildScanStatus.
private StatusLineContributionItem buildScanStatus() {
StatusLineContributionItem scanStatus = new StatusLineContributionItem("GDA-ScanStatus", true, 55);
IEventService service = ServiceHolder.getEventService();
try {
ISubscriber<IBeanListener<StatusBean>> statusTopicSubscriber = service.createSubscriber(getActiveMqUri(), EventConstants.STATUS_TOPIC);
statusTopicSubscriber.addListener(event -> {
if (event.getBean() instanceof ScanBean) {
updateScanDetails(scanStatus, (ScanBean) event.getBean());
}
});
ApplicationWorkbenchAdvisor.addCleanupWork(() -> {
try {
statusTopicSubscriber.removeAllListeners();
statusTopicSubscriber.close();
} catch (EventException e1) {
logger.error("Error removing listener from STATUS_TOPIC", e1);
}
});
} catch (NullPointerException e) {
// Handling for non-StatusQueueView/Mapping beamlines, prevent stack trace being printed to console
if (service == null) {
logger.warn("EventService null when adding listener to STATUS_TOPIC, ScanBean status bar progress disabled. If this beamline uses the Queue, this will cause errors elsewhere");
} else {
throw e;
}
} catch (Exception e2) {
logger.error("Error adding listener to STATUS_TOPIC", e2);
}
return scanStatus;
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class SubmitScanToScriptSection method stopScan.
private void stopScan() {
logger.info("Stopping script & job");
// Stop the script
final JythonServerFacade jythonServerFacade = JythonServerFacade.getInstance();
jythonServerFacade.abortCommands();
try {
// Stop the currently-running job
final List<StatusBean> currentJobs = jobQueueProxy.getRunningAndCompleted();
for (StatusBean job : currentJobs) {
if (job.getStatus() == Status.RUNNING) {
jobQueueProxy.terminateJob(job);
}
}
} catch (EventException e) {
logger.error("Error accessing queue", e);
}
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class NodeFileRequesterService method createNodeFileRequester.
private void createNodeFileRequester() throws EventException {
try {
URI activemqURL = new URI(LocalProperties.getActiveMQBrokerURI());
IEventService eventService = Activator.getService(IEventService.class);
nodeFileRequester = eventService.createRequestor(activemqURL, requestTopic, responseTopic);
nodeFileRequester.setTimeout(5, TimeUnit.SECONDS);
} catch (URISyntaxException e) {
throw new EventException("Cannot create submitter", e);
}
}
Aggregations