Hi all, I'm pretty new to seam, but I managed to get it working with everything 
I need, except for this one! I need a very simple task executed every 10 
seconds, switching on and off from the web interface, starting immediatly at 
deploy time and automaticly stop at undeploy or jboss shutdown. Don't worry, 
most parts work ;)

I use a simple java.util.Timer to accomplish this and some annotations to 
expose to seam. This is (somewhat simplified) my code:

  | @Name("MyService")
  | @Scope(ScopeType.APPLICATION)
  | @Startup()
  | public class MyService {
  |    private Timer timer;
  |    
  |    @Create()
  |    public void start() {
  |       this.timer = new Timer();
  |       this.timer.scheduleAtFixedRate(new MyTask(), 0, 10000);
  |    }
  |    
  |    @Destroy()
  |    public void stop() {
  |       this.timer.cancel();
  |    }
  | }
  | 

Code works perfectly, it's started on deploy time automaticly, and the methods 
are callable by the web interface wich stops and starts the timer as expected. 
However, on undeploy or shutting down jboss, I get the following exception:

  | [Contexts] Could not destroy component: MyService
  | java.lang.IllegalStateException: No active event context
  | <--- impressive stack trace goes here --->
  | 
and the timer keeps running... 

Can someone help me out here? Thanks in advance,
Eric

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003376
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to