1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-04 06:20:26 +00:00

Improved logging

This commit is contained in:
M66B 2021-11-28 11:09:21 +01:00
parent 83556ed413
commit 76e8794073
2 changed files with 8 additions and 8 deletions

View file

@ -5473,8 +5473,8 @@ class Core {
semaphore.release(); semaphore.release();
} }
void join(Context context) { void join() {
join(context, thread); join(thread);
} }
void ensureRunning(String reason) { void ensureRunning(String reason) {
@ -5496,7 +5496,7 @@ class Core {
return unrecoverable; return unrecoverable;
} }
void join(Context context, Thread thread) { void join(Thread thread) {
boolean joined = false; boolean joined = false;
boolean interrupted = false; boolean interrupted = false;
String name = thread.getName(); String name = thread.getName();
@ -5512,10 +5512,10 @@ class Core {
// https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html // https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html
Thread.State state = thread.getState(); Thread.State state = thread.getState();
if (thread.isAlive()) { if (thread.isAlive()) {
EntityLog.log(context, "Join " + name + " failed" + Log.e("Join " + name + " failed" +
" state=" + state + " interrupted=" + interrupted); " state=" + state + " interrupted=" + interrupted);
if (interrupted) if (interrupted)
joined = true; // give up joined = true; // giving up
else { else {
thread.interrupt(); thread.interrupt();
interrupted = true; interrupted = true;
@ -5525,7 +5525,7 @@ class Core {
joined = true; joined = true;
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
EntityLog.log(context, "Join " + name + " error " + ex.toString()); Log.e(new Throwable(name, ex));
} }
} }

View file

@ -507,7 +507,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
Log.i("### stop=" + accountNetworkState); Log.i("### stop=" + accountNetworkState);
db.account().setAccountThread(accountNetworkState.accountState.id, null); db.account().setAccountThread(accountNetworkState.accountState.id, null);
state.stop(); state.stop();
state.join(ServiceSynchronize.this); state.join();
EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Scheduling, EntityLog.log(ServiceSynchronize.this, EntityLog.Type.Scheduling,
"### stopped=" + accountNetworkState); "### stopped=" + accountNetworkState);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -2210,7 +2210,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
// Stop idlers // Stop idlers
for (Thread idler : idlers) for (Thread idler : idlers)
state.join(this, idler); state.join(idler);
idlers.clear(); idlers.clear();
} }