public void delegateToMonitorHandlers(JobExecutionContext jobExecutionContext, GsisshHostType host, String jobID) throws GFacHandlerException {
List<ThreadedHandler> daemonHandlers = GFacImpl.getDaemonHandlers();
if (daemonHandlers == null) {
daemonHandlers = BetterGfacImpl.getDaemonHandlers();
}
ThreadedHandler pullMonitorHandler = null;
ThreadedHandler pushMonitorHandler = null;
String monitorMode = ((GsisshHostType) host).getMonitorMode();
for (ThreadedHandler threadedHandler : daemonHandlers) {
if ("org.apache.airavata.gfac.monitor.handlers.GridPullMonitorHandler".equals(threadedHandler.getClass().getName())) {
pullMonitorHandler = threadedHandler;
if ("".equals(monitorMode) || monitorMode == null || org.apache.airavata.common.utils.Constants.PULL.equals(monitorMode)) {
log.info("Job is launched successfully now parsing it to monitoring in pull mode, JobID Returned: " + jobID);
pullMonitorHandler.invoke(jobExecutionContext);
} else {
log.error("Currently we only support Pull and Push monitoring and monitorMode should be PULL" +
" to handle by the GridPullMonitorHandler");
}
} else if ("org.apache.airavata.gfac.monitor.handlers.GridPushMonitorHandler".equals(threadedHandler.getClass().getName())) {
pushMonitorHandler = threadedHandler;
if ("".equals(monitorMode) || monitorMode == null || org.apache.airavata.common.utils.Constants.PUSH.equals(monitorMode)) {
log.info("Job is launched successfully now parsing it to monitoring in push mode, JobID Returned: " + jobID);
pushMonitorHandler.invoke(jobExecutionContext);
} else {
log.error("Currently we only support Pull and Push monitoring and monitorMode should be PUSH" +
" to handle by the GridPushMonitorHandler");
}
}