Merge pull request #4684 from eatkins/fix-warnings

Fix warnings
This commit is contained in:
eugene yokota 2019-05-16 16:17:45 -04:00 committed by GitHub
commit 5f127c6339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@ import scala.util.control.NonFatal
private[sbt] object ShutdownHooks extends AutoCloseable {
private[this] val idGenerator = new AtomicInteger(0)
private[this] val hooks = new ConcurrentHashMap[Int, () => Any]
private[this] val hooks = new ConcurrentHashMap[Int, () => Unit]
private[this] val ranHooks = new AtomicBoolean(false)
private[this] val thread = new Thread("shutdown-hooks-run-all") {
override def run(): Unit = runAll()
@ -26,8 +26,10 @@ private[sbt] object ShutdownHooks extends AutoCloseable {
hooks.put(
id,
() =>
try task()
catch {
try {
task()
()
} catch {
case NonFatal(e) =>
System.err.println(s"Caught exception running shutdown hook: $e")
e.printStackTrace(System.err)
@ -36,7 +38,7 @@ private[sbt] object ShutdownHooks extends AutoCloseable {
() => Option(hooks.remove(id)).foreach(_.apply())
}
private def runAll(): Unit = if (ranHooks.compareAndSet(false, true)) {
hooks.forEachValue(Runtime.getRuntime.availableProcessors, _.apply())
hooks.forEachValue(runtime.availableProcessors.toLong, _.apply())
}
override def close(): Unit = {
runtime.removeShutdownHook(thread)

View File

@ -17,7 +17,6 @@ import sbt.BasicCommandStrings.ContinuousExecutePrefix
import sbt._
import sbt.internal.LabeledFunctions._
import sbt.internal.nio.FileEvent
import sbt.internal.util.Util
import sbt.internal.util.complete.Parser
import sbt.internal.util.complete.Parser._
import sbt.nio.file.FileAttributes