Remove waitForTasks

This commit is contained in:
2016-07-27 17:10:07 -04:00
parent eceb1bfb7d
commit ddc85ced0b
11 changed files with 0 additions and 65 deletions

View File

@@ -22,7 +22,6 @@ package org.isoron.uhabits.tasks;
import android.os.*;
import java.util.*;
import java.util.concurrent.*;
import javax.inject.*;
@@ -59,27 +58,6 @@ public class AndroidTaskRunner implements TaskRunner
if (asyncTask.getTask() == task) asyncTask.publish(progress);
}
@Override
public void waitForTasks(long timeout)
throws TimeoutException, InterruptedException
{
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
throw new UnsupportedOperationException(
"waitForTasks requires API 16+");
int poolInterval = 100;
while (timeout > 0)
{
if (activeTasks.isEmpty()) return;
timeout -= poolInterval;
Thread.sleep(poolInterval);
}
throw new TimeoutException();
}
private class CustomAsyncTask extends AsyncTask<Void, Integer, Void>
{
private final Task task;

View File

@@ -19,8 +19,6 @@
package org.isoron.uhabits.tasks;
import java.util.concurrent.*;
import javax.inject.*;
import dagger.*;
@@ -50,10 +48,4 @@ public class SingleThreadTaskRunner implements TaskRunner
task.onProgressUpdate(progress);
}
@Override
public void waitForTasks(long timeout)
throws TimeoutException, InterruptedException
{
// NOP
}
}

View File

@@ -19,14 +19,9 @@
package org.isoron.uhabits.tasks;
import java.util.concurrent.*;
public interface TaskRunner
{
void execute(Task task);
void publishProgress(Task task, int progress);
void waitForTasks(long timeout)
throws TimeoutException, InterruptedException;
}