[JBoss Seam] - Seam quartz, how to start scheduler after server start?
by Stateless Bean
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
18 years, 6 months
[JBoss Seam] - Re: Running SeamTest-based tests inside an applicatoin serve
by dmitriy.lapko
Thank you for answer, I tried to override it and the test started, but it breaks the application.
I get
WARNING: No active application scope
| java.lang.IllegalStateException: No active application scope
| at org.jboss.seam.core.Init.instance(Init.java:75)
|
after its work.
And before test there is warning:
"There should only be one Seam phase listener per application"
So the problem is in method BaseSeamTest.init:
public void init() throws Exception
| {
| startJbossEmbeddedIfNecessary(); // We should skip it
|
| application = new SeamApplication( new MockApplication() ); // reuse here existsing application
| phases = new SeamPhaseListener(); // reuse existing phase listener
|
| servletContext = new MockServletContext(); // reuse context
| initServletContext( servletContext.getInitParameters() ); // don't initialize it
|
| // And more and more...
|
| ServletLifecycle.beginApplication(servletContext);
| new Initialization(servletContext).create().init();
| ( (Init) servletContext.getAttribute( Seam.getComponentName(Init.class) ) ).setDebug(false);
| conversationViewRootAttributes = new HashMap<String, Map>();
| seamFilter = createSeamFilter();
|
| for (ELResolver elResolver : getELResolvers())
| {
| application.addELResolver(elResolver);
| }
|
| }
I mean, it looks like there should be done a lot of things to use tests in working application for testing deployment and web server compatibility.
Am I right or there is more simple way?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102580#4102580
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102580
18 years, 6 months