use of org.apache.airavata.gfac.monitor.email.EmailBasedMonitor in project airavata by apache.
the class Factory method getMonitorService.
public static JobMonitor getMonitorService(MonitorMode monitorMode) throws AiravataException, GFacException {
JobMonitor jobMonitor = jobMonitorServices.get(monitorMode);
if (jobMonitor == null) {
synchronized (JobMonitor.class) {
jobMonitor = jobMonitorServices.get(monitorMode);
if (jobMonitor == null) {
switch(monitorMode) {
case JOB_EMAIL_NOTIFICATION_MONITOR:
EmailBasedMonitor emailBasedMonitor = new EmailBasedMonitor(Factory.getResourceConfig());
jobMonitorServices.put(MonitorMode.JOB_EMAIL_NOTIFICATION_MONITOR, emailBasedMonitor);
jobMonitor = emailBasedMonitor;
new Thread(emailBasedMonitor).start();
break;
case CLOUD_JOB_MONITOR:
AuroraJobMonitor auroraJobMonitor = AuroraJobMonitor.getInstance();
new Thread(auroraJobMonitor).start();
jobMonitorServices.put(MonitorMode.CLOUD_JOB_MONITOR, auroraJobMonitor);
jobMonitor = auroraJobMonitor;
break;
default:
throw new GFacException("Unsupported monitor mode :" + monitorMode.name());
}
}
}
}
return jobMonitor;
}
Aggregations