laforge49/JActor — Issue #14: how to use jactor
Author: cp149
Created: 2012-02-29 03:29:42+00:00
State: open

hi,laforge49
I'm new to Jactor,I got code,and run the test ,It is fast.I read your document,but can not find a right way to use in my web app.
my web app is very simple,user input a task,every task run 10-100 second.I write a unit test such as blow
public class TaskTest {
//queuque to save taskids
LinkedBlockingQueue taskqueque=new LinkedBlockingQueue();
//flag,stop taskserver
boolean stop=false;

private ExecutorService taskExecutor= Executors.newFixedThreadPool(5);

@Before
public void setUp() throws Exception {
//create 5 taks server
for (int i = 0; i < 5; i++) {
taskExecutor.submit( new Taskserver());
}
}

@Test
public void test() {
int times=new Random().nextInt(50);
System.out.println("run "+times+" tasks");
for (int i = 0; i