summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/detach/library/scala/remoting/Channel.scala8
-rw-r--r--src/detach/library/scala/remoting/Debug.scala2
-rw-r--r--src/detach/library/scala/remoting/ServerChannel.scala2
-rw-r--r--src/detach/library/scala/remoting/detach.scala2
-rw-r--r--src/detach/library/scala/runtime/remoting/RegistryDelegate.scala10
-rw-r--r--test/files/detach-run/actor/Client.scala4
-rw-r--r--test/files/detach-run/actor/Server.scala9
-rw-r--r--test/files/detach-run/actor/ServerClassLoader.scala154
-rw-r--r--test/files/detach-run/actor/ServerConsole.scala10
-rw-r--r--test/files/detach-run/actor/actor.scala4
-rw-r--r--test/files/detach-run/basic/Client.scala4
-rw-r--r--test/files/detach-run/basic/Server.scala4
-rw-r--r--test/files/detach-run/basic/ServerConsole.scala5
-rw-r--r--test/files/detach-run/basic/basic.scala6
14 files changed, 50 insertions, 174 deletions
diff --git a/src/detach/library/scala/remoting/Channel.scala b/src/detach/library/scala/remoting/Channel.scala
index 8e8b79dea1..ba3f3c31e0 100644
--- a/src/detach/library/scala/remoting/Channel.scala
+++ b/src/detach/library/scala/remoting/Channel.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -51,7 +51,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: Exception =>
- error("Class loader undefined: " + e.getMessage)
+ system.error("Class loader undefined: " + e.getMessage)
null
}
def classLoader: ClassLoader = cl
@@ -82,7 +82,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: IOException =>
- error("Input stream undefined: "+e.getMessage+" ("+this+")")
+ system.error("Input stream undefined: "+e.getMessage+" ("+this+")")
null
}
private lazy val out =
@@ -91,7 +91,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: IOException =>
- error("Output stream undefined: "+e.getMessage+" ("+this+")")
+ system.error("Output stream undefined: "+e.getMessage+" ("+this+")")
null
}
diff --git a/src/detach/library/scala/remoting/Debug.scala b/src/detach/library/scala/remoting/Debug.scala
index 7a3f0dd91e..bb5aa383d2 100644
--- a/src/detach/library/scala/remoting/Debug.scala
+++ b/src/detach/library/scala/remoting/Debug.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2009, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/src/detach/library/scala/remoting/ServerChannel.scala b/src/detach/library/scala/remoting/ServerChannel.scala
index 6f9fe0a594..125f46ac8b 100644
--- a/src/detach/library/scala/remoting/ServerChannel.scala
+++ b/src/detach/library/scala/remoting/ServerChannel.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/src/detach/library/scala/remoting/detach.scala b/src/detach/library/scala/remoting/detach.scala
index 5bb53da708..668dd982d9 100644
--- a/src/detach/library/scala/remoting/detach.scala
+++ b/src/detach/library/scala/remoting/detach.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala b/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
index ba6f6c042d..baf4249bbe 100644
--- a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
+++ b/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -62,7 +62,7 @@ import java.rmi.server.UnicastRemoteObject
* Thread.sleep(Long.MAX_VALUE)
* } <b>catch</b> {
* <b>case</b> e: InterruptedException => // do nothing
- * <b>case</b> e: Throwable => e.printStackTrace(); System.exit(1)
+ * <b>case</b> e: Throwable => e.printStackTrace(); system.exit(1)
* }
* } while (<b>true</b>)
* }
@@ -115,14 +115,14 @@ object RMIDelegate {
if (args.length > 0) {
if (args(0) equals "-help") {
println("Usage: rmidelegate <options> <port>")
- exit(0)
+ system.exit(0)
}
try {
port = args(0).toInt
} catch {
case e: NumberFormatException =>
println("Usage: rmidelegate <options> <port>")
- exit(1)
+ system.exit(1)
}
val opts = args filter (_ startsWith "-J-D")
for (opt <- opts) {
@@ -149,7 +149,7 @@ object RMIDelegate {
// do nothing
case e: Throwable =>
e.printStackTrace()
- exit(1)
+ system.exit(1)
}
} while (true)
}
diff --git a/test/files/detach-run/actor/Client.scala b/test/files/detach-run/actor/Client.scala
index af1c26ee1b..12573e24d3 100644
--- a/test/files/detach-run/actor/Client.scala
+++ b/test/files/detach-run/actor/Client.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
import scala.actors.Actor._, ClientHelper._
import scala.actors.remote._, RemoteActor._
import scala.remoting._, Debug._
diff --git a/test/files/detach-run/actor/Server.scala b/test/files/detach-run/actor/Server.scala
index 84df6f5d81..b56d22f744 100644
--- a/test/files/detach-run/actor/Server.scala
+++ b/test/files/detach-run/actor/Server.scala
@@ -1,6 +1,9 @@
-import scala.actors._, Actor._
-import scala.actors.remote._, RemoteActor._
-import scala.reflect.Manifest
+/*
+ * @author Stephane Micheloud
+ */
+
+import scala.actors.Actor._
+import scala.actors.remote.RemoteActor._
object Server extends ServerConsole {
private def computation(f: Int => Int): Int = {
diff --git a/test/files/detach-run/actor/ServerClassLoader.scala b/test/files/detach-run/actor/ServerClassLoader.scala
deleted file mode 100644
index 3f5d96a1a1..0000000000
--- a/test/files/detach-run/actor/ServerClassLoader.scala
+++ /dev/null
@@ -1,154 +0,0 @@
-import java.io._
-import java.net.{JarURLConnection, URL, URLClassLoader}
-
-import scala.remoting.Debug
-
- private class ServerObjectInputStream(in: InputStream, cl: ClassLoader)
- extends ObjectInputStream(in) {
- override def resolveClass(cd: ObjectStreamClass): Class[_] = {
- println("[ServerObjectInputStream] resolveClass "+cd.getName)
- try {
- Debug.info("load class "+cd.getName+" from "+cl)
- val c = cl.loadClass(cd.getName)
- Debug.info("loaded class "+c.getName)
- c
- } catch {
- case cnf: ClassNotFoundException =>
- Debug.info("resolve class (this) "+cd.getName)
- val c = super.resolveClass(cd)
- Debug.info("resolve class (super) "+c.getName)
- c
- }
- }
- override def resolveProxyClass(interfaces: Array[String]): Class[_] = {
- println("[ServerObjectInputStream] resolveProxyClass "+interfaces.toList)
- try {
- val c = cl.loadClass(interfaces.last)
- Debug.info("loaded class "+c.getName)
- c
- } catch {
- case cnf: ClassNotFoundException =>
- Debug.info("resolve proxy class (this) "+interfaces.last)
- val c = super.resolveProxyClass(interfaces)
- Debug.info("resolve proxy class (super) "+c.getName)
- c
- }
- }
- }
-/*
- // VARIANT 1
- class ServerClassLoader extends URLClassLoader(urls) {
- import scala.reflect.Manifest
- def load[A](a: Array[Byte])(implicit expected: Manifest[A]): A = {
- val in = new ServerObjectInputStream(new ByteArrayInputStream(a), this)
- val found = in.readObject.asInstanceOf[Manifest[_]]
- if (! (found <:< expected))
- throw new ClassCastException("type mismatch;"+
- "\n found : "+found+
- "\n required: "+expected)
- val o = in.readObject.asInstanceOf[A]
- in.close()
- o
- }
- override def findClass(name: String): Class[_] = {
- println("[ServerClassLoader] findClass "+name)
- val b = loadClassData(name)
- if (b != null) defineClass(name, b, 0, b.length)
- else super.findClass(name)
- }
- private def loadClassData(name: String): Array[Byte] = {
- println("[ServerClassLoader] loadClassData "+name)
- null
- }
- }
- val serverClassLoader = new ServerClassLoader
-*/
-
-/*
- class ServerClassLoader(parent: ClassLoader) extends URLClassLoader(urls, parent) {
- import scala.reflect.Manifest
- def load[A](a: Array[Byte])(implicit expected: Manifest[A]): A = {
- val in = new ServerObjectInputStream(new ByteArrayInputStream(a), this)
- val found = in.readObject.asInstanceOf[Manifest[_]]
- if (! (found <:< expected))
- throw new ClassCastException("type mismatch;"+
- "\n found : "+found+
- "\n required: "+expected)
- val o = in.readObject.asInstanceOf[A]
- in.close()
- o
- }
- override def findClass(name: String): Class[_] = {
- println("[ServerClassLoader] findClass "+name)
- val b = loadClassData(name)
- if (b != null) defineClass(name, b, 0, b.length)
- else super.findClass(name)
- }
- private def loadClassData(name: String): Array[Byte] = {
- println("[ServerClassLoader] loadClassData "+name)
- null
- }
- }
-*/
-class ServerClassLoader(urls: Array[URL], parent: ClassLoader)
-extends URLClassLoader(urls, parent) {
-
- private val cache = new collection.mutable.HashMap[String, Class[_]]
-
- for (url <- urls) {
- val jarurl = new URL("jar:"+url+"!/")
- val con = jarurl.openConnection().asInstanceOf[JarURLConnection]
- val jar = con.getJarFile
- val e = jar.entries
- while (e.hasMoreElements) {
- val ze = e.nextElement
- val path = ze.getName
- if (path endsWith ".class") {
- val size = ze.getSize
- val name = path.replace("/", ".").substring(0, path.length - 6)
- cache += name -> this.loadClass(name)
- println("[ServerClassLoader] added "+name+" ("+size+")")
- }
- }; //jar.close()
- }
-
- override def findClass(name: String): Class[_] = {
- println("[ServerClassLoader] findClass: name="+name)
- cache get name match {
- case Some(cl) =>
- println(name+" cached"); cl
- case None =>
- println(name+" not cached"); super.findClass(name)
- }
- }
-
-}
-
-/*
-try {
- JarFile jarFile = new JarFile(srcPath);
- Enumeration<JarEntry> entries = jarFile.entries();
- String url = "file:" + srcPath;
- System.out.println(url);
- URLClassLoader classLoader = new URLClassLoader(
- new URL[] { new URL(url) });
- while (entries.hasMoreElements()) {
- JarEntry jarEntry = (JarEntry) entries
- .nextElement();
- String classPath = jarEntry.getName();
- if (classPath.endsWith(".class")) {
- String className = classPath.replace("/", ".")
- .substring(0, classPath.length() - 6);
- try {
- Class clazz = classLoader
- .loadClass(className);
- //Et là, tu fais ce que tu vexu avec la classe
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- }
- }
- }
-} catch (IOException e1) {
- e1.printStackTrace();
-}
-*/
diff --git a/test/files/detach-run/actor/ServerConsole.scala b/test/files/detach-run/actor/ServerConsole.scala
index f68274e927..d38725ddee 100644
--- a/test/files/detach-run/actor/ServerConsole.scala
+++ b/test/files/detach-run/actor/ServerConsole.scala
@@ -1,4 +1,8 @@
-import java.io._
+/*
+ * @author Stephane Micheloud
+ */
+
+import java.io.{BufferedReader, InputStreamReader}
import scala.compat.Platform.currentTime
import scala.remoting.Debug, Debug._
@@ -15,7 +19,7 @@ trait ServerConsole extends Thread {
import java.rmi.server.RMIClassLoader
val codebase = System.getProperty("java.rmi.server.codebase")
info("[ServerConsole] codebase="+codebase)
- RMIClassLoader.getClassLoader(codebase)
+ RMIClassLoader getClassLoader codebase
}
private var isTerminated = false
@@ -44,7 +48,7 @@ trait ServerConsole extends Thread {
}
terminate()
println("Server exited ("+mkTimeString(currentTime - startTime)+")")
- exit(0)
+ system.exit(0)
}
protected def trace(msg: String) {
diff --git a/test/files/detach-run/actor/actor.scala b/test/files/detach-run/actor/actor.scala
index f3ed4c2d26..18a6dc38fd 100644
--- a/test/files/detach-run/actor/actor.scala
+++ b/test/files/detach-run/actor/actor.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
object Test {
val name = "actor"
diff --git a/test/files/detach-run/basic/Client.scala b/test/files/detach-run/basic/Client.scala
index d3f159fd40..f8eddb041d 100644
--- a/test/files/detach-run/basic/Client.scala
+++ b/test/files/detach-run/basic/Client.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
import java.net._, Thread._, ClientHelper._
import scala.remoting._, Debug._
diff --git a/test/files/detach-run/basic/Server.scala b/test/files/detach-run/basic/Server.scala
index 02150b36ff..f8aa02a4ba 100644
--- a/test/files/detach-run/basic/Server.scala
+++ b/test/files/detach-run/basic/Server.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
import scala.remoting.ServerChannel
object Server extends ServerConsole {
diff --git a/test/files/detach-run/basic/ServerConsole.scala b/test/files/detach-run/basic/ServerConsole.scala
index bc96bfa329..65b81c0ca1 100644
--- a/test/files/detach-run/basic/ServerConsole.scala
+++ b/test/files/detach-run/basic/ServerConsole.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
import java.io._
import scala.compat.Platform.currentTime
@@ -31,7 +35,6 @@ trait ServerConsole extends Thread {
}
override def run() {
- import java.io._
val in = new BufferedReader(new InputStreamReader(System.in))
var quit = false
while (!quit) {
diff --git a/test/files/detach-run/basic/basic.scala b/test/files/detach-run/basic/basic.scala
index 03e56a74a1..c785bd6c7d 100644
--- a/test/files/detach-run/basic/basic.scala
+++ b/test/files/detach-run/basic/basic.scala
@@ -1,3 +1,7 @@
+/*
+ * @author Stephane Micheloud
+ */
+
object Test {
val name = "basic"
@@ -20,7 +24,7 @@ object Test {
private var th = new Thread(this)
def start() { th.start(); Thread.sleep(1000) }
def run() { Server.main(Array(port.toString)) }
- def terminate() { Server.terminate(); System.exit(0) }
+ def terminate() { Server.terminate(); system.exit(0) }
}
private class ClientThread(host: String, port: Int) extends Runnable {