Friday, July 24, 2009

Create EJBTimer On Weblogic 10.3 using resource injection

Programming the EJB Timer Service
http://edocs.bea.com/wls/docs103/ejb/implementing.html#wp1191405

EJB 3.0 Metadata Annotations Reference
http://edocs.bea.com/wls/docs103/ejb30/annotations.html#wp1425297

Interface TimerService.createTimer
http://java.sun.com/j2ee/1.4/docs/api/javax/ejb/TimerService.html#createTimer%28long,%20long,%20java.io.Serializable%29

@Local
@Remote
@Stateless(mappedName = "ejb/TestTimer")
public class TestTimerEJB implements TestTimer {


// resources that the container will inject
@Resource
private TimerService timerService;

//inject data source
@Resource(mappedName="jdbc/MyDataSource")
private javax.sql.DataSource datasource;


@Timeout
public void execute(Timer timer) {
System.out.println("Hi from TestTimerEJB timer");
}

No comments:

Post a Comment