Skip to content

Commit

Permalink
modified TestOrderedExecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Aug 20, 2011
1 parent e4d1059 commit 4e6c309
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/test/java/org/jboss/threads/TestOrderedExecutor.java
Expand Up @@ -22,8 +22,10 @@

package org.jboss.threads;

import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import junit.framework.Assert;
import junit.framework.TestCase;
Expand All @@ -47,16 +49,7 @@ public void run() {
}
});

orderedExec.executeNonBlocking(
new Runnable() {
@Override
public void run() {
System.out.println("Task 2");
taskFinishLine.countDown();
}
});

orderedExec.executeNonBlocking(
orderedExec.executeBlocking(
new Runnable() {
@Override
public void run() {
Expand All @@ -65,6 +58,34 @@ public void run() {
}
});


orderedExec.execute(
new Runnable() {
@Override
public void run() {
System.out.println("Task 5");
taskFinishLine.countDown();
}
});


Future task7future = orderedExec.submit(new Callable(){
@Override
public Object call() throws Exception {
return 666;
}
});

orderedExec.execute(
new Runnable() {
@Override
public void run() {
System.out.println("Dummy task that's never executed");
taskFinishLine.countDown();
}
});

Assert.assertTrue((Integer)task7future.get() == 666);
Assert.assertFalse(orderedExec.isShutdown());
Assert.assertFalse(orderedExec.isTerminated());

Expand Down

0 comments on commit 4e6c309

Please sign in to comment.