[jboss-user] [JBoss Seam] - Seam quartz, how to start scheduler after server start?

Stateless Bean do-not-reply at jboss.com
Wed Nov 7 10:07:41 EST 2007


Hi,
Here is my quartz:


  |     public void startInterval() {
  |     	try {
  |     		long a = System.currentTimeMillis();
  |     		//=================================================
  |             Payment payment = new Payment();
  |             payment.setPaymentDate (new Date ());
  |             QuartzTriggerHandle handle = processor.scheduleInterval(payment.getPaymentDate(), 									                    5 * 1000l, null, payment);			
  | 			payment.setQuartzTriggerHandle(handle); 
  | 			em.persist(payment);
  | 			//=================================================			 
  | 			long b = System.currentTimeMillis();
  | 			System.out.println("TIME: " + (b - a) + " ms.");
  | 		}
  | 		catch (Exception e) {
  | 			log.error("schedulerController - startInterval: " + e.getMessage());
  | 		}
  |     }
  | 


  |     @Asynchronous
  |     @Transactional
  |     public QuartzTriggerHandle scheduleInterval(@Expiration Date when, 
  |                                                 @IntervalDuration Long interval, 
  |                                                 @FinalExpiration Date stoptime, 
  |                                                 Payment payment) 
  |     { 
  |         //payment = em.merge(payment);
  |         
  |         log.info("Processing payment: ", System.currentTimeMillis(), payment.getId());
  | 
  |         return null;
  |     }
  | 

When I run scheduler from app, new instance is inserted into db.

If I want to start my scheduler after jboss startup, how can I do it, if my previous scheduler conf is saved in db?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102583#4102583

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102583



More information about the jboss-user mailing list