This commit is contained in:
M66B 2020-02-11 16:11:03 +01:00
parent a0ae00ba2c
commit b3ec457738
2 changed files with 78 additions and 94 deletions

View File

@ -212,13 +212,6 @@ public class Helper {
protected void beforeExecute(Thread t, Runnable r) {
Log.d("Executing " + t.getName());
}
@Override
public void shutdown() {
Log.i("Shutdown " + name);
super.getQueue().clear();
super.shutdown();
}
}
private static class PriorityFuture<T> implements RunnableFuture<T> {

View File

@ -66,7 +66,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import javax.mail.AuthenticationFailedException;
import javax.mail.Folder;
@ -788,6 +787,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
final DB db = DB.getInstance(this);
final ExecutorService executor =
Helper.getBackgroundExecutor(1, "account_" + account.id);
state.setBackoff(CONNECT_BACKOFF_START);
while (state.isRunning()) {
@ -835,9 +836,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
final ExecutorService executor =
Helper.getBackgroundExecutor(1, "account_" + account.id);
final Map<EntityFolder, IMAPFolder> mapFolders = new HashMap<>();
List<Thread> idlers = new ArrayList<>();
try {
@ -1194,7 +1192,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
" operations=" + partitions.get(key).size());
}
try {
final long sequence = state.getSequence(folder.id, key.getPriority());
executor.submit(new Helper.PriorityRunnable(key.getPriority(), key.getOrder()) {
@ -1275,10 +1272,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
}
});
} catch (RejectedExecutionException ex) {
Log.i(ex);
break;
}
}
}
}
@ -1433,8 +1426,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
executor.shutdown();
// Close folders
for (EntityFolder folder : mapFolders.keySet())
if (folder.synchronize && !folder.poll && mapFolders.get(folder) != null) {