mirror of
https://github.com/zxing/zxing.git
synced 2025-02-21 02:55:27 -08:00
Avoid a RejectedExecutionException and squash it anyhow
git-svn-id: https://zxing.googlecode.com/svn/trunk@1809 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
00c833d3c2
commit
b70cef7e28
|
@ -17,6 +17,7 @@
|
|||
package com.google.zxing.client.android;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
@ -48,9 +49,16 @@ final class InactivityTimer {
|
|||
|
||||
void onActivity() {
|
||||
cancel();
|
||||
inactivityFuture = inactivityTimer.schedule(new FinishListener(activity),
|
||||
INACTIVITY_DELAY_SECONDS,
|
||||
TimeUnit.SECONDS);
|
||||
if (!inactivityTimer.isShutdown()) {
|
||||
try {
|
||||
inactivityFuture = inactivityTimer.schedule(new FinishListener(activity),
|
||||
INACTIVITY_DELAY_SECONDS,
|
||||
TimeUnit.SECONDS);
|
||||
} catch (RejectedExecutionException ree) {
|
||||
// surprising, but could be normal if for some reason the implementation just doesn't
|
||||
// think it can shcedule again. Since this time-out is non-essential, just forget it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause(){
|
||||
|
|
Loading…
Reference in a new issue