Search in sources :

Example 1 with AuroraJobMonitor

use of org.apache.airavata.gfac.monitor.cloud.AuroraJobMonitor 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;
}
Also used : GFacException(org.apache.airavata.gfac.core.GFacException) EmailBasedMonitor(org.apache.airavata.gfac.monitor.email.EmailBasedMonitor) AuroraJobMonitor(org.apache.airavata.gfac.monitor.cloud.AuroraJobMonitor) JobMonitor(org.apache.airavata.gfac.core.monitor.JobMonitor) AuroraJobMonitor(org.apache.airavata.gfac.monitor.cloud.AuroraJobMonitor)

Aggregations

GFacException (org.apache.airavata.gfac.core.GFacException)1 JobMonitor (org.apache.airavata.gfac.core.monitor.JobMonitor)1 AuroraJobMonitor (org.apache.airavata.gfac.monitor.cloud.AuroraJobMonitor)1 EmailBasedMonitor (org.apache.airavata.gfac.monitor.email.EmailBasedMonitor)1