/*
* Send four task to the executor
*/
for (int i=0; i<4; i++){
MyPriorityTask task=new MyPriorityTask("Task "+i,i);
executor.execute(task);
}
/*
* sleep the thread during one second
*/
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
/*
* Send four tasks to the executor
*/
for (int i=4; i<8; i++) {
MyPriorityTask task=new MyPriorityTask("Task "+i,i);
executor.execute(task);
}
/*
* Shutdown the executor