summaryrefslogtreecommitdiff
path: root/src/library/scala/sys/SystemProperties.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-18 18:23:14 +0000
committerPaul Phillips <paulp@improving.org>2011-03-18 18:23:14 +0000
commitf3b970b28cf640904fe0d340f9eb7de37514cb67 (patch)
treeb5e77b7b78ec8743c8e4e0131cc7af4eb5611f7c /src/library/scala/sys/SystemProperties.scala
parentd5d7953ab4c31b4f58f51b530ca82603f9e59b94 (diff)
downloadscala-f3b970b28cf640904fe0d340f9eb7de37514cb67.tar.gz
scala-f3b970b28cf640904fe0d340f9eb7de37514cb67.tar.bz2
scala-f3b970b28cf640904fe0d340f9eb7de37514cb67.zip
Accumulated work on fsc.
adds the following new options. -ipv4 Use IPv4 rather than IPv6 for the server socket absolute-cp Make -classpath elements absolute paths before sending to server max-idle -Set idle timeout in minutes for fsc (use 0 for no timeout) My question marks are what are the right defaults for the first two. Former behavior is to absolutize the classpath always and never prefer IPv4 sockets. I changed the default to not absolutize the classpath, with the option if you need it; I left the system default in place for the socket creation, but I have a feeling we should default to IPv4. My only hesitation is that the only way to request an IPv4 socket from java involves mutating a global system property. (Robustness FTW.) So for now, you have to give -ipv4. Closes #3626, #3785, #3788, #3789. Review by community.
Diffstat (limited to 'src/library/scala/sys/SystemProperties.scala')
-rw-r--r--src/library/scala/sys/SystemProperties.scala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/library/scala/sys/SystemProperties.scala b/src/library/scala/sys/SystemProperties.scala
index 7c6286516b..228ca6315e 100644
--- a/src/library/scala/sys/SystemProperties.scala
+++ b/src/library/scala/sys/SystemProperties.scala
@@ -48,9 +48,14 @@ class SystemProperties extends mutable.Map[String, String] {
* }}}
*/
object SystemProperties {
+ /** An unenforceable, advisory only place to do some synchronization when
+ * mutating system properties.
+ */
+ def exclusively[T](body: => T) = this synchronized body
+
implicit def systemPropertiesToCompanion(p: SystemProperties): SystemProperties.type = this
private lazy val propertyHelp = mutable.Map[String, String]()
- private def bool(key: String, helpText: String) = {
+ private def bool(key: String, helpText: String): BooleanProp = {
val prop = (
if (key startsWith "java.") BooleanProp.valueIsTrue(key)
else BooleanProp.keyExists(key)
@@ -63,8 +68,9 @@ object SystemProperties {
// Todo: bring some sanity to the intersection of system properties aka "mutable
// state shared by everyone and everything" and the reality that there is no other
// mechanism for accomplishing some things on the jvm.
- lazy val headless = bool("java.awt.headless", "system should not utilize a display device")
- lazy val preferIPv4 = bool("java.net.preferIPv4Stack", "system should prefer IPv4 sockets")
- lazy val noTraceSupression = bool("scala.control.no-trace-suppression", "scala should not suppress any stack trace creation")
+ lazy val headless = bool("java.awt.headless", "system should not utilize a display device")
+ lazy val preferIPv4Stack = bool("java.net.preferIPv4Stack", "system should prefer IPv4 sockets")
+ lazy val preferIPv6Addresses = bool("java.net.preferIPv6Addresses", "system should prefer IPv6 addresses")
+ lazy val noTraceSupression = bool("scala.control.noTraceSuppression", "scala should not suppress any stack trace creation")
}