Thanks. That worked rather well. I am now trying to "inject" a reference to my
stateless bean via annotation. When I try to run this I get a
NullPointerException.
I think it would be nice if it was possible to inject a reference to a bean via
@EJB3. I suppose I'll have to perform a "manual" lookup. Another 2 lines of
code :-(
| /*
| * JBossSchedulable.java
| */
|
| package com.helveta.cis.cie.scheduler;
|
| import java.util.Date;
| import javax.annotation.EJB;
| import org.apache.log4j.Logger;
| import org.jboss.varia.scheduler.Schedulable;
|
| /**
| *
| * @author Alex
| */
| public class JBossSchedulable implements Schedulable
| {
| private static final Logger log =
Logger.getLogger(JBossSchedulable.class);
| private String name;
| private long value;
|
| @EJB3
| private Scheduler scheduler;
|
| public JBossSchedulable(String name, long value)
| {
| this.name = name;
| this.value = value;
| log.info("ctor, name: " + name + ", value: " + value);
| }
|
| public void perform(Date now, long remainingRepetitions)
| {
| log.info("perform, now: " + now +", remainingRepetitions: " +
remainingRepetitions +", name: " + name + ", value: " + value);
| try
| {
| scheduler.check();
| }
| catch (Exception e)
| {
| log.info("Unable to CHECK scheduler",e);
| }
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924549#3924549
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924549
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user