To make daemon more and more stable; better working on windows environments; better behave for unhappy scenarios.
This spec is always work in progress. It is aimed to help us design the implementation of the daemon fixes.
Extend our Connection infrastructure so that it allows receiving with timeout.
Connection.receive(timeoutValue, timeoutUnits)
1. Simple implementation:
DaemonStateCoordinator/awaitStop.
Instead of waiting until the daemon timeout I'll be waiting for say
1 minute. It has to be configurable in some way so that I can
integ-test it.
I'll another check: missingDeamonAddress(), if missing then stop() the daemon.
2. More robust option:
Feels like it might be better to have some service that can run things at scheduled times (a ScheduledExecutorService, say), and just schedule a registry check to run every few minutes. If it notices the entry has gone, it just calls requestStop() on the coordinator and the daemon will stop when it becomes idle. This way we keep this concept entirely out of the coordinator.
I'd think about implementing the idle timeout in a similar way - it's just another sentinel that is scheduled to run a certain time after a build command finishes. If the daemon is still idle, it calls forceStop().
There's a bunch of other things we want to do periodically in the daemon - checking for changes to the model, clean up the dependency cache, check if repositories are online, check for new versions of dependencies, that kind of thing.
Use our C support to build a native equivalent to gradle --daemon
.