Browse Source

Fixed restart

main
M66B 6 years ago
parent
commit
831db4569e
1 changed files with 19 additions and 25 deletions
  1. +19
    -25
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 19
- 25
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -1636,37 +1636,31 @@ public class ServiceSynchronize extends LifecycleService {
}
private void stop() {
if (main != null) {
EntityLog.log(ServiceSynchronize.this, "Main stop " + main);
synchronized (state) {
state.running = false;
state.notifyAll();
}
EntityLog.log(ServiceSynchronize.this, "Main stop " + main);
synchronized (state) {
state.running = false;
state.notifyAll();
}
// stop wait or backoff
main.interrupt();
join(main);
// stop wait or backoff
main.interrupt();
join(main);
main = null;
state = null;
main = null;
state = null;
EntityLog.log(ServiceSynchronize.this, "Main stopped " + main);
}
EntityLog.log(ServiceSynchronize.this, "Main stopped " + main);
}
private void restart() {
lifecycle.submit(new Runnable() {
@Override
public void run() {
stop();
}
});
lifecycle.submit(new Runnable() {
@Override
public void run() {
start();
}
});
if (running)
lifecycle.submit(new Runnable() {
@Override
public void run() {
stop();
start();
}
});
}
private BroadcastReceiver outboxReceiver = new BroadcastReceiver() {


Loading…
Cancel
Save