use long for delay intervals

This commit is contained in:
Aleksey Pivovarov
2016-09-06 15:21:42 +03:00
parent 24dc8fba8f
commit 4f548fa37b
2 changed files with 13 additions and 13 deletions
@@ -32,17 +32,17 @@ public class DiffTaskQueue {
}
@CalledInAwt
public void executeAndTryWait(@NotNull final Function<ProgressIndicator, Runnable> backgroundTask,
@Nullable final Runnable onSlowAction,
final int waitMillis) {
public void executeAndTryWait(@NotNull Function<ProgressIndicator, Runnable> backgroundTask,
@Nullable Runnable onSlowAction,
long waitMillis) {
executeAndTryWait(backgroundTask, onSlowAction, waitMillis, false);
}
@CalledInAwt
public void executeAndTryWait(@NotNull final Function<ProgressIndicator, Runnable> backgroundTask,
@Nullable final Runnable onSlowAction,
final int waitMillis,
final boolean forceEDT) {
public void executeAndTryWait(@NotNull Function<ProgressIndicator, Runnable> backgroundTask,
@Nullable Runnable onSlowAction,
long waitMillis,
boolean forceEDT) {
abort();
myProgressIndicator = BackgroundTaskUtil.executeAndTryWait(backgroundTask, onSlowAction, waitMillis, forceEDT);
}
@@ -66,7 +66,7 @@ public class BackgroundTaskUtil {
@CalledInAwt
public static ProgressIndicator executeAndTryWait(@NotNull Function<ProgressIndicator, /*@NotNull*/ Runnable> backgroundTask,
@Nullable Runnable onSlowAction,
int waitMillis) {
long waitMillis) {
return executeAndTryWait(backgroundTask, onSlowAction, waitMillis, false);
}
@@ -74,7 +74,7 @@ public class BackgroundTaskUtil {
@CalledInAwt
public static ProgressIndicator executeAndTryWait(@NotNull Function<ProgressIndicator, /*@NotNull*/ Runnable> backgroundTask,
@Nullable Runnable onSlowAction,
int waitMillis,
long waitMillis,
boolean forceEDT) {
ModalityState modality = ModalityState.current();
@@ -131,7 +131,7 @@ public class BackgroundTaskUtil {
@Nullable
@CalledInAwt
public static <T> T tryComputeFast(@NotNull Function<ProgressIndicator, T> backgroundTask,
int waitMillis) {
long waitMillis) {
Pair<T, ProgressIndicator> pair = computeInBackgroundAndTryWait(
backgroundTask,
(result, indicator) -> {
@@ -150,7 +150,7 @@ public class BackgroundTaskUtil {
@CalledInAny
public static <T> T computeInBackgroundAndTryWait(@NotNull Computable<T> computable,
@NotNull Consumer<T> asyncCallback,
int waitMillis) {
long waitMillis) {
Pair<T, ProgressIndicator> pair = computeInBackgroundAndTryWait(
indicator -> computable.compute(),
(result, indicator) -> asyncCallback.consume(result),
@@ -173,7 +173,7 @@ public class BackgroundTaskUtil {
public static <T> Pair<T, ProgressIndicator> computeInBackgroundAndTryWait(@NotNull Function<ProgressIndicator, T> task,
@NotNull PairConsumer<T, ProgressIndicator> asyncCallback,
@NotNull ModalityState modality,
int waitMillis) {
long waitMillis) {
ProgressIndicator indicator = new EmptyProgressIndicator(modality);
Helper<T> helper = new Helper<>();
@@ -266,7 +266,7 @@ public class BackgroundTaskUtil {
/**
* @return true if computation was fast, and callback should be handled by current thread
*/
public boolean await(int waitMillis) {
public boolean await(long waitMillis) {
try {
mySemaphore.tryAcquire(waitMillis, TimeUnit.MILLISECONDS);
}