亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? methodinvokingjobdetailfactorybean.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.scheduling.quartz;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.StatefulJob;

import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.support.ArgumentConvertingMethodInvoker;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.MethodInvoker;

/**
 * {@link org.springframework.beans.factory.FactoryBean} that exposes a
 * {@link org.quartz.JobDetail} object which delegates job execution to a
 * specified (static or non-static) method. Avoids the need for implementing
 * a one-line Quartz Job that just invokes an existing service method on a
 * Spring-managed target bean.
 *
 * <p>Inherits common configuration properties from the {@link MethodInvoker}
 * base class, such as {@link #setTargetObject "targetObject"} and
 * {@link #setTargetMethod "targetMethod"}, adding support for lookup of the target
 * bean by name through the {@link #setTargetBeanName "targetBeanName"} property
 * (as alternative to specifying a "targetObject" directly, allowing for
 * non-singleton target objects).
 *
 * <p>Supports both concurrently running jobs and non-currently running
 * jobs through the "concurrent" property. Jobs created by this
 * MethodInvokingJobDetailFactoryBean are by default volatile and durable
 * (according to Quartz terminology).
 *
 * <p><b>NOTE: JobDetails created via this FactoryBean are <i>not</i>
 * serializable and thus not suitable for persistent job stores.</b>
 * You need to implement your own Quartz Job as a thin wrapper for each case
 * where you want a persistent job to delegate to a specific service method.
 *
 * @author Juergen Hoeller
 * @author Alef Arendsen
 * @since 18.02.2004
 * @see #setTargetBeanName
 * @see #setTargetObject
 * @see #setTargetMethod
 * @see #setConcurrent
 */
