diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 50ba5edbdb..484f2e470b 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -5473,8 +5473,8 @@ class Core { semaphore.release(); } - void join(Context context) { - join(context, thread); + void join() { + join(thread); } void ensureRunning(String reason) { @@ -5496,7 +5496,7 @@ class Core { return unrecoverable; } - void join(Context context, Thread thread) { + void join(Thread thread) { boolean joined = false; boolean interrupted = false; String name = thread.getName(); @@ -5512,10 +5512,10 @@ class Core { // https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html Thread.State state = thread.getState(); if (thread.isAlive()) { - EntityLog.log(context, "Join " + name + " failed" + + Log.e("Join " + name + " failed" + " state=" + state + " interrupted=" + interrupted); if (interrupted) - joined = true; // give up + joined = true; // giving up else { thread.interrupt(); interrupted = true; @@ -5525,7 +5525,7 @@ class Core { joined = true; } } catch (InterruptedException ex) { - EntityLog.log(context, "Join " + name + " error " + ex.toString()); + Log.e(new Throwable(name, ex)); } } diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 11bfab2ad0..d20dfcddf4 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -507,7 +507,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Log.i("### stop=" + accountNetworkState); db.account().setAccountThread(accountNetworkState.accountState.id, null); state.stop(); - state.join(ServiceSynchronize.this); + state.join(); EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Scheduling, "### stopped=" + accountNetworkState); } catch (Throwable ex) { @@ -2210,7 +2210,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Stop idlers for (Thread idler : idlers) - state.join(this, idler); + state.join(idler); idlers.clear(); }