Hi,

For some reason, my stateless session bean starts a long running "process" (not 
in OS terms) like this code:


  | private @Resource SessionContext sctx;
  | .....
  | sctx.getTimerService().createTimer(1, obj);
  | 

The long running process is in timer code. And it creates a Queue object and 
gives it a JNDI name like this:


  | @Timeout
  |     public void timeoutHandler(javax.ejb.Timer timer)
  |     {
  |         InitialContext inictx = new InitialContext();
  |         this.commandQueue = new ConcurrentLinkedQueue<SomeMsg>();
  |         inictx.bind("CmdQueue", this.commandQueue);
  |     }
  | 

And this created queue is used to accept commands from other session beans, 
like this:


  | SomeMsg msg = this.commandQueue.poll();
  | 

And then acts accordingly. Other session beans can send a message to this 
process like the following:


  | InitialContext ctx = new InitialContext();
  | Queue<SomeMsg> queue = (Queue<SomeMsg>) ctx.lookup("CmdQueue");
  | queue.add(msg);
  | 

And the process unbinds the name before finishing.

Are there any pitfalls in this approach?

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

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

Reply via email to