public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethodInvoker
    implements FactoryBean, BeanNameAware, BeanClassLoaderAware, BeanFactoryAware, InitializingBean {

	private String name;

	private String group = Scheduler.DEFAULT_GROUP;

	private boolean concurrent = true;

	private String targetBeanName;

	private String[] jobListenerNames;

	private String beanName;

	private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();

	private BeanFactory beanFactory;

	private JobDetail jobDetail;


	/**
	 * Set the name of the job.
	 * <p>Default is the bean name of this FactoryBean.
	 * @see org.quartz.JobDetail#setName
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Set the group of the job.
	 * <p>Default is the default group of the Scheduler.
	 * @see org.quartz.JobDetail#setGroup
	 * @see org.quartz.Scheduler#DEFAULT_GROUP
	 */
	public void setGroup(String group) {
		this.group = group;
	}
	
	/**
	 * Specify whether or not multiple jobs should be run in a concurrent
	 * fashion. The behavior when one does not want concurrent jobs to be
	 * executed is realized through adding the {@link StatefulJob} interface.
	 * More information on stateful versus stateless jobs can be found
	 * <a href="http://www.opensymphony.com/quartz/tutorial.html#jobsMore">here</a>.
	 * <p>The default setting is to run jobs concurrently.
	 */
	public void setConcurrent(boolean concurrent) {
		this.concurrent = concurrent;
	}

	/**
	 * Set the name of the target bean in the Spring BeanFactory.
	 * <p>This is an alternative to specifying {@link #setTargetObject "targetObject"},
	 * allowing for non-singleton beans to be invoked. Note that specified
	 * "targetObject" and {@link #setTargetClass "targetClass"} values will
	 * override the corresponding effect of this "targetBeanName" setting
	 * (i.e. statically pre-define the bean type or even the bean object).
	 */
	public void setTargetBeanName(String targetBeanName) {
		this.targetBeanName = targetBeanName;
	}

	/**
	 * Set a list of JobListener names for this job, referring to
	 * non-global JobListeners registered with the Scheduler.
	 * <p>A JobListener name always refers to the name returned
	 * by the JobListener implementation.
	 * @see SchedulerFactoryBean#setJobListeners
	 * @see org.quartz.JobListener#getName
	 */
	public void setJobListenerNames(String[] names) {
		this.jobListenerNames = names;
	}

	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	public void setBeanClassLoader(ClassLoader classLoader) {
		this.beanClassLoader = classLoader;
	}

	public void setBeanFactory(BeanFactory beanFactory) {
		this.beanFactory = beanFactory;
	}

	protected Class resolveClassName(String className) throws ClassNotFoundException {
		return ClassUtils.forName(className, this.beanClassLoader);
	}


	public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException {
		prepare();

		// Use specific name if given, else fall back to bean name.
		String name = (this.name != null ? this.name : this.beanName);

		// Consider the concurrent flag to choose between stateful and stateless job.
		Class jobClass = (this.concurrent ? (Class) MethodInvokingJob.class : StatefulMethodInvokingJob.class);

		// Build JobDetail instance.
		this.jobDetail = new JobDetail(name, this.group, jobClass);
		this.jobDetail.getJobDataMap().put("methodInvoker", this);
		this.jobDetail.setVolatility(true);
		this.jobDetail.setDurability(true);

		// Register job listener names.
		if (this.jobListenerNames != null) {
			for (int i = 0; i < this.jobListenerNames.length; i++) {
				this.jobDetail.addJobListener(this.jobListenerNames[i]);
			}
		}

		postProcessJobDetail(this.jobDetail);
	}

	/**
	 * Callback for post-processing the JobDetail to be exposed by this FactoryBean.
	 * <p>The default implementation is empty. Can be overridden in subclasses.
	 * @param jobDetail the JobDetail prepared by this FactoryBean
	 */
	protected void postProcessJobDetail(JobDetail jobDetail) {
	}


	/**
	 * Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
	 */
	public Class getTargetClass() {
		Class targetClass = super.getTargetClass();
		if (targetClass == null && this.targetBeanName != null) {
			Assert.state(this.beanFactory != null, "BeanFactory must be set when using 'targetBeanName'");
			targetClass = this.beanFactory.getType(this.targetBeanName);
		}
		return targetClass;
	}

	/**
	 * Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
	 */
	public Object getTargetObject() {
		Object targetObject = super.getTargetObject();
		if (targetObject == null && this.targetBeanName != null) {
			Assert.state(this.beanFactory != null, "BeanFactory must be set when using 'targetBeanName'");
			targetObject = this.beanFactory.getBean(this.targetBeanName);
		}
		return targetObject;
	}


	public Object getObject() {
		return this.jobDetail;
	}

	public Class getObjectType() {
		return JobDetail.class;
	}

	public boolean isSingleton() {
		return true;
	}


	/**
	 * Quartz Job implementation that invokes a specified method.
	 * Automatically applied by MethodInvokingJobDetailFactoryBean.
	 */
	public static class MethodInvokingJob extends QuartzJobBean {

		protected static final Log logger = LogFactory.getLog(MethodInvokingJob.class);

		private MethodInvoker methodInvoker;

		/**
		 * Set the MethodInvoker to use.
		 */
		public void setMethodInvoker(MethodInvoker methodInvoker) {
			this.methodInvoker = methodInvoker;
		}

		/**
		 * Invoke the method via the MethodInvoker.
		 */
		protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
			try {
				this.methodInvoker.invoke();
			}
			catch (InvocationTargetException ex) {
				if (ex.getTargetException() instanceof JobExecutionException) {
					// -> JobExecutionException, to be logged at info level by Quartz
					throw (JobExecutionException) ex.getTargetException();
				}
				else {
					// -> "unhandled exception", to be logged at error level by Quartz
					throw new JobMethodInvocationFailedException(this.methodInvoker, ex.getTargetException());
				}
			}
			catch (Exception ex) {
				// -> "unhandled exception", to be logged at error level by Quartz
				throw new JobMethodInvocationFailedException(this.methodInvoker, ex);
			}
		}
	}


	/**
	 * Extension of the MethodInvokingJob, implementing the StatefulJob interface.
	 * Quartz checks whether or not jobs are stateful and if so,
	 * won't let jobs interfere with each other.
	 */
	public static class StatefulMethodInvokingJob extends MethodInvokingJob implements StatefulJob {

		// No implementation, just an addition of the tag interface StatefulJob
		// in order to allow stateful method invoking jobs.
	}

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本成人中文字幕| 久久不见久久见免费视频1| 亚洲综合999| 精油按摩中文字幕久久| youjizz久久| 日韩一区二区免费在线观看| 精品国产露脸精彩对白| 亚洲精品大片www| 国产福利一区在线观看| 欧美精品第1页| 精品国产青草久久久久福利| 一区二区三区四区视频精品免费 | 国模大尺度一区二区三区| 成人avav影音| 久久这里只有精品首页| 五月综合激情婷婷六月色窝| 99这里只有久久精品视频| 久久婷婷国产综合国色天香 | 一区二区三区高清不卡| 国产精品18久久久久| 在线电影国产精品| 一区二区三区四区在线| 色哟哟国产精品| 亚洲国产精品黑人久久久| 久久 天天综合| 欧美一区二区三区日韩视频| 亚洲成人免费在线| 欧美日韩你懂得| 亚洲精品中文字幕乱码三区| 国产一区二区精品久久99 | 欧美日韩免费一区二区三区视频| 亚洲欧洲在线观看av| 成人永久aaa| 国产精品大尺度| 成人免费视频视频| 中文字幕一区在线观看视频| 成人精品国产免费网站| 亚洲天天做日日做天天谢日日欢| 成人午夜在线播放| 亚洲日本乱码在线观看| 色婷婷精品大视频在线蜜桃视频 | 在线观看一区二区视频| 亚洲精品成人精品456| 色哟哟一区二区在线观看| 亚洲一区二区在线免费观看视频 | www.66久久| 一区二区视频免费在线观看| 日本韩国一区二区三区视频| 亚洲国产精品天堂| 日韩一区二区视频| 国产99久久久精品| 亚洲精品日韩一| 7777精品伊人久久久大香线蕉的 | 色香蕉成人二区免费| 一区二区三区中文字幕电影 | 久久久久久久久蜜桃| 国产成人鲁色资源国产91色综| 欧美激情在线一区二区三区| 91免费精品国自产拍在线不卡| 一区二区三区蜜桃网| 日韩视频在线你懂得| 国产成人超碰人人澡人人澡| 亚洲天堂中文字幕| 91麻豆精品国产91久久久| 国产99精品视频| 亚洲国产wwwccc36天堂| 久久这里只有精品首页| 色综合咪咪久久| 麻豆成人91精品二区三区| 国产欧美一区二区三区在线看蜜臀 | 中文乱码免费一区二区| 国产精品一品二品| 亚洲自拍偷拍九九九| 亚洲精品一区在线观看| 成人动漫在线一区| 日韩成人免费在线| 中文字幕日韩一区| 日韩片之四级片| 91一区二区在线| 精品中文字幕一区二区| 亚洲人成精品久久久久久| 日韩精品专区在线影院重磅| 97se亚洲国产综合自在线观| 日本视频中文字幕一区二区三区 | 欧美大片国产精品| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美艳星brazzers| 国产一区免费电影| 偷拍与自拍一区| 久久精品人人做人人综合| 欧美日韩国产欧美日美国产精品| 国产成人午夜片在线观看高清观看| 性做久久久久久免费观看| 中文字幕一区日韩精品欧美| 欧美大片国产精品| 3atv在线一区二区三区| 色香蕉成人二区免费| 成人精品鲁一区一区二区| 国产制服丝袜一区| 美国三级日本三级久久99| 亚洲综合精品久久| 亚洲欧美国产高清| 国产精品高潮久久久久无| 久久久久国产一区二区三区四区 | 国产精品毛片无遮挡高清| 欧美成人女星排名| 91精品国产入口| 欧美精品色综合| 欧美日韩久久一区| 精品视频一区二区三区免费| 91免费看`日韩一区二区| 91色婷婷久久久久合中文| 波多野结衣视频一区| 成人手机在线视频| 成人免费高清在线| 成人av在线电影| av欧美精品.com| 91亚洲男人天堂| 色综合久久88色综合天天6 | 一区av在线播放| 亚洲精品免费在线播放| 一级中文字幕一区二区| 亚洲线精品一区二区三区| 性做久久久久久免费观看欧美| 天天综合色天天| 久久99久久99精品免视看婷婷| 精品一区二区免费| 国产乱一区二区| 99精品一区二区三区| 色婷婷久久久久swag精品| 欧美日韩精品三区| 日韩欧美国产不卡| 久久久久国产精品麻豆| 国产精品高潮呻吟| 亚洲成av人片在www色猫咪| 视频精品一区二区| 紧缚捆绑精品一区二区| 国产精品一区二区男女羞羞无遮挡| 国产成人av电影在线播放| 欧美第一区第二区| 91福利精品第一导航| 欧美日精品一区视频| 欧美福利视频一区| 久久久激情视频| 中文字幕在线一区免费| 亚洲大片精品永久免费| 看电视剧不卡顿的网站| 国产成人av电影| 欧美视频日韩视频在线观看| 777欧美精品| 国产精品久久久久久久久动漫| 一区二区三区波多野结衣在线观看| 日韩精品一二三| 成人激情小说乱人伦| 337p亚洲精品色噜噜狠狠| 国产亚洲成年网址在线观看| 一区二区三区四区不卡视频| 激情综合网av| 在线免费观看成人短视频| 久久亚洲综合色| 亚洲影院理伦片| 免费成人小视频| 精一区二区三区| 欧美一区在线视频| 国产三级欧美三级| 午夜精品久久久久久久99水蜜桃 | 久久久久久久久久久99999| 一区二区三区在线视频免费观看| 精品午夜一区二区三区在线观看| 91在线视频播放| 欧美精品一区二区不卡 | 久久99久久99小草精品免视看| 色天使色偷偷av一区二区| 久久蜜桃av一区二区天堂| 亚洲国产va精品久久久不卡综合 | 亚洲欧洲www| 韩国av一区二区| 欧美日韩国产123区| 1000精品久久久久久久久| 国产乱码精品一区二区三| 日韩三级中文字幕| 天天色综合天天| 欧美三级电影一区| 亚洲日本在线天堂| 99综合电影在线视频| 亚洲国产高清在线| 国产美女一区二区三区| 日韩女优制服丝袜电影| 丝袜美腿亚洲色图| 欧美日韩黄色一区二区| 一区二区理论电影在线观看| 91色porny| 亚洲欧美另类在线| 色综合久久久久综合体桃花网| 国产精品久久毛片| 成人精品视频一区二区三区| 欧美激情综合网| 成人av在线资源| 国产精品久久免费看| www.欧美精品一二区|