From 2b1513b35e3172a9045946f2621167a7310a1855 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 26 Feb 2010 17:03:22 +0000 Subject: Undid my awful code which had broken the thread... Undid my awful code which had broken the thread scheduler selection. Further unbroke it beyond that unbreaking hopefully to the point where java 1.6 on OSX is recognized as such. Review by haller. --- src/actors/scala/actors/scheduler/ThreadPoolConfig.scala | 3 ++- src/library/scala/util/Properties.scala | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala index c96dd6d8d3..a1bf35e0e1 100644 --- a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala +++ b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala @@ -44,7 +44,8 @@ object ThreadPoolConfig { Debug.info(this+": java.vm.vendor = "+javaVmVendor) // on IBM J9 1.6 do not use ForkJoinPool - isJavaAtLeast(1.6) && (javaVmVendor contains "Sun") + // XXX this all needs to go into Properties. + isJavaAtLeast("1.6") && ((javaVmVendor contains "Sun") || (javaVmVendor contains "Apple")) } catch { case _: SecurityException => false diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index d61a834555..afd83eb187 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -105,10 +105,18 @@ private[scala] trait PropertiesTrait def scalacCmd = if (isWin) "scalac.bat" else "scalac" /** Can the java version be determined to be at least as high as the argument? + * Hard to properly future proof this but at the rate 1.7 is going we can leave + * the issue for our cyborg grandchildren to solve. */ - def isJavaAtLeast(version: Double) = - try javaVersion.toDouble >= version - catch { case _: NumberFormatException => false } + def isJavaAtLeast(version: String) = { + val okVersions = version match { + case "1.5" => List("1.5", "1.6", "1.7") + case "1.6" => List("1.6", "1.7") + case "1.7" => List("1.7") + case _ => Nil + } + okVersions exists (javaVersion startsWith _) + } // provide a main method so version info can be obtained by running this def main(args: Array[String]) { -- cgit v1.2.3