Fix all small and medium-sized issues after review

This commit is contained in:
Ilya Chernikov
2016-10-06 18:46:46 +02:00
parent 9617fc7d6b
commit c2b5c11781
32 changed files with 195 additions and 312 deletions
@@ -390,9 +390,10 @@ class CompileServiceImpl(
synchronized(state.sessions) {
// 2. check if any session hanged - clean
state.sessions.filterValues { !it.isAlive }.apply { anyDead = true }.forEach {
state.sessions.filterValues { !it.isAlive }.forEach {
it.value.dispose()
state.sessions.remove(it.key)
anyDead = true
}
}
@@ -403,13 +404,14 @@ class CompileServiceImpl(
}
// 4. clean dead clients, then check if any left - conditional shutdown (with small delay)
synchronized(state.clientProxies) {
state.clientProxies.removeAll(
state.clientProxies.filter { !it.isAlive }.apply { anyDead = true }.map {
it.dispose()
it
})
}
synchronized(state.clientProxies) {
state.clientProxies.removeAll(
state.clientProxies.filter { !it.isAlive }.map {
it.dispose()
anyDead = true
it
})
}
if (state.clientProxies.isEmpty() && compilationsCounter.get() > 0 && !state.delayedShutdownQueued.get()) {
log.info("No more clients left, delayed shutdown in ${daemonOptions.shutdownDelayMilliseconds}ms")
shutdownWithDelay()