public static void tearDownClass() throws Exception {
}
@Test
public void testExecutor() {
final LongTaskExecutor longTaskExecutor = new LongTaskExecutor(true);
LongTaskListener longTaskListener = new LongTaskListener() {
final int limit = 100;
int count;
public void taskFinished(LongTask task) {
System.out.println("Finished" + (++count));
if (count == limit) {
return;
}
LongTaskTest l = new LongTaskTest();
longTaskExecutor.execute(l, l);
}
};
longTaskExecutor.setLongTaskListener(longTaskListener);
LongTaskTest longTaskTest = new LongTaskTest();
longTaskExecutor.execute(longTaskTest, longTaskTest);
try {
Thread.sleep(3000);
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
}