/[projects]/miscJava/Test3/src/dk/thoerup/schedulesamples/TimedEjbServlet.java
ViewVC logotype

Contents of /miscJava/Test3/src/dk/thoerup/schedulesamples/TimedEjbServlet.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1279 - (show annotations) (download)
Thu Apr 7 20:20:04 2011 UTC (13 years, 1 month ago) by torben
File size: 933 byte(s)
Add first bits of EJB timer sample - for some reason my glassfish wont start the ejb timer service
1 package dk.thoerup.schedulesamples;
2
3 import java.io.IOException;
4 import java.util.Calendar;
5
6 import javax.annotation.Resource;
7 import javax.ejb.SessionContext;
8 import javax.ejb.Timer;
9 import javax.ejb.TimerService;
10 import javax.servlet.ServletException;
11 import javax.servlet.annotation.WebServlet;
12 import javax.servlet.http.HttpServlet;
13 import javax.servlet.http.HttpServletRequest;
14 import javax.servlet.http.HttpServletResponse;
15
16
17 @WebServlet(name = "TimedEjbServlet", urlPatterns = { "/TimedEjbServlet" })
18 public class TimedEjbServlet extends HttpServlet{
19
20 @Resource
21 SessionContext sessionCtx;
22
23
24 @Override
25 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
26
27 TimerService timerService = sessionCtx.getTimerService();
28
29
30 Calendar now = Calendar.getInstance();
31 Timer timer = timerService.createTimer(now.getTimeInMillis() + (10 * 1000), null);
32
33
34 }
35 }

  ViewVC Help
Powered by ViewVC 1.1.20