Store unrecoverable

This commit is contained in:
M66B 2020-10-30 12:16:49 +01:00
parent 1db59c34ac
commit ebf162070e
2 changed files with 15 additions and 2 deletions

View File

@ -4168,6 +4168,7 @@ class Core {
private Semaphore semaphore = new Semaphore(0); private Semaphore semaphore = new Semaphore(0);
private boolean running = true; private boolean running = true;
private boolean recoverable = true; private boolean recoverable = true;
private Throwable unrecoverable = null;
private Long lastActivity = null; private Long lastActivity = null;
private boolean process = false; private boolean process = false;
@ -4244,6 +4245,9 @@ class Core {
if (ex instanceof OperationCanceledException) if (ex instanceof OperationCanceledException)
recoverable = false; recoverable = false;
if (!recoverable)
unrecoverable = ex;
if (!backingoff) { if (!backingoff) {
thread.interrupt(); thread.interrupt();
yield(); yield();
@ -4297,6 +4301,10 @@ class Core {
return recoverable; return recoverable;
} }
Throwable getUnrecoverable() {
return unrecoverable;
}
void join(Thread thread) { void join(Thread thread) {
boolean joined = false; boolean joined = false;
boolean interrupted = false; boolean interrupted = false;

View File

@ -1469,8 +1469,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
" Tune interval=" + account.poll_interval + " Tune interval=" + account.poll_interval +
" idle=" + idleTime + "/" + tune); " idle=" + idleTime + "/" + tune);
try { try {
if (!state.isRecoverable()) if (!state.isRecoverable()) {
Throwable ex = state.getUnrecoverable();
if (ex instanceof Exception)
throw new StoreClosedException(iservice.getStore(), "Unrecoverable", (Exception) ex);
else
throw new StoreClosedException(iservice.getStore(), "Unrecoverable"); throw new StoreClosedException(iservice.getStore(), "Unrecoverable");
}
// Sends store NOOP // Sends store NOOP
EntityLog.log(ServiceSynchronize.this, account.name + " checking store"); EntityLog.log(ServiceSynchronize.this, account.name + " checking store");