当前位置: 代码迷 >> Web前端 >> Quartz_Job在ejb里的施用
  详细解决方案

Quartz_Job在ejb里的施用

热度:166   发布时间:2012-11-23 22:54:33.0
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服务器的

  相关解决方案