summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/util/SocketServer.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-08 08:47:29 +0000
committerPaul Phillips <paulp@improving.org>2011-02-08 08:47:29 +0000
commit3467ad57e4c2b56cdd02ce0c75af4716b5631a10 (patch)
treeaf5d632276e79a449e9971e94c25bec0c1fc73e4 /src/compiler/scala/tools/util/SocketServer.scala
parentc89ea6e3ae82d9b6bacda25dceb74a958d2fa4f6 (diff)
downloadscala-3467ad57e4c2b56cdd02ce0c75af4716b5631a10.tar.gz
scala-3467ad57e4c2b56cdd02ce0c75af4716b5631a10.tar.bz2
scala-3467ad57e4c2b56cdd02ce0c75af4716b5631a10.zip
Working on fsc.
for me anyway, with this commit scripts will occasionally reuse a compiler instance, instead of never. Since any tests I write will fail on platforms which aren't mine, there are no tests. I might have to start a platform-specific testing area to break some ice around these huge untested zones. No review.
Diffstat (limited to 'src/compiler/scala/tools/util/SocketServer.scala')
-rw-r--r--src/compiler/scala/tools/util/SocketServer.scala23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala
index 5f5cb28c4c..57ebf96656 100644
--- a/src/compiler/scala/tools/util/SocketServer.scala
+++ b/src/compiler/scala/tools/util/SocketServer.scala
@@ -32,14 +32,14 @@ abstract class SocketServer {
// therefore unable to contact this server instance,
// the process will just eventually terminate by itself.
def fscIdleMinutes = {
- sys.props("scala.fsc.idle.minutes") match {
+ sys.props("scala.config.fsc.idle-minutes") match {
case null => 30
case str => try str.toInt catch { case _: Exception => 30 }
}
}
def fscIdleMillis = fscIdleMinutes * 60 * 1000
- def shutDown: Boolean
+ def shutdown: Boolean
def session()
var out: PrintWriter = _
@@ -68,14 +68,15 @@ abstract class SocketServer {
// @todo: this is going to be a prime candidate for ARM
def doSession(clientSocket: Socket) = {
out = new PrintWriter(clientSocket.getOutputStream(), true)
- in = bufferedReader(clientSocket)
+ in = bufferedReader(clientSocket)
val bufout = bufferedOutput(clientSocket)
- scala.Console.withOut(bufout) { session() }
-
- bufout.close()
- out.close()
- in.close()
+ try scala.Console.withOut(bufout)(session())
+ finally {
+ bufout.close()
+ out.close()
+ in.close()
+ }
}
def run() {
@@ -86,12 +87,12 @@ abstract class SocketServer {
}
try {
- while (!shutDown) {
+ while (!shutdown) {
val clientSocket = try serverSocket.accept() catch {
case e: IOException => fail("Accept on port %d failed; exiting.")
}
- doSession(clientSocket)
- clientSocket.close()
+ try doSession(clientSocket)
+ finally clientSocket.close()
}
}
catch {