Methods Summary |
---|
public void | execute(android.os.AsyncTask task, P params)Execute the given task. If given task is not {@link Preemptable}, it will
preempt all outstanding preemptable tasks.
if (task instanceof Preemptable) {
synchronized (mPreemptable) {
mPreemptable.add(new WeakReference<Preemptable>((Preemptable) task));
}
task.executeOnExecutor(mNonPreemptingExecutor, params);
} else {
task.executeOnExecutor(this, params);
}
|
public void | execute(java.lang.Runnable command)
preempt();
Preconditions.checkNotNull(command);
mQueue.add(command);
|
public static com.android.documentsui.ProviderExecutor | forAuthority(java.lang.String authority)
synchronized (sExecutors) {
ProviderExecutor executor = sExecutors.get(authority);
if (executor == null) {
executor = new ProviderExecutor();
executor.setName("ProviderExecutor: " + authority);
executor.start();
sExecutors.put(authority, executor);
}
return executor;
}
|
private void | preempt()
synchronized (mPreemptable) {
int count = 0;
for (WeakReference<Preemptable> ref : mPreemptable) {
final Preemptable p = ref.get();
if (p != null) {
count++;
p.preempt();
}
}
mPreemptable.clear();
}
|
public void | run()
while (true) {
try {
final Runnable command = mQueue.take();
command.run();
} catch (InterruptedException e) {
// That was weird; let's go look for more tasks.
}
}
|