piotrekde [http://community.jboss.org/people/piotrekde] created the discussion
"Re: Number of stateless beans" To view the discussion, visit: http://community.jboss.org/message/582853#582853 -------------------------------------------------------------- I found that I can use org.jboss.ejb3.common.proxy.plugins.async.AsyncUtils in the following way: @Stateful public class ComputerBean implements ComputerRemote { @EJB private ProcessorLocal processor; public void startComputations() { Random r = new Random(); while(true) { AsyncUtils.mixinAsync(processor).compute(r.nextInt()); } } } Then it is possible to use Future interface to get result (when it will be ready). I tested it - works, but I have also noticed something strange. Let's consider following code: @Stateless public class ProcessorBean implements ProcessorLocal { private static int COUNTER = 0; @PostConstruct public void init() { System.out.println("constructing"); COUNTER++; } @PreDestroy public void destroy() { System.out.println("destroying"); COUNTER--; } public void compute(int i) { System.out.println("----------------> " + COUNTER); // some dummy computations - it's here only in order to take some time double d = 0.3; for (int j=0; j<100; j++) { d+= 0.2 % 4 + i; } } } Counter is increased and printed to the console - it looks as SLSB are pooled and their number is increased when needed. However, counter is _never_ decremented - even if I stop computations for 15 minutes and then restart it. I would say that I expected that after some downtime number of pooled SLSB will go to some small number. Is this something wrong with my code (some hold references etc.) ? Thanks, Piotr -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/582853#582853] Start a new discussion in Beginner's Corner at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
_______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user