Skip to content

Commit

Permalink
replacing ThreadWaitingCondition with lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
toby-weston-db committed Jan 22, 2014
1 parent f281c6d commit 04f5248
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

import java.util.concurrent.ExecutorService;

import static java.lang.Thread.*;
import static java.lang.Thread.State.TIMED_WAITING;
import static java.lang.Thread.State.WAITING;

public final class Conditions {

public static Condition not(Condition condition) {
Expand All @@ -38,10 +42,12 @@ public static Condition isAlive(Thread thread) {
}

public static Condition isWaiting(Thread thread) {
return new ThreadWaitingCondition(thread);
return () -> {
return (thread.getState() == TIMED_WAITING) || (thread.getState() == WAITING);
};
}

public static Condition is(Thread thread, Thread.State state) {
public static Condition is(Thread thread, State state) {
return new ThreadStateCondition(thread, state);
}

Expand Down

This file was deleted.

0 comments on commit 04f5248

Please sign in to comment.