Quartz_Job在ejb里的使用

1.实现job接口类 BookingStatusJob.java

package com.raymon.booking.job;

import java.util.Date;

import javax.naming.InitialContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;


public class BookingStatusJob implements Job {
	static Log log = LogFactory.getLog(BookingStatusJob.class);

	public void execute(JobExecutionContext context) throws JobExecutionException {
		log.info("Quartz-------:"+ (new Date()).toLocaleString());
	}

 2.配置文件

ejb-jar.xml
		<ejb-jar>
			<display-name>PullJobChangeStatus-ejb</display-name>
			<enterprise-beans>
				<message-driven>
					<ejb-name>BookingStatusJob</ejb-name>
					<ejb-class>com.raymon.booking.job.BookingStatusJob</ejb-class>
					<messaging-type>org.quartz.Job</messaging-type>
					<transaction-type>Container</transaction-type>
					<activation-config>
						<activation-config-property>
							<activation-config-property-name>cronTrigger</activation-config-property-name>
							<activation-config-property-value><![CDATA[0/15 * * * * ?]]></activation-config-property-value>
						</activation-config-property>
					</activation-config>
				</message-driven>
			</enterprise-beans>
	</ejb-jar>
	
	jboss.xml
		<jboss>
	    <enterprise-beans>
	        <message-driven>
	            <ejb-name>BookingStatusJob</ejb-name>
	            <resource-adapter-name>quartz-ra.rar</resource-adapter-name>
	        </message-driven>
	    </enterprise-beans>
		</jboss>

 

我是使用jboss服务器的

你可能感兴趣的:(quartz)