Improved logging

pull/194/merge
M66B 3 years ago
parent 83556ed413
commit 76e8794073

@ -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));
}
}

@ -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();
}

Loading…
Cancel
Save