當前位置: 首頁>>代碼示例>>Java>>正文


Java JobListener類代碼示例

本文整理匯總了Java中org.quartz.JobListener的典型用法代碼示例。如果您正苦於以下問題:Java JobListener類的具體用法?Java JobListener怎麽用?Java JobListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JobListener類屬於org.quartz包,在下文中一共展示了JobListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addJobListener

import org.quartz.JobListener; //導入依賴的package包/類
public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) {
    if (jobListener.getName() == null || jobListener.getName().length() == 0) {
        throw new IllegalArgumentException(
                "JobListener name cannot be empty.");
    }
    
    synchronized (globalJobListeners) {
        globalJobListeners.put(jobListener.getName(), jobListener);
        LinkedList<Matcher<JobKey>> matchersL = new  LinkedList<Matcher<JobKey>>();
        if(matchers != null && matchers.size() > 0)
            matchersL.addAll(matchers);
        else
            matchersL.add(EverythingMatcher.allJobs());
        
        globalJobListenersMatchers.put(jobListener.getName(), matchersL);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:ListenerManagerImpl.java

示例2: notifyJobListenersToBeExecuted

import org.quartz.JobListener; //導入依賴的package包/類
public void notifyJobListenersToBeExecuted(JobExecutionContext jec)
    throws SchedulerException {
    // build a list of all job listeners that are to be notified...
    List<JobListener> jobListeners = buildJobListenerList();

    // notify all job listeners
    for(JobListener jl: jobListeners) {
        try {
            if(!matchJobListener(jl, jec.getJobDetail().getKey()))
                continue;
            jl.jobToBeExecuted(jec);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "JobListener '" + jl.getName() + "' threw exception: "
                            + e.getMessage(), e);
            throw se;
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:QuartzScheduler.java

示例3: notifyJobListenersWasVetoed

import org.quartz.JobListener; //導入依賴的package包/類
public void notifyJobListenersWasVetoed(JobExecutionContext jec)
    throws SchedulerException {
    // build a list of all job listeners that are to be notified...
    List<JobListener> jobListeners = buildJobListenerList();

    // notify all job listeners
    for(JobListener jl: jobListeners) {
        try {
            if(!matchJobListener(jl, jec.getJobDetail().getKey()))
                continue;
            jl.jobExecutionVetoed(jec);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "JobListener '" + jl.getName() + "' threw exception: "
                    + e.getMessage(), e);
            throw se;
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:QuartzScheduler.java

示例4: notifyJobListenersWasExecuted

import org.quartz.JobListener; //導入依賴的package包/類
public void notifyJobListenersWasExecuted(JobExecutionContext jec,
        JobExecutionException je) throws SchedulerException {
    // build a list of all job listeners that are to be notified...
    List<JobListener> jobListeners = buildJobListenerList();

    // notify all job listeners
    for(JobListener jl: jobListeners) {
        try {
            if(!matchJobListener(jl, jec.getJobDetail().getKey()))
                continue;
            jl.jobWasExecuted(jec, je);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "JobListener '" + jl.getName() + "' threw exception: "
                            + e.getMessage(), e);
            throw se;
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:QuartzScheduler.java

示例5: buildJobListenerList

import org.quartz.JobListener; //導入依賴的package包/類
private List buildJobListenerList(String[] additionalLstnrs)
    throws SchedulerException {
    List jobListeners = getGlobalJobListeners();
    for (int i = 0; i < additionalLstnrs.length; i++) {
        JobListener jl = getJobListener(additionalLstnrs[i]);

        if (jl != null) {
            jobListeners.add(jl);
        } else {
            throw new SchedulerException("JobListener '"
                    + additionalLstnrs[i] + "' not found.",
                    SchedulerException.ERR_JOB_LISTENER_NOT_FOUND);
        }
    }

    return jobListeners;
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:18,代碼來源:QuartzScheduler.java

示例6: notifyJobListenersToBeExecuted

import org.quartz.JobListener; //導入依賴的package包/類
public void notifyJobListenersToBeExecuted(JobExecutionContext jec)
    throws SchedulerException {
    // build a list of all job listeners that are to be notified...
    List jobListeners = buildJobListenerList(jec.getJobDetail()
            .getJobListenerNames());

    // notify all job listeners
    java.util.Iterator itr = jobListeners.iterator();
    while (itr.hasNext()) {
        JobListener jl = (JobListener) itr.next();
        try {
            jl.jobToBeExecuted(jec);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "JobListener '" + jl.getName() + "' threw exception: "
                            + e.getMessage(), e);
            se.setErrorCode(SchedulerException.ERR_JOB_LISTENER);
            throw se;
        }
    }
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:22,代碼來源:QuartzScheduler.java

示例7: notifyJobListenersWasVetoed

import org.quartz.JobListener; //導入依賴的package包/類
public void notifyJobListenersWasVetoed(JobExecutionContext jec)
    throws SchedulerException {
    // build a list of all job listeners that are to be notified...
    List jobListeners = buildJobListenerList(jec.getJobDetail()
            .getJobListenerNames());

    // notify all job listeners
    java.util.Iterator itr = jobListeners.iterator();
    while (itr.hasNext()) {
        JobListener jl = (JobListener) itr.next();
        try {
            jl.jobExecutionVetoed(jec);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "JobListener '" + jl.getName() + "' threw exception: "
                    + e.getMessage(), e);
            se.setErrorCode(SchedulerException.ERR_JOB_LISTENER);
            throw se;
        }
    }
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:22,代碼來源:QuartzScheduler.java

示例8: removeGlobalJobListener

import org.quartz.JobListener; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void removeGlobalJobListener(Class<? extends JobListener> jobListenerClass)
		throws SchedulerException {
	for (final Scheduler scheduler : JobInformations.getAllSchedulers()) {
		final List<JobListener> globalJobListeners = scheduler.getGlobalJobListeners();
		for (final JobListener jobListener : new ArrayList<JobListener>(globalJobListeners)) {
			if (jobListenerClass.isInstance(jobListener)) {
				try {
					scheduler.removeGlobalJobListener(jobListener);
				} catch (final NoSuchMethodError e1) {
					// pour Quartz 1.7, 1.8 et +,
					// cette méthode n'existe pas avant Quartz 1.6
					try {
						final Class<? extends Scheduler> schedulerClass = scheduler.getClass();
						schedulerClass.getMethod("removeGlobalJobListener", String.class)
								.invoke(scheduler, jobListener.getName());
					} catch (final Exception e2) {
						throw new IllegalArgumentException(e2);
					}
				}
			}
		}
	}
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:25,代碼來源:QuartzAdapter.java

示例9: addGlobalJobListener

import org.quartz.JobListener; //導入依賴的package包/類
@Override
public void addGlobalJobListener(JobListener jobGlobalListener) throws SchedulerException {
	final Scheduler defaultScheduler;
	final List<Matcher<JobKey>> allJobs = new ArrayList<Matcher<JobKey>>();
	allJobs.add(EverythingMatcher.allJobs());
	if (Parameter.QUARTZ_DEFAULT_LISTENER_DISABLED.getValueAsBoolean()) {
		defaultScheduler = null;
		LOG.debug("Initialization of Quartz default listener has been disabled");
	} else {
		defaultScheduler = StdSchedulerFactory.getDefaultScheduler();
		defaultScheduler.getListenerManager().addJobListener(jobGlobalListener, allJobs);
	}
	for (final Scheduler scheduler : JobInformations.getAllSchedulers()) {
		if (scheduler != defaultScheduler) {
			scheduler.getListenerManager().addJobListener(jobGlobalListener, allJobs);
		}
	}
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:19,代碼來源:Quartz2Adapter.java

示例10: afterPropertiesSet

import org.quartz.JobListener; //導入依賴的package包/類
public void afterPropertiesSet() throws Exception {
    if (this.jobListeners != null && this.jobListeners.size() > 0) {
        logger.debug("Initing task scheduler[" + this.scheduler.getSchedulerName() + "] , add listener size :"
            + this.jobListeners.size());
        for (JobListener listener : this.jobListeners) {
            logger.debug("Add JobListener : " + listener.getName());
            this.scheduler.getListenerManager().addJobListener(listener);
        }
    }
}
 
開發者ID:iBase4J,項目名稱:iBase4J-Common,代碼行數:11,代碼來源:SchedulerManager.java

示例11: afterPropertiesSet

import org.quartz.JobListener; //導入依賴的package包/類
public void afterPropertiesSet() throws Exception {
    if (this.jobListeners != null && this.jobListeners.size() > 0) {
        if (logger.isInfoEnabled()) {
            logger.info("Initing task scheduler[" + this.scheduler.getSchedulerName() + "] , add listener size :"
                + this.jobListeners.size());
        }
        for (JobListener listener : this.jobListeners) {
            if (logger.isInfoEnabled()) {
                logger.info("Add JobListener : " + listener.getName());
            }
            this.scheduler.getListenerManager().addJobListener(listener);
        }
    }
}
 
開發者ID:guokezheng,項目名稱:automat,代碼行數:15,代碼來源:SchedulerManager.java

示例12: BroadcastJobListener

import org.quartz.JobListener; //導入依賴的package包/類
/**
 * Construct an instance with the given name.
 *
 * (Remember to add some delegate listeners!)
 *
 * @param name the name of this instance
 */
public BroadcastJobListener(String name) {
    if(name == null) {
        throw new IllegalArgumentException("Listener name cannot be null!");
    }
    this.name = name;
    listeners = new LinkedList<JobListener>();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:BroadcastJobListener.java

示例13: removeListener

import org.quartz.JobListener; //導入依賴的package包/類
public boolean removeListener(String listenerName) {
    Iterator<JobListener> itr = listeners.iterator();
    while(itr.hasNext()) {
        JobListener jl = itr.next();
        if(jl.getName().equals(listenerName)) {
            itr.remove();
            return true;
        }
    }
    return false;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:BroadcastJobListener.java

示例14: jobToBeExecuted

import org.quartz.JobListener; //導入依賴的package包/類
public void jobToBeExecuted(JobExecutionContext context) {

        Iterator<JobListener> itr = listeners.iterator();
        while(itr.hasNext()) {
            JobListener jl = itr.next();
            jl.jobToBeExecuted(context);
        }
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:BroadcastJobListener.java

示例15: jobExecutionVetoed

import org.quartz.JobListener; //導入依賴的package包/類
public void jobExecutionVetoed(JobExecutionContext context) {

        Iterator<JobListener> itr = listeners.iterator();
        while(itr.hasNext()) {
            JobListener jl = itr.next();
            jl.jobExecutionVetoed(context);
        }
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:BroadcastJobListener.java


注:本文中的org.quartz.JobListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。