aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java/rmi
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-07-16 01:27:14 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-07-16 01:27:14 +0000
commitb0fa81eea9a270f23d6ad67ca7a6d25c18d20da1 (patch)
tree8762d1f992e2f725a6bde1ff966ed6f1e5f4f823 /libjava/gnu/java/rmi
parentea54b29342c8506acb4f858c68340c44b72e3532 (diff)
downloadgcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.zip
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.gz
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.bz2
Major merge with Classpath.
Removed many duplicate files. * HACKING: Updated.x * classpath: Imported new directory. * standard.omit: New file. * Makefile.in, aclocal.m4, configure: Rebuilt. * sources.am: New file. * configure.ac: Run Classpath configure script. Moved code around to support. Disable xlib AWT peers (temporarily). * Makefile.am (SUBDIRS): Added 'classpath' (JAVAC): Removed. (AM_CPPFLAGS): Added more -I options. (BOOTCLASSPATH): Simplified. Completely redid how sources are built. Include sources.am. * include/Makefile.am (tool_include__HEADERS): Removed jni.h. * include/jni.h: Removed (in Classpath). * scripts/classes.pl: Updated to look at built classes. * scripts/makemake.tcl: New file. * testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added -I options. (gcj_jni_invocation_compile_c_to_binary): Likewise. From-SVN: r102082
Diffstat (limited to 'libjava/gnu/java/rmi')
-rw-r--r--libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java71
-rw-r--r--libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java79
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl.java118
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java144
-rw-r--r--libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java158
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl.java154
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java227
-rw-r--r--libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java293
-rw-r--r--libjava/gnu/java/rmi/server/ConnectionRunnerPool.java156
-rw-r--r--libjava/gnu/java/rmi/server/ProtocolConstants.java62
-rw-r--r--libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java59
-rw-r--r--libjava/gnu/java/rmi/server/RMIHashes.java98
-rw-r--r--libjava/gnu/java/rmi/server/RMIIncomingThread.java58
-rw-r--r--libjava/gnu/java/rmi/server/RMIObjectInputStream.java126
-rw-r--r--libjava/gnu/java/rmi/server/RMIObjectOutputStream.java114
-rw-r--r--libjava/gnu/java/rmi/server/RMIVoidValue.java51
-rw-r--r--libjava/gnu/java/rmi/server/UnicastConnection.java231
-rw-r--r--libjava/gnu/java/rmi/server/UnicastConnectionManager.java446
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRef.java278
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRemoteCall.java525
-rw-r--r--libjava/gnu/java/rmi/server/UnicastRemoteStub.java50
-rw-r--r--libjava/gnu/java/rmi/server/UnicastServer.java167
-rw-r--r--libjava/gnu/java/rmi/server/UnicastServerRef.java306
23 files changed, 0 insertions, 3971 deletions
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
deleted file mode 100644
index 1400693..0000000
--- a/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* gnu.java.rmi.RMIMarshalledObjectInputStream
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi;
-
-import gnu.java.rmi.server.RMIObjectInputStream;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-/**
- * This class is only for java.rmi.MarshalledObject to deserialize object from
- * objBytes and locBytes
- */
-
-public class RMIMarshalledObjectInputStream extends RMIObjectInputStream
-{
- private ObjectInputStream locStream;
-
- public RMIMarshalledObjectInputStream(byte[] objBytes, byte[] locBytes) throws IOException
- {
- super(new ByteArrayInputStream(objBytes));
- if(locBytes != null)
- locStream = new ObjectInputStream(new ByteArrayInputStream(locBytes));
- }
-
- //This method overrides RMIObjectInputStream's
- protected Object getAnnotation() throws IOException, ClassNotFoundException
- {
- if(locStream == null)
- return null;
- return locStream.readObject();
- }
-
-} // End of RMIMarshalledObjectInputStream
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
deleted file mode 100644
index 2bbbaac..0000000
--- a/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* gnu.java.rmi.RMIMarshalledObjectOutputStream
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi;
-
-import gnu.java.rmi.server.RMIObjectOutputStream;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-/**
- * This class is only for java.rmi.MarshalledObject to serialize object and
- * got objBytes and locBytes
- */
-public class RMIMarshalledObjectOutputStream extends RMIObjectOutputStream
-{
- private ObjectOutputStream locStream;
- private ByteArrayOutputStream locBytesStream;
-
- public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException
- {
- super(objStream);
- locBytesStream = new ByteArrayOutputStream(256);
- locStream = new ObjectOutputStream(locBytesStream);
- }
-
- //This method overrides RMIObjectOutputStream's.
- protected void setAnnotation(String annotation) throws IOException{
- locStream.writeObject(annotation);
- }
-
- public void flush() throws IOException {
- super.flush();
- locStream.flush();
- }
-
- public byte[] getLocBytes(){
- return locBytesStream.toByteArray();
- }
-
-} // End of RMIMarshalledObjectOutputStream
-
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl.java b/libjava/gnu/java/rmi/dgc/DGCImpl.java
deleted file mode 100644
index a32445c..0000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* DGCImpl.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.dgc;
-
-import gnu.java.rmi.server.UnicastServerRef;
-
-import java.rmi.RemoteException;
-import java.rmi.dgc.DGC;
-import java.rmi.dgc.Lease;
-import java.rmi.dgc.VMID;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMISocketFactory;
-import java.util.Hashtable;
-
-/**
- * I let DGCImpl to extend UnicastServerRef, but not
- * UnicastRemoteObject, because UnicastRemoteObject must
- * exportObject automatically.
- */
-public class DGCImpl
- extends UnicastServerRef implements DGC {
-
- private static final long LEASE_VALUE = 600000L;
- // leaseCache caches a LeaseRecord associated with a vmid
- private Hashtable leaseCache = new Hashtable();
-
-public DGCImpl() throws RemoteException {
- super(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory());
-}
-
-public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException {
- VMID vmid = lease.getVMID();
- if (vmid == null)
- vmid = new VMID();
- long leaseValue = LEASE_VALUE;
- //long leaseValue = lease.getValue();
- lease = new Lease(vmid, leaseValue);
- synchronized(leaseCache){
- LeaseRecord lr = (LeaseRecord)leaseCache.get(vmid);
- if (lr != null)
- lr.reset(leaseValue);
- else{
- lr = new LeaseRecord(vmid, leaseValue);
- leaseCache.put(vmid, lr);
- }
- }
-
- return (lease);
-}
-
-public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException {
- // Not implemented
-}
-
- /**
- * LeaseRecord associates a vmid to expireTime.
- */
- private static class LeaseRecord{
- private VMID vmid;
- private long expireTime;
-
- LeaseRecord(VMID vmid, long leaseValue){
- this.vmid = vmid;
- reset(leaseValue);
- }
-
- // reset expireTime
- void reset(long leaseValue){
- long l = System.currentTimeMillis();
- expireTime = l + leaseValue;
- }
-
- boolean isExpired(){
- long l = System.currentTimeMillis();
- if ( l > expireTime)
- return true;
- return false;
- }
-
- } //End of LeaseRecord
-
-} //End of DGCImpl
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
deleted file mode 100644
index 5f032e7..0000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* DGCImpl_Skel.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Skel class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.dgc;
-
-public final class DGCImpl_Skel
- implements java.rmi.server.Skeleton
-{
- private static final long interfaceHash = -669196253586618813L;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean"),
- new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease")
- };
-
- public java.rmi.server.Operation[] getOperations() {
- return ((java.rmi.server.Operation[]) operations.clone());
- }
-
- public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
- if (opnum < 0) {
- if (hash == -5803803475088455571L) {
- opnum = 0;
- }
- else if (hash == -8139341527526761862L) {
- opnum = 1;
- }
- else {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
- }
- else if (hash != interfaceHash) {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
-
- gnu.java.rmi.dgc.DGCImpl server = (gnu.java.rmi.dgc.DGCImpl)obj;
- switch (opnum) {
- case 0:
- {
- java.rmi.server.ObjID[] $param_0;
- long $param_1;
- java.rmi.dgc.VMID $param_2;
- boolean $param_3;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.rmi.server.ObjID[])in.readObject();
- $param_1 = (long)in.readLong();
- $param_2 = (java.rmi.dgc.VMID)in.readObject();
- $param_3 = (boolean)in.readBoolean();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.clean($param_0, $param_1, $param_2, $param_3);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 1:
- {
- java.rmi.server.ObjID[] $param_0;
- long $param_1;
- java.rmi.dgc.Lease $param_2;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.rmi.server.ObjID[])in.readObject();
- $param_1 = (long)in.readLong();
- $param_2 = (java.rmi.dgc.Lease)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.rmi.dgc.Lease $result = server.dirty($param_0, $param_1, $param_2);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- default:
- throw new java.rmi.UnmarshalException("invalid method number");
- }
- }
-}
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
deleted file mode 100644
index b1e086a..0000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* DGCImpl_Stub.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Stub class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.dgc;
-
-public final class DGCImpl_Stub
- extends java.rmi.server.RemoteStub
- implements java.rmi.dgc.DGC
-{
- private static final long serialVersionUID = 2L;
-
- private static final long interfaceHash = -669196253586618813L;
-
- private static boolean useNewInvoke;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean)"),
- new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)")
- };
-
- private static java.lang.reflect.Method $method_clean_0;
- private static java.lang.reflect.Method $method_dirty_1;
-
- static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
- useNewInvoke = true;
- $method_clean_0 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("clean", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.VMID.class, boolean.class});
- $method_dirty_1 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("dirty", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.Lease.class});
-
- }
- catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
- }
-
- public DGCImpl_Stub() {
- super();
- }
- public DGCImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
- }
-
- public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeLong($param_1);
- out.writeObject($param_2);
- out.writeBoolean($param_3);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.Lease $param_2) throws java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_dirty_1, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2}, -8139341527526761862L);
- return ((java.rmi.dgc.Lease)$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeLong($param_1);
- out.writeObject($param_2);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.rmi.dgc.Lease $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.dgc.Lease)in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl.java b/libjava/gnu/java/rmi/registry/RegistryImpl.java
deleted file mode 100644
index 0c94434..0000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* RegistryImpl.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.registry;
-
-import gnu.java.rmi.server.UnicastServerRef;
-
-import java.rmi.AccessException;
-import java.rmi.AlreadyBoundException;
-import java.rmi.NotBoundException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RMISocketFactory;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-public class RegistryImpl
- extends UnicastRemoteObject implements Registry {
-
-private Hashtable bindings = new Hashtable();
-
-public RegistryImpl(int port) throws RemoteException {
- this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory());
-}
-
-public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException {
- super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf));
- // The following is unnecessary, because UnicastRemoteObject export itself automatically.
- //((UnicastServerRef)getRef()).exportObject(this);
-}
-
-public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
- Object obj = bindings.get(name);
- if (obj == null) {
- throw new NotBoundException(name);
- }
- return ((Remote)obj);
-}
-
-public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException {
- if (bindings.containsKey(name)) {
- throw new AlreadyBoundException(name);
- }
- bindings.put(name, obj);
-}
-
-public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
- Object obj = bindings.remove(name);
- if (obj == null) {
- throw new NotBoundException(name);
- }
-}
-
-public void rebind(String name, Remote obj) throws RemoteException, AccessException {
- bindings.put(name, obj);
-}
-
-public String[] list() throws RemoteException, AccessException {
- int size = bindings.size();
- String[] strings = new String[size];
- Enumeration e = bindings.keys();
- for (int i = 0; i < size; i++) {
- strings[i] = (String)e.nextElement();
- }
- return (strings);
-}
-
-public static void version() {
- System.out.println("rmiregistry ("
- + System.getProperty("java.vm.name")
- + ") "
- + System.getProperty("java.vm.version"));
- System.out.println("Copyright 2005 Free Software Foundation, Inc.");
- System.out.println("This is free software; see the source for copying conditions. There is NO");
- System.out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
- System.exit(0);
-}
-
-public static void help() {
- System.out.println(
-"Usage: rmiregistry [OPTION | PORT]\n" +
-"\n" +
-" --help Print this help, then exit\n" +
-" --version Print version number, then exit\n");
- System.exit(0);
-}
-
-public static void main(String[] args) {
- int port = Registry.REGISTRY_PORT;
- if (args.length > 0) {
- if (args[0].equals("--version")) {
- version();
- }
- else if (args[0].equals("--help")) {
- help();
- }
- try {
- port = Integer.parseInt(args[0]);
- }
- catch (NumberFormatException _) {
- System.err.println("Bad port number - using default");
- }
- }
-
- try {
- Registry impl = LocateRegistry.createRegistry(port);
- }
- catch (RemoteException _) {
- System.err.println("Registry failed");
- }
-}
-
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
deleted file mode 100644
index 8cf14cc..0000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/* RegistryImpl_Skel.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Skel class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.registry;
-
-public final class RegistryImpl_Skel
- implements java.rmi.server.Skeleton
-{
- private static final long interfaceHash = 4905912898345647071L;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote"),
- new java.rmi.server.Operation("java.lang.String[] list("),
- new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String"),
- new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote"),
- new java.rmi.server.Operation("void unbind(java.lang.String")
- };
-
- public java.rmi.server.Operation[] getOperations() {
- return ((java.rmi.server.Operation[]) operations.clone());
- }
-
- public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
- if (opnum < 0) {
- if (hash == 7583982177005850366L) {
- opnum = 0;
- }
- else if (hash == 2571371476350237748L) {
- opnum = 1;
- }
- else if (hash == -7538657168040752697L) {
- opnum = 2;
- }
- else if (hash == -8381844669958460146L) {
- opnum = 3;
- }
- else if (hash == 7305022919901907578L) {
- opnum = 4;
- }
- else {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
- }
- else if (hash != interfaceHash) {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
-
- gnu.java.rmi.registry.RegistryImpl server = (gnu.java.rmi.registry.RegistryImpl)obj;
- switch (opnum) {
- case 0:
- {
- java.lang.String $param_0;
- java.rmi.Remote $param_1;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
- $param_1 = (java.rmi.Remote)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.bind($param_0, $param_1);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 1:
- {
- try {
- java.io.ObjectInput in = call.getInputStream();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.lang.String[] $result = server.list();
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 2:
- {
- java.lang.String $param_0;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.rmi.Remote $result = server.lookup($param_0);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 3:
- {
- java.lang.String $param_0;
- java.rmi.Remote $param_1;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
- $param_1 = (java.rmi.Remote)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.rebind($param_0, $param_1);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 4:
- {
- java.lang.String $param_0;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.unbind($param_0);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- default:
- throw new java.rmi.UnmarshalException("invalid method number");
- }
- }
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
deleted file mode 100644
index b289426..0000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/* RegistryImpl_Stub.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Stub class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.registry;
-
-public final class RegistryImpl_Stub
- extends java.rmi.server.RemoteStub
- implements java.rmi.registry.Registry
-{
- private static final long serialVersionUID = 2L;
-
- private static final long interfaceHash = 4905912898345647071L;
-
- private static boolean useNewInvoke;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("java.lang.String[] list()"),
- new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
- new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("void unbind(java.lang.String)")
- };
-
- private static java.lang.reflect.Method $method_bind_0;
- private static java.lang.reflect.Method $method_list_1;
- private static java.lang.reflect.Method $method_lookup_2;
- private static java.lang.reflect.Method $method_rebind_3;
- private static java.lang.reflect.Method $method_unbind_4;
-
- static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
- useNewInvoke = false;
- $method_bind_0 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("bind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
- $method_list_1 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("list", new java.lang.Class[] {});
- $method_lookup_2 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("lookup", new java.lang.Class[] {java.lang.String.class});
- $method_rebind_3 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("rebind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
- $method_unbind_4 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("unbind", new java.lang.Class[] {java.lang.String.class});
-
- }
- catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
- }
-
- public RegistryImpl_Stub() {
- super();
- }
- public RegistryImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
- }
-
- public void bind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_bind_0, new java.lang.Object[] {$param_0, $param_1}, 7583982177005850366L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeObject($param_1);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.AlreadyBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_list_1, null, 2571371476350237748L);
- return ((java.lang.String[])$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.lang.String[] $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String[])in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.rmi.Remote lookup(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_lookup_2, new java.lang.Object[] {$param_0}, -7538657168040752697L);
- return ((java.rmi.Remote)$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 2, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.rmi.Remote $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.Remote)in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.NotBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public void rebind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_rebind_3, new java.lang.Object[] {$param_0, $param_1}, -8381844669958460146L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 3, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeObject($param_1);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public void unbind(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_unbind_4, new java.lang.Object[] {$param_0}, 7305022919901907578L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 4, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.NotBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
-}
diff --git a/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java b/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
deleted file mode 100644
index 9cc57b2..0000000
--- a/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* gnu.java.rmi.server.ConnectionRunnerPool
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-//Should I generalize this class?
-
-class ConnectionRunnerPool
-{
-
- public static
- class ConnectionRunner extends Thread{
- private UnicastConnection conn;
- private volatile boolean exiting = false;
-
- public ConnectionRunner(ThreadGroup group, String id){
- super(group, id);
- }
-
- public synchronized void run(){
- while(!exiting){
- if(conn == null)
- try{
- wait();
- }catch(InterruptedException e){
- continue;
- }
- else{
- conn.run();
- conn = null;
- synchronized(ConnectionRunnerPool.class){
- freelist.add(this);
- if(freelist.size() == 1)
- ConnectionRunnerPool.class.notifyAll();
- }
- }
- }
- }
-
- public synchronized void dispatch(UnicastConnection conn){
- this.conn = conn;
- notify();
- }
-
- void exit(){
- exiting = true;
- if(conn != null)
- try{
- join(500);
- }catch(InterruptedException e){}
- interrupt();
- }
-
- }
-
- // Should this value equal to number of CPU?
- private static int size = 5;
- private static int max_size = 10;
-
- // Package-private to avoid a trampoline.
- static ArrayList freelist;
-
- private static ThreadGroup group = new ThreadGroup("pool");
-
- static {
- ConnectionRunner[] pools = new ConnectionRunner[size];
- for(int i = 0; i < pools.length; i++){
- pools[i] = new ConnectionRunner(group, new Integer(i).toString());
- pools[i].setContextClassLoader(Thread.currentThread().getContextClassLoader());
- pools[i].start();
- }
- freelist = new ArrayList(Arrays.asList(pools));
- }
-
- public static void setSize(int size_){
- size = size_;
- }
-
- public static void setMaxSize(int size){
- max_size = size;
- }
-
- private static synchronized ConnectionRunner getConnectionRunner()
- {
- if(freelist.size() == 0){
- if(size < max_size){
- ++size;
- ConnectionRunner a = new ConnectionRunner(group, new Integer(size).toString());
- a.start();
- freelist.add(a);
- }else
- while(freelist.size() == 0)
- try{
- ConnectionRunnerPool.class.wait();
- }catch(InterruptedException e){}
- }
-
- // always let the first in pool most busy or other scheduling plan??
- ConnectionRunner a = (ConnectionRunner)freelist.get(0);
- freelist.remove(a);
- return a;
- }
-
- public static void dispatchConnection(UnicastConnection conn)
- {
- ConnectionRunner r = getConnectionRunner();
- r.dispatch(conn);
- }
-
- public static void exit()
- {
- Thread[] list = new Thread[group.activeCount()];
- group.enumerate(list);
- for(int i = 0; i < list.length; i++)
- ((ConnectionRunner)list[i]).exit();
- }
-
-}
diff --git a/libjava/gnu/java/rmi/server/ProtocolConstants.java b/libjava/gnu/java/rmi/server/ProtocolConstants.java
deleted file mode 100644
index 30fb5e8..0000000
--- a/libjava/gnu/java/rmi/server/ProtocolConstants.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ProtocolConstants.java --
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-public interface ProtocolConstants
-{
- int PROTOCOL_HEADER = 0x4a524d49; // JRMI
- int PROTOCOL_VERSION = 2;
-
- int STREAM_PROTOCOL = 0x4b;
- int SINGLE_OP_PROTOCOL = 0x4c;
- int MULTIPLEX_PROTOCOL = 0x4d;
-
- int PROTOCOL_ACK = 0x4e;
- int PROTOCOL_NACK = 0x4f;
-
- int MESSAGE_CALL = 0x50;
- int MESSAGE_CALL_ACK = 0x51;
- int MESSAGE_PING = 0x52;
- int MESSAGE_PING_ACK = 0x53;
- int MESSAGE_DGCACK = 0x54;
-
- int RETURN_ACK = 0x01;
- int RETURN_NACK = 0x02;
-
- int DEFAULT_PROTOCOL = STREAM_PROTOCOL;
-}
diff --git a/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java b/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java
deleted file mode 100644
index 628e1cc..0000000
--- a/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* RMIDefaultSocketFactory.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.rmi.server.RMISocketFactory;
-
-public class RMIDefaultSocketFactory
- extends RMISocketFactory {
-
-public RMIDefaultSocketFactory() {
-}
-
-public Socket createSocket(String host, int port) throws IOException {
- return (new Socket(host, port));
-}
-
-public ServerSocket createServerSocket(int port) throws IOException {
- return (new ServerSocket(port));
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIHashes.java b/libjava/gnu/java/rmi/server/RMIHashes.java
deleted file mode 100644
index 5a41440..0000000
--- a/libjava/gnu/java/rmi/server/RMIHashes.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* RMIHashes.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import gnu.java.lang.reflect.TypeSignature;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Method;
-import java.security.MessageDigest;
-
-public class RMIHashes
-{
- //There're other places using DigestOutputStream to generate hash in classpath, but I think the way I used
- //here is more efficient, anyway, you can switch to DigestOutputStream by doing like "//or:" comments say.
-
- //or:add this statement: private static final NullOutputStream nullOutputStream = new NullOutputStream ();
- public static long getMethodHash(Method meth)
- {
- //Object Serialization Spec 8.3
- try
- {
- MessageDigest md = MessageDigest.getInstance ("SHA");
- //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md);
- ByteArrayOutputStream digest_out = new ByteArrayOutputStream();
- DataOutputStream data_out = new DataOutputStream (digest_out);
-
- StringBuffer sbuf = new StringBuffer();
- sbuf.append(meth.getName());
- sbuf.append('(');
- Class params[] = meth.getParameterTypes();
- for(int i = 0; i < params.length; i++)
- sbuf.append(TypeSignature.getEncodingOfClass(params[i]));
- sbuf.append(')');
- Class rcls = meth.getReturnType();
- if(rcls != Void.TYPE)
- sbuf.append(TypeSignature.getEncodingOfClass(rcls));
- else
- sbuf.append('V');
-
- data_out.writeUTF (sbuf.toString());
- data_out.flush();
- data_out.close ();
-
- md.update(digest_out.toByteArray()); //or:remove this statement
- byte[] sha = md.digest ();
- long result = 0;
- int len = sha.length < 8 ? sha.length : 8;
- for (int i=0; i < len; i++)
- result += (long)(sha[i] & 0xFF) << (8 * i);
- return result;
- }catch(Exception _){
- return -1L;
- }
- }
-
- public static long getInterfaceHash(Class clazz)
- {
- return clazz.hashCode ();
- }
-}
-
diff --git a/libjava/gnu/java/rmi/server/RMIIncomingThread.java b/libjava/gnu/java/rmi/server/RMIIncomingThread.java
deleted file mode 100644
index 990d37b..0000000
--- a/libjava/gnu/java/rmi/server/RMIIncomingThread.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* RMIIncomingThread.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-public class RMIIncomingThread extends Thread {
-
- private String clientHost = null;
-
- public RMIIncomingThread(Runnable runnable, String s_clientHost) {
- super(runnable);
- clientHost = s_clientHost;
- }
-
- public String toString() {
- return "RMIIncoming from " + clientHost + " " + super.toString();
- }
-
- public String getClientHost() {
- return clientHost;
- }
-
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
deleted file mode 100644
index 888b30b..0000000
--- a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* RMIObjectInputStream.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.lang.reflect.Proxy;
-import java.net.MalformedURLException;
-import java.rmi.server.RMIClassLoader;
-
-public class RMIObjectInputStream
- extends ObjectInputStream {
-
-public RMIObjectInputStream(InputStream strm) throws IOException {
- super(strm);
- enableResolveObject(true);
-}
-
-protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- String annotation = (String)getAnnotation();
-
- try {
- if(annotation == null)
- return (RMIClassLoader.loadClass(desc.getName()));
- else
- return (RMIClassLoader.loadClass(annotation, desc.getName()));
- }
- catch (MalformedURLException _) {
- throw new ClassNotFoundException(desc.getName());
- }
-}
-
-//Separate it for override by MarshalledObject
-protected Object getAnnotation()
- throws IOException, ClassNotFoundException
-{
- return readObject();
-}
-
-protected Class resolveProxyClass(String intfs[])
- throws IOException, ClassNotFoundException
-{
- String annotation = (String)getAnnotation();
-
- Class clss[] = new Class[intfs.length];
- if(annotation == null)
- clss[0] = RMIClassLoader.loadClass(intfs[0]);
- else
- clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]);
-
- //assume all interfaces can be loaded by the same classloader
- ClassLoader loader = clss[0].getClassLoader();
- for (int i = 0; i < intfs.length; i++)
- clss[i] = Class.forName(intfs[i], false, loader);
-
- try {
- return Proxy.getProxyClass(loader, clss);
- } catch (IllegalArgumentException e) {
- throw new ClassNotFoundException(null, e);
- }
-}
-
-protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException {
- if(valueClass.isPrimitive()){
- if(valueClass == Boolean.TYPE)
- return new Boolean(readBoolean());
- if(valueClass == Byte.TYPE)
- return new Byte(readByte());
- if(valueClass == Character.TYPE)
- return new Character(readChar());
- if(valueClass == Short.TYPE)
- return new Short(readShort());
- if(valueClass == Integer.TYPE)
- return new Integer(readInt());
- if(valueClass == Long.TYPE)
- return new Long(readLong());
- if(valueClass == Float.TYPE)
- return new Float(readFloat());
- if(valueClass == Double.TYPE)
- return new Double(readDouble());
- else
- throw new Error("Unsupported primitive class: " + valueClass);
- } else
- return readObject();
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java b/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
deleted file mode 100644
index d42908a..0000000
--- a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* RMIObjectOutputStream.java -
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.rmi.Remote;
-import java.rmi.server.RMIClassLoader;
-import java.rmi.server.RemoteStub;
-
-public class RMIObjectOutputStream
- extends ObjectOutputStream {
-
-public RMIObjectOutputStream(OutputStream strm) throws IOException {
- super(strm);
- enableReplaceObject(true);
-}
-
-//Separate it for override by MarshalledObject
-protected void setAnnotation(String annotation) throws IOException{
- writeObject(annotation);
-}
-
-protected void annotateClass(Class cls) throws IOException {
- setAnnotation(RMIClassLoader.getClassAnnotation(cls));
-}
-
-protected void annotateProxyClass(Class cls)
- throws IOException
-{
- annotateClass(cls);
-}
-
-protected Object replaceObject(Object obj)
- throws IOException
-{
- if((obj instanceof Remote) && !(obj instanceof RemoteStub)){
- UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj);
- if (ref != null)
- return ref.getStub();
- }
- return obj;
-}
-
-protected void writeValue(Object value, Class valueClass) throws IOException{
- if(valueClass.isPrimitive()){
- if(valueClass == Boolean.TYPE)
- writeBoolean(((Boolean)value).booleanValue());
- else
- if(valueClass == Byte.TYPE)
- writeByte(((Byte)value).byteValue());
- else
- if(valueClass == Character.TYPE)
- writeChar(((Character)value).charValue());
- else
- if(valueClass == Short.TYPE)
- writeShort(((Short)value).shortValue());
- else
- if(valueClass == Integer.TYPE)
- writeInt(((Integer)value).intValue());
- else
- if(valueClass == Long.TYPE)
- writeLong(((Long)value).longValue());
- else
- if(valueClass == Float.TYPE)
- writeFloat(((Float)value).floatValue());
- else
- if(valueClass == Double.TYPE)
- writeDouble(((Double)value).doubleValue());
- else
- throw new Error("Unsupported primitive class: " + valueClass);
- } else
- writeObject(value);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIVoidValue.java b/libjava/gnu/java/rmi/server/RMIVoidValue.java
deleted file mode 100644
index 8e5546d..0000000
--- a/libjava/gnu/java/rmi/server/RMIVoidValue.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* RMIVoidValue.java --
- Copyright (c) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-/**
- * Package private class used to indicate a void return type.
- * INSTANCE is the only object of this class ever made.
- */
-final class RMIVoidValue
-{
- static RMIVoidValue INSTANCE = new RMIVoidValue();
-
- private RMIVoidValue()
- {
- }
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnection.java b/libjava/gnu/java/rmi/server/UnicastConnection.java
deleted file mode 100644
index 216e453..0000000
--- a/libjava/gnu/java/rmi/server/UnicastConnection.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/* UnicastConnection.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.Socket;
-import java.rmi.RemoteException;
-
-public class UnicastConnection
- implements Runnable, ProtocolConstants {
-
-UnicastConnectionManager manager;
-Socket sock;
-DataInputStream din;
-DataOutputStream dout;
-ObjectInputStream oin;
-ObjectOutputStream oout;
-
-// reviveTime and expireTime make UnicastConnection pool-able
-long reviveTime = 0;
-long expireTime = Long.MAX_VALUE;
-
-UnicastConnection(UnicastConnectionManager man, Socket sock) {
- this.manager = man;
- this.sock = sock;
-}
-
-void acceptConnection() throws IOException {
-//System.out.println("Accepting connection on " + sock);
- //Use BufferedXXXStream would be more efficient
- din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
- dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
-
- int sig = din.readInt();
- if (sig != PROTOCOL_HEADER) {
- throw new IOException("bad protocol header");
- }
- short ver = din.readShort();
- if (ver != PROTOCOL_VERSION) {
- throw new IOException("bad protocol version");
- }
- int protocol = din.readUnsignedByte();
- if (protocol != SINGLE_OP_PROTOCOL) {
- // Send an ACK
- dout.writeByte(PROTOCOL_ACK);
-
- // Send my hostname and port
- dout.writeUTF(manager.serverName);
- dout.writeInt(manager.serverPort);
- dout.flush();
-
- // Read their hostname and port
- String rhost = din.readUTF();
- int rport = din.readInt();
- }
- // Okay, ready to roll ...
-}
-
-void makeConnection(int protocol) throws IOException {
- //Use BufferedXXXStream would be more efficient
- din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
-
- dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
-
- // Send header
- dout.writeInt(PROTOCOL_HEADER);
- dout.writeShort(PROTOCOL_VERSION);
- dout.writeByte(protocol);
- dout.flush();
-
- if (protocol != SINGLE_OP_PROTOCOL) {
- // Get back ack.
- int ack = din.readUnsignedByte();
- if (ack != PROTOCOL_ACK) {
- throw new RemoteException("Unsupported protocol");
- }
-
- // Read in host and port
- String dicard_rhost = din.readUTF();
- int discard_rport = din.readInt();
-
- // Send them my endpoint
- dout.writeUTF(manager.serverName);
- dout.writeInt(manager.serverPort);
- dout.flush();
- }
- // Okay, ready to roll ...
-}
-
-DataInputStream getDataInputStream() throws IOException {
- return (din);
-}
-
-DataOutputStream getDataOutputStream() throws IOException {
- return (dout);
-}
-
-/*
-*
-* get ObjectInputStream for reading more objects
-*
-*/
-ObjectInputStream getObjectInputStream() throws IOException {
- if (oin == null) {
- throw new IOException("no ObjectInputtream for reading more objects");
- }
- return (oin);
-}
-
-/**
-*
-* starts ObjectInputStream.
-*
-*/
-ObjectInputStream startObjectInputStream() throws IOException {
- return (oin = new RMIObjectInputStream(din));
-}
-
-/**
-*
-* get ObjectOutputStream for sending more objects
-*
-*/
-ObjectOutputStream getObjectOutputStream() throws IOException {
- if (oout == null) {
- throw new IOException("no ObjectOutputStream for sending more objects");
- }
- return (oout);
-}
-
-/**
-*
-* starts ObjectOutputStream.
-*
-*/
-ObjectOutputStream startObjectOutputStream() throws IOException {
- return (oout = new RMIObjectOutputStream(dout));
-}
-
-void disconnect() {
- try {
- if(oout != null)
- oout.close();
- sock.close();
- }
- catch (IOException _) {
- }
-
- oin = null;
- oout = null;
- din = null;
- dout = null;
- sock = null;
-}
-
-public static final long CONNECTION_TIMEOUT = 10000L;
-
-static boolean isExpired(UnicastConnection conn, long l){
- if (l <= conn.expireTime )
- return false;
- return true;
-}
-
-static void resetTime(UnicastConnection conn){
- long l = System.currentTimeMillis();
- conn.reviveTime = l;
- conn.expireTime = l + CONNECTION_TIMEOUT;
-}
-
-/**
- * We run connects on the server. Dispatch it then discard it.
- */
-public void run() {
- do{
- try {
- UnicastServer.dispatch(this);
- //don't discardConnection explicitly, only when
- // exception happens or the connection's expireTime
- // comes
- } catch (Exception e ){
- manager.discardConnection(this);
- break;
- }
- }while(true);
-}
-
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java b/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
deleted file mode 100644
index 08f6a9b..0000000
--- a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/* UnicastConnectionManager.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.rmi.RemoteException;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RMISocketFactory;
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-public class UnicastConnectionManager
- implements Runnable, ProtocolConstants {
-
-private static String localhost;
-// use different maps for server/client type UnicastConnectionManager
-private static Hashtable servers = new Hashtable();
-// Package-private to avoid trampolines.
-static Hashtable clients = new Hashtable();
-ArrayList connections; //client connection pool
-
-// make serverThread volatile for poll
-private volatile Thread serverThread;
-private ServerSocket ssock;
-String serverName;
-int serverPort;
-
-// Package-private to avoid a trampoline.
-static Thread scavenger;
-
-// If client and server are in the same VM, serverobj represents server
-Object serverobj;
-
-private static RMISocketFactory defaultSocketFactory = RMISocketFactory.getSocketFactory();
-private RMIServerSocketFactory serverFactory;
-private RMIClientSocketFactory clientFactory;
-
-// The following is for debug
-private static int ncsock = 0; //count of client socket
-private static int nssock = 0; //count of server socket
-private static int ncmanager = 0; //count of client manager
-private static int nsmanager = 0; //count of server manager
-
-private static final boolean debug = false;
-
-private static final Object GLOBAL_LOCK = new Object();
-
-static {
- try {
- //Use host address instead of host name to avoid name resolving issues
- //localhost = InetAddress.getLocalHost().getHostName();
- localhost = InetAddress.getLocalHost().getHostAddress();
- }
- catch (UnknownHostException _) {
- localhost = "localhost";
- }
-
-
-}
-
-//Only one scavenger thread running globally
-private static void startScavenger(){
- scavenger = new Thread(new Runnable(){
- public void run(){
- if (debug) System.out.println("************* start scavenger.");
- boolean liveon = true;
- while (liveon){
- // Sleep for the expire timeout
- try{
- Thread.sleep(UnicastConnection.CONNECTION_TIMEOUT);
- }catch(InterruptedException _ie){
- break;
- }
- liveon = false;
- // Scavenge all clients' connections that're expired
- Iterator iter = clients.values().iterator();
- long l = System.currentTimeMillis();
- try{
- while(iter.hasNext()){
- UnicastConnectionManager man = (UnicastConnectionManager)iter.next();
- ArrayList conns = man.connections;
- synchronized(conns) { // is the lock a little coarser?
- for (int last = conns.size() - 1;
- last >= 0;
- --last)
- {
- UnicastConnection conn = (UnicastConnection)conns.get(last);
- if (UnicastConnection.isExpired(conn, l)){
- conns.remove(last);
- conn.disconnect();
- conn = null;
- }else
- liveon = true; //there're still live connections
- }
- }
- }
- }catch(ConcurrentModificationException cme) {
- // handle it lazily
- liveon = true;
- }
- }
- scavenger = null;
- if (debug) System.out.println("************* exit scavenger.");
- }
- });
- // As it is used for client connection, we may put this thread
- // in daemon state to prevent the VM from blocking when exiting.
- scavenger.setDaemon(true);
- scavenger.start();
-}
-
-/**
- * Client UnicastConnectionManager constructor
- */
-private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) {
- ssock = null;
- serverName = host;
- serverPort = port;
- serverFactory = null;
- clientFactory = csf;
- connections = new ArrayList();
-}
-
-/**
- * Server UnicastConnectionManager constructor
- */
-private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws RemoteException {
-
- try {
- ssock = ssf.createServerSocket(port);
- serverPort = ssock.getLocalPort();
- }
- catch (IOException ioex) {
- ssock = null;
- serverPort = 0;
- throw new java.rmi.server.ExportException("can not create Server Socket on port " + port,ioex);
- }
- serverName = localhost;
- serverFactory = ssf;
- clientFactory = null;
-}
-
-/**
- * Return a client connection manager which will connect to the given
- * host/port.
- */
-public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) {
-//System.out.println("getInstance: " + host + "," + port + "," + csf);
- if (csf == null) {
- csf = defaultSocketFactory;
- }
- // change host name to host address to avoid name resolving issues
- try{
- host = InetAddress.getByName(host).getHostAddress();
- }catch(Exception _){}
-
- TripleKey key = new TripleKey(host, port, csf);
- UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key);
- if (man == null) {
- man = new UnicastConnectionManager(host, port, csf);
- if (debug) {
- ncmanager++;
- System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n");
- }
- clients.put(key, man);
-
- // Detect if client and server are in the same VM, i.e., their keys are equal
- UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key);
- if(svrman != null){ // server and client are in the same VM
- man.serverobj = svrman.serverobj;
- }
- }
- return (man);
-}
-
-/**
- * Return a server connection manager which will accept connection on the
- * given port.
- */
-public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {
-//System.out.println("getInstance: " + port + "," + ssf);
- if (ssf == null) {
- ssf = defaultSocketFactory;
- }
- TripleKey key = new TripleKey(localhost, port, ssf);
- UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
- if (man == null) {
- man = new UnicastConnectionManager(port, ssf);
- if (debug) {
- nsmanager++;
- System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n");
- }
- // The provided port might not be the set port.
- key.port = man.serverPort;
- servers.put(key, man);
- }
- return (man);
-}
-
-/**
- * Get a connection from this manager.
- */
-public UnicastConnection getConnection() throws IOException {
- if (ssock == null) {
- return (getClientConnection());
- }
- else {
- return (getServerConnection());
- }
-}
-
-/**
- * Accept a connection to this server.
- */
-private UnicastConnection getServerConnection() throws IOException {
- Socket sock = ssock.accept();
- sock.setTcpNoDelay(true); //??
- UnicastConnection conn = new UnicastConnection(this, sock);
- conn.acceptConnection();
- if (debug){
- nssock++;
- System.out.println("\n\n ****** " + nssock + " server socks.\n\n");
- }
- //System.out.println("Server connection " + sock);
- return (conn);
-}
-
-/**
- * Make a conection from this client to the server.
- */
-private UnicastConnection getClientConnection() throws IOException {
- ArrayList conns = connections;
- UnicastConnection conn;
-
- synchronized(conns) {
- int nconn = conns.size() - 1;
-
- // if there're free connections in connection pool
- if(nconn >= 0) {
- conn = (UnicastConnection)conns.get(nconn);
- //Should we check if conn is alive using Ping??
- conns.remove(nconn);
-
- // Check if the connection is already expired
- long l = System.currentTimeMillis();
- if (!UnicastConnection.isExpired(conn, l)){
- return conn;
- }else {
- conn.disconnect();
- conn = null;
- }
- }
- }
-
- Socket sock = clientFactory.createSocket(serverName, serverPort);
- conn = new UnicastConnection(this, sock);
- conn.makeConnection(DEFAULT_PROTOCOL);
-
- if (debug) {
- ncsock++;
- System.out.println("\n\n ====== " + ncsock + " client socks.\n\n");
- }
-
- return (conn);
-}
-
-/**
- * Discard a connection when we're done with it - maybe it can be
- * recycled.
- */
-public void discardConnection(UnicastConnection conn) {
-//System.out.println("Discarding connection " + conn);
- //conn.disconnect();
- if (ssock != null) //server connection
- conn.disconnect();
- else {
- // To client connection, we'd like to return back to pool
- UnicastConnection.resetTime(conn);
- //Ensure there're only one scavenger globally
- synchronized(GLOBAL_LOCK) {
- connections.add(conn); //borrow this lock to garantee thread safety
- if (scavenger == null)
- startScavenger();
- }
- }
-}
-
-/**
- * Start a server on this manager if it's a server socket and we've not
- * already got one running.
- */
-public void startServer() {
- synchronized(this) {
- if (ssock == null || serverThread != null) {
- return;
- }
- serverThread = new Thread(this);
- // The following is not necessary when java.lang.Thread's constructor do this.
- // serverThread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
- }
- serverThread.start();
-}
-
-/**
- * Stop a server on this manager
- */
-public void stopServer() {
- synchronized(this) {
- if(serverThread != null){
- serverThread = null;
- try{
- ssock.close();
- }catch(Exception _){}
- }
- }
-}
-
-/**
- * Server thread for connection manager.
- */
-public void run() {
- for (;serverThread != null;) { // if serverThread==null, then exit thread
- try {
-//System.out.println("Waiting for connection on " + serverPort);
- UnicastConnection conn = getServerConnection();
-
- // get address of remote host for the RMIIncomingThread object
- String remoteHost = null;
- if (conn.sock != null) {
- remoteHost = conn.sock.getInetAddress().getHostAddress();
- }
-
- // use a thread pool to improve performance
- //ConnectionRunnerPool.dispatchConnection(conn);
- (new RMIIncomingThread(conn, remoteHost)).start();
-// (new Thread(conn)).start();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
-
-/**
- * Serialization routine.
- */
-void write(ObjectOutput out) throws IOException {
- out.writeUTF(serverName);
- out.writeInt(serverPort);
-}
-
-/**
- * Serialization routine.
- */
-static UnicastConnectionManager read(ObjectInput in) throws IOException {
- String host = in.readUTF();
- int port = in.readInt();
- //RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory;
- //return (getInstance(host, port, csf));
- return (getInstance(host, port, null));
-}
-
-}
-
-/**
- * This is use as the hashkey for the client/server connections.
- */
-class TripleKey {
-
-String host;
-int port;
-Object other;
-
-TripleKey(String host, int port, Object other) {
- this.host = host;
- this.port = port;
- this.other = other;
-}
-
-/**
- * Hash code just include the host and other - we ignore the port since
- * this has unusual matching behaviour.
- */
-public int hashCode() {
- return (host.hashCode() ^ other.hashCode());
-}
-
-public boolean equals(Object obj) {
- if (obj instanceof TripleKey) {
- TripleKey other = (TripleKey)obj;
- if (this.host.equals(other.host) &&
- this.other == other.other &&
- (this.port == other.port /* || this.port == 0 || other.port == 0*/)) {
- return (true);
- }
- }
- return (false);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRef.java b/libjava/gnu/java/rmi/server/UnicastRef.java
deleted file mode 100644
index c1b871f..0000000
--- a/libjava/gnu/java/rmi/server/UnicastRef.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/* UnicastRef.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.server.ObjID;
-import java.rmi.server.Operation;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RemoteCall;
-import java.rmi.server.RemoteObject;
-import java.rmi.server.RemoteRef;
-import java.rmi.server.UID;
-
-public class UnicastRef
- implements RemoteRef, ProtocolConstants {
-
-public ObjID objid;
-UnicastConnectionManager manager;
-
-/**
- * Used by serialization, and let subclass capable of having default constructor
- */
-// must be public otherwise java.rmi.RemoteObject cannot instantiate this class
-// -- iP
-public UnicastRef() {
-}
-
-public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) {
- this(objid);
- manager = UnicastConnectionManager.getInstance(host, port, csf);
-}
-
-public UnicastRef(ObjID objid) {
- this.objid = objid;
-}
-
-public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception {
- // Check if client and server are in the same VM, then local call can be used to
- // replace remote call, but it's somewhat violating remote semantic.
- Object svrobj = manager.serverobj;
-
- // Make sure that the server object is compatible. It could be loaded from a different
- // classloader --iP
- if(svrobj != null && method.getDeclaringClass().isInstance(svrobj)){
- //local call
- Object ret = null;
- try{
- ret = method.invoke(svrobj, params);
- }catch(InvocationTargetException e){
- throw (Exception)e.getTargetException();
- }
- //System.out.println("\n\n ***** local call: " + method + "\nreturn: " + ret + "\n\n");
- return ret;
- }
- //System.out.println("***************** remote call:" + manager.serverPort);
- return (invokeCommon(obj, method, params, -1, opnum));
-}
-
-private Object invokeCommon(Remote obj, Method method, Object[] params, int opnum, long hash) throws Exception {
- UnicastConnection conn;
- try {
- conn = manager.getConnection();
- }
- catch (IOException e1) {
- throw new RemoteException("connection failed to host: " + manager.serverName, e1);
- }
-
- ObjectOutputStream out;
- DataOutputStream dout;
- try {
- dout = conn.getDataOutputStream();
- dout.writeByte(MESSAGE_CALL);
-
- out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
-
- objid.write(out);
- out.writeInt(opnum);
- out.writeLong(hash);
-
- // must handle primitive class and their wrapper classes
- Class clss[] = method.getParameterTypes();
- for(int i = 0; i < clss.length; i++)
- ((RMIObjectOutputStream)out).writeValue(params[i], clss[i]);
-
- out.flush();
- }
- catch (IOException e2) {
- throw new RemoteException("call failed: ", e2);
- }
-
- int returncode;
- Object returnval;
- DataInputStream din;
- ObjectInputStream in;
- UID ack;
- try {
- din = conn.getDataInputStream();
-
- if ((returncode = din.readUnsignedByte()) != MESSAGE_CALL_ACK) {
- conn.disconnect();
- throw new RemoteException("Call not acked:" + returncode);
- }
-
- in = conn.startObjectInputStream(); // (re)start ObjectInputStream
- returncode = in.readUnsignedByte();
- ack = UID.read(in);
-
- Class cls = method.getReturnType();
-
- if (returncode == RETURN_NACK) {
- returnval = in.readObject(); // get Exception
-
- } else if(cls == Void.TYPE) {
- returnval = null;
- // in.readObject() // not required! returntype 'void' means no field is returned.
- } else {
- returnval = ((RMIObjectInputStream)in).readValue(cls); // get returnvalue
- }
- } catch (IOException e3) {
- //for debug: e3.printStackTrace();
- throw new RemoteException("call return failed: ", e3);
- }
-
- /* if DGCAck is necessary??
- //According to RMI wire protocol, send a DGCAck
- // to indicate receiving return value
- dout.writeByte(MESSAGE_DGCACK);
- ack.write(dout);
- out.flush();
- */
-
- manager.discardConnection(conn);
-
- if (returncode != RETURN_ACK && returnval != null) {
- if (returncode == RETURN_NACK) throw (Exception)returnval;
- else throw new RemoteException("unexpected returncode: " + returncode);
- }
-
- return (returnval);
-}
-
-/**
- * @deprecated
- */
-public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException {
- UnicastConnection conn;
-
- try {
- conn = manager.getConnection();
- }
- catch (IOException e1) {
- throw new RemoteException("connection failed to host: " + manager.serverName, e1);
- }
-
- //obj: useless?
-
- return (new UnicastRemoteCall(conn, objid, opnum, hash));
-}
-
-/**
- * @deprecated
- */
-public void invoke(RemoteCall call) throws Exception {
- UnicastRemoteCall c = (UnicastRemoteCall)call;
- call.executeCall();
-}
-
-/**
- * @deprecated
- */
-public void done(RemoteCall call) throws RemoteException {
- UnicastRemoteCall c = (UnicastRemoteCall)call;
- try{
- c.done();
- } catch(IOException e){}
- UnicastConnection conn = c.getConnection();
- manager.discardConnection(conn);
-}
-
-public void writeExternal(ObjectOutput out) throws IOException {
- if (manager == null) {
- throw new IOException("no connection");
- }
- manager.write(out);
- objid.write(out);
- // This byte is somewhat confusing when interoperating with JDK
- out.writeByte(0); //RETURN_ACK);
-}
-
-public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- manager = UnicastConnectionManager.read(in);
- objid = ObjID.read(in);
- byte ack = in.readByte();
- // This byte is somewhat confusing when interoperating with JDK
- if (ack != RETURN_ACK && ack != 0/*jdk ack value*/) {
- throw new IOException("no ack found");
- }
-}
-
-public boolean remoteEquals(RemoteRef ref) {
- throw new Error("Not implemented");
-}
-
-public int remoteHashCode() {
- throw new Error("Not implemented");
-}
-
-public String getRefClass(ObjectOutput out) {
- return ("UnicastRef");
-}
-
-public String remoteToString() {
- throw new Error("Not implemented");
-}
-
-public void dump(UnicastConnection conn) {
- try {
- DataInputStream din = conn.getDataInputStream();
- for (;;) {
- int b = din.readUnsignedByte();
- System.out.print(Integer.toHexString(b));
- if (b >= 32 && b < 128) {
- System.out.print(": " + (char)b);
- }
- System.out.println();
- }
- }
- catch (IOException _) {
- }
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
deleted file mode 100644
index c5206e7..0000000
--- a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/* UnicastRemoteCall.java
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.StreamCorruptedException;
-import java.rmi.MarshalException;
-import java.rmi.RemoteException;
-import java.rmi.UnmarshalException;
-import java.rmi.server.ObjID;
-import java.rmi.server.RemoteCall;
-import java.rmi.server.UID;
-import java.util.Vector;
-
-public class UnicastRemoteCall
- implements RemoteCall, ProtocolConstants
-{
-
- private UnicastConnection conn;
- private Object result;
- private Object object;
- private int opnum;
- private long hash;
- // These are package-private due to inner class access.
- Vector vec;
- int ptr;
- private ObjID objid;
-
- private ObjectOutput oout;
- private ObjectInput oin;
-
- /**
- * Incoming call.
- */
- UnicastRemoteCall(UnicastConnection conn)
- {
- this.conn = conn;
- }
-
- /**
- * Outgoing call.
- */
- UnicastRemoteCall(UnicastConnection conn, ObjID objid, int opnum, long hash)
- throws RemoteException
- {
- this.conn = conn;
- this.opnum = opnum;
- this.hash = hash;
- this.objid = objid;
- }
-
- UnicastConnection getConnection()
- {
- return conn;
- }
-
- public ObjectOutput getOutputStream() throws IOException
- {
- if (vec == null)
- vec = new Vector();
- return (new DummyObjectOutputStream());
- }
-
- public void releaseOutputStream() throws IOException
- {
- if (vec != null)
- {
- oout = conn.getObjectOutputStream();
-
- for (int i = 0; i < vec.size(); i += 2)
- {
- boolean primitive = ((Boolean)vec.elementAt(i)).booleanValue();
- Object data = vec.elementAt(i+1);
-
- // No type, this is
- if (!primitive)
- oout.writeObject(data);
- else
- {
- if (data instanceof Boolean)
- oout.writeBoolean(((Boolean)data).booleanValue());
- else if (data instanceof Character)
- oout.writeChar(((Character)data).charValue());
- else if (data instanceof Byte)
- oout.writeByte(((Byte)data).byteValue());
- else if (data instanceof Short)
- oout.writeShort(((Short)data).shortValue());
- else if (data instanceof Integer)
- oout.writeInt(((Integer)data).intValue());
- else if (data instanceof Long)
- oout.writeLong(((Long)data).longValue());
- }
- }
- vec = null;
- }
- if(oout != null)
- oout.flush();
- }
-
- /**
- *
- * (re)starts ObjectInputStream
- *
- */
- public ObjectInput startInputStream() throws IOException
- {
- if (conn != null) {
- return (oin = conn.startObjectInputStream());
- } else {
- return getInputStream(); // dummy Input Stream
- }
-
- }
-
- public ObjectInput getInputStream() throws IOException
- {
- if (conn != null)
- {
- if(oin == null)
- return (oin = conn.getObjectInputStream());
- else
- return oin;
- }
- else
- {
- ptr = 0;
- return (new DummyObjectInputStream());
- }
- }
-
- public void releaseInputStream() throws IOException
- {
- // Does nothing.
- }
-
- public ObjectOutput getResultStream(boolean success)
- throws IOException, StreamCorruptedException
- {
- vec = new Vector();
- return new DummyObjectOutputStream();
- }
-
- public void executeCall() throws Exception
- {
- byte returncode;
- ObjectInput oin;
-
- // signal the call when constructing
- try
- {
- DataOutputStream dout = conn.getDataOutputStream();
- dout.write(MESSAGE_CALL);
-
- oout = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
- objid.write(oout);
- oout.writeInt(opnum);
- oout.writeLong(hash);
- }
- catch(IOException ex)
- {
- throw new MarshalException("Try to write header but failed.", ex);
- }
-
- try
- {
- releaseOutputStream();
- DataInputStream din = conn.getDataInputStream();
- if (din.readByte() != MESSAGE_CALL_ACK)
- throw new RemoteException("Call not acked");
-
- oin = startInputStream();
- returncode = oin.readByte();
- UID.read(oin);
- }
- catch(IOException ex)
- {
- throw new UnmarshalException("Try to read header but failed:", ex);
- }
-
- //check return code
- switch(returncode)
- {
- case RETURN_ACK: //it's ok
- return;
- case RETURN_NACK:
- Object returnobj;
- try
- {
- returnobj = oin.readObject();
- }
- catch(Exception ex2)
- {
- throw new UnmarshalException
- ("Try to read exception object but failed", ex2);
- }
-
- if(!(returnobj instanceof Exception))
- throw new UnmarshalException("Should be Exception type here: "
- + returnobj);
- throw (Exception)returnobj;
-
- default:
- throw new UnmarshalException("Invalid return code");
- }
- }
-
- public void done() throws IOException
- {
- // conn.disconnect();
- }
-
- boolean isReturnValue()
- {
- return vec.size() > 0;
- }
-
- Object returnValue()
- {
- // This is not the first one (Boolean) but the second.
- return vec.elementAt(1);
- }
-
- Object[] getArguments()
- {
- return vec.toArray();
- }
-
- Object getObject()
- {
- return object;
- }
-
- int getOpnum()
- {
- return opnum;
- }
-
- long getHash()
- {
- return hash;
- }
-
- void setReturnValue(Object obj)
- {
- vec.removeAllElements();
- vec.addElement(obj);
- }
-
- /**
- * Dummy object output class.
- */
- private class DummyObjectOutputStream implements ObjectOutput
- {
- /**
- * Non-private constructor to reduce bytecode emitted.
- */
- DummyObjectOutputStream()
- {
- }
-
- public void writeBoolean(boolean v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(Boolean.valueOf(v));
- }
-
- public void writeByte(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Byte((byte) v));
- }
-
- public void writeChar(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Character((char) v));
- }
-
- public void writeDouble(double v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Double(v));
- }
-
- public void writeFloat(float v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Float(v));
- }
-
- public void writeInt(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Integer(v));
- }
-
- public void writeLong(long v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Long(v));
- }
-
- public void writeShort(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Short((short) v));
- }
-
- public void writeObject(Object obj) throws IOException
- {
- vec.addElement(Boolean.FALSE);
- vec.addElement(obj);
- }
-
- public void write(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void write(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void write(int b) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeBytes(String s) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeChars(String s) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeUTF(String str) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void flush() throws IOException
- {
- }
-
- public void close() throws IOException
- {
- }
- } // class DummyObjectOutputStream
-
- /**
- * Dummy object input class.
- */
- private class DummyObjectInputStream implements ObjectInput
- {
- /**
- * Non-private constructor to reduce bytecode emitted.
- */
- DummyObjectInputStream()
- {
- }
-
- public boolean readBoolean() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Boolean) obj).booleanValue();
- }
-
- public byte readByte() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Byte) obj).byteValue();
- }
-
- public char readChar() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Character) obj).charValue();
- }
-
- public double readDouble() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Double) obj).doubleValue();
- }
-
- public float readFloat() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Float) obj).floatValue();
- }
-
- public int readInt() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Integer) obj).intValue();
- }
-
- public long readLong() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Long) obj).longValue();
- }
-
- public short readShort() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Short) obj).shortValue();
- }
-
- public Object readObject() throws IOException
- {
- return vec.elementAt(ptr++);
- }
-
- public int read(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int read(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int read() throws IOException
- {
- throw new IOException("not required");
- }
-
- public long skip(long n) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int available() throws IOException
- {
- throw new IOException("not required");
- }
-
- public void readFully(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void readFully(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public String readLine() throws IOException
- {
- throw new IOException("not required");
- }
-
- public String readUTF() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int readUnsignedByte() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int readUnsignedShort() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int skipBytes(int n) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void close() throws IOException
- {
- }
- } // class DummyObjectInputStream
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteStub.java b/libjava/gnu/java/rmi/server/UnicastRemoteStub.java
deleted file mode 100644
index 87e932d..0000000
--- a/libjava/gnu/java/rmi/server/UnicastRemoteStub.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* UnicastRemoteStub.java --
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.rmi.server.RemoteRef;
-import java.rmi.server.RemoteStub;
-
-public class UnicastRemoteStub
- extends RemoteStub {
-
-public static void setStubRef(RemoteStub stub, RemoteRef ref) {
- setRef(stub, ref);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java
deleted file mode 100644
index 065ef8c..0000000
--- a/libjava/gnu/java/rmi/server/UnicastServer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/* UnicastServer.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import gnu.java.rmi.dgc.DGCImpl;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.rmi.NoSuchObjectException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.ServerError;
-import java.rmi.server.ObjID;
-import java.rmi.server.UID;
-import java.util.Hashtable;
-
-public class UnicastServer
- implements ProtocolConstants {
-
-static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref
-static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref
-static private DGCImpl dgc;
-
-public static void exportObject(UnicastServerRef obj) {
- startDGC();
- objects.put(obj.objid, obj);
- refcache.put(obj.myself, obj);
- obj.manager.startServer();
-}
-
-// FIX ME: I haven't handle force parameter
-public static boolean unexportObject(UnicastServerRef obj, boolean force) {
- objects.remove(obj.objid);
- refcache.remove(obj.myself);
- obj.manager.stopServer();
- return true;
-}
-
-public static UnicastServerRef getExportedRef(Remote remote){
- return (UnicastServerRef)refcache.get(remote);
-}
-
-private static synchronized void startDGC() {
- if (dgc == null) {
- try {
- dgc = new DGCImpl();
- // Changed DGCImpl to inherit UnicastServerRef directly
- //((UnicastServerRef)dgc.getRef()).exportObject(dgc);
- dgc.exportObject(dgc);
- }
- catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-}
-
-public static void dispatch(UnicastConnection conn) throws Exception {
- switch (conn.getDataInputStream().readUnsignedByte()) {
- case MESSAGE_CALL:
- incomingMessageCall(conn);
- break;
- case MESSAGE_PING:
- // jdk sends a ping before each method call -> answer it!
- DataOutputStream out = conn.getDataOutputStream();
- out.writeByte(MESSAGE_PING_ACK);
- out.flush();
- break;
- default:
- throw new Exception("bad method type");
- }
-}
-
-private static void incomingMessageCall(UnicastConnection conn) throws IOException {
- ObjectInputStream in = conn.startObjectInputStream(); // (re)start ObjectInputStream
-
- ObjID objid = ObjID.read(in);
- int method = in.readInt();
- long hash = in.readLong();
-
-//System.out.println("ObjID: " + objid + ", method: " + method + ", hash: " + hash);
-
- // Use the objid to locate the relevant UnicastServerRef
- UnicastServerRef uref = (UnicastServerRef)objects.get(objid);
- Object returnval;
- int returncode = RETURN_ACK;
- // returnval is from Method.invoke(), so we must check the return class to see
- // if it's primitive type
- Class returncls = null;
- if (uref != null) {
- try {
- // Dispatch the call to it.
- returnval = uref.incomingMessageCall(conn, method, hash);
- returncls = uref.getMethodReturnType(method, hash);
- }
- catch (Exception e) {
- returnval = e;
- returncode = RETURN_NACK;
- }
- catch (Error e) {
- returnval = new ServerError ("An Error is thrown while processing the invocation on the server", e);
- returncode = RETURN_NACK;
- }
- }
- else {
- returnval = new NoSuchObjectException("");
- returncode = RETURN_NACK;
- }
-
- conn.getDataOutputStream().writeByte(MESSAGE_CALL_ACK);
-
- ObjectOutputStream out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
-
- out.writeByte(returncode);
- (new UID()).write(out);
-
- //System.out.println("returnval=" + returnval + " returncls=" + returncls);
-
- if(returnval != null && returncls != null)
- ((RMIObjectOutputStream)out).writeValue(returnval, returncls);
-
- // 1.1/1.2 void return type detection:
- else if (!(returnval instanceof RMIVoidValue || returncls == Void.TYPE))
- out.writeObject(returnval);
-
- out.flush();
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java
deleted file mode 100644
index 1f6eede..0000000
--- a/libjava/gnu/java/rmi/server/UnicastServerRef.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/* UnicastServerRef.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RemoteRef;
-import java.rmi.server.RemoteServer;
-import java.rmi.server.RemoteStub;
-import java.rmi.server.ServerNotActiveException;
-import java.rmi.server.ServerRef;
-import java.rmi.server.Skeleton;
-import java.util.Hashtable;
-
-public class UnicastServerRef
- extends UnicastRef
- implements ServerRef{ //SHOULD implement ServerRef
-
-final static private Class[] stubprototype = new Class[] { RemoteRef.class };
-
-Remote myself; //save the remote object itself
-private Skeleton skel;
-private RemoteStub stub;
-private Hashtable methods = new Hashtable();
-
-/**
- * Used by serialization.
- */
-UnicastServerRef()
-{
-}
-
-public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) throws RemoteException {
- super(id);
- manager = UnicastConnectionManager.getInstance(port, ssf);
-}
-
-public RemoteStub exportObject(Remote obj) throws RemoteException {
- if (myself == null) {
- myself = obj;
- // Save it to server manager, to let client calls in the same VM to issue
- // local call
- manager.serverobj = obj;
-
- // Find and install the stub
- Class cls = obj.getClass();
- Class expCls;
- try {
- // where ist the _Stub? (check superclasses also)
- expCls = findStubSkelClass(cls);
- } catch (Exception ex) {
- throw new RemoteException("can not find stubs for class: " + cls, ex);
- }
-
- stub = (RemoteStub)getHelperClass(expCls, "_Stub");
- if (stub == null) {
- throw new RemoteException("failed to export: " + cls);
- }
-
- // Find and install the skeleton (if there is one)
- skel = (Skeleton)getHelperClass(expCls, "_Skel");
-
- // Build hash of methods which may be called.
- buildMethodHash(obj.getClass(), true);
-
- // Export it.
- UnicastServer.exportObject(this);
- }
-
- return (stub);
-}
-
-public RemoteStub exportObject(Remote remote, Object obj)
- throws RemoteException
-{
- //FIX ME
- return exportObject(remote);
-}
-
-public RemoteStub getStub(){
- return stub;
-}
-
-
-public boolean unexportObject(Remote obj, boolean force) {
- // Remove all hashes of methods which may be called.
- buildMethodHash(obj.getClass(), false);
- return UnicastServer.unexportObject(this, force);
-}
-
-/**
-*
-* The Subs/Skels might not there for the actual class, but maybe
-* for one of the superclasses.
-*
-*/
-private Class findStubSkelClass(Class startCls) throws Exception {
- Class cls = startCls;
-
- while (true) {
- try {
- String stubClassname = cls.getName() + "_Stub";
- ClassLoader cl = cls.getClassLoader();
- Class scls = cl == null ? Class.forName(stubClassname)
- : cl.loadClass(stubClassname);
- return cls; // found it
- } catch (ClassNotFoundException e) {
- Class superCls = cls.getSuperclass();
- if (superCls == null
- || superCls == java.rmi.server.UnicastRemoteObject.class)
- {
- throw new Exception("Neither " + startCls
- + " nor one of their superclasses (like" + cls + ")"
- + " has a _Stub");
- }
- cls = superCls;
- }
- }
-}
-
-
-
-private Object getHelperClass(Class cls, String type) {
- try {
- String classname = cls.getName();
- ClassLoader cl = cls.getClassLoader();
- Class scls = cl == null ? Class.forName(classname + type)
- : cl.loadClass(classname + type);
- if (type.equals("_Stub")) {
- try {
- // JDK 1.2 stubs
- Constructor con = scls.getConstructor(stubprototype);
- return (con.newInstance(new Object[]{this}));
- }
- catch (NoSuchMethodException e) {
- }
- catch (InstantiationException e) {
- }
- catch (IllegalAccessException e) {
- }
- catch (IllegalArgumentException e) {
- }
- catch (InvocationTargetException e) {
- }
- // JDK 1.1 stubs
- RemoteStub stub = (RemoteStub)scls.newInstance();
- UnicastRemoteStub.setStubRef(stub, this);
- return (stub);
- }
- else {
- // JDK 1.1 skel
- return (scls.newInstance());
- }
- }
- catch (ClassNotFoundException e) {
- }
- catch (InstantiationException e) {
- }
- catch (IllegalAccessException e) {
- }
- return (null);
-}
-
-
-
-public String getClientHost() throws ServerNotActiveException {
- return RemoteServer.getClientHost();
-}
-
-private void buildMethodHash(Class cls, boolean build) {
- Method[] meths = cls.getMethods();
- for (int i = 0; i < meths.length; i++) {
- /* Don't need to include any java.xxx related stuff */
- if (meths[i].getDeclaringClass().getName().startsWith("java.")) {
- continue;
- }
- long hash = RMIHashes.getMethodHash(meths[i]);
- if(build)
- methods.put(new Long (hash), meths[i]);
- else
- methods.remove(new Long (hash));
-//System.out.println("meth = " + meths[i] + ", hash = " + hash);
- }
-}
-
-Class getMethodReturnType(int method, long hash) throws Exception
-{
- if (method == -1) {
- Method meth = (Method)methods.get(new Long (hash));
- return meth.getReturnType();
- }else
- return null;
-}
-
-public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {
-//System.out.println("method = " + method + ", hash = " + hash);
- // If method is -1 then this is JDK 1.2 RMI - so use the hash
- // to locate the method
- if (method == -1) {
- Method meth = (Method)methods.get(new Long (hash));
-//System.out.println("class = " + myself.getClass() + ", meth = " + meth);
- if (meth == null) {
- throw new NoSuchMethodException();
- }
-
- ObjectInputStream in = conn.getObjectInputStream();
- int nrargs = meth.getParameterTypes().length;
- Object[] args = new Object[nrargs];
- for (int i = 0; i < nrargs; i++) {
- /**
- * For debugging purposes - we don't handle CodeBases
- * quite right so we don't always find the stubs. This
- * lets us know that.
- */
- try {
- // need to handle primitive types
- args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]);
-
- }
- catch (Exception t) {
- t.printStackTrace();
- throw t;
- }
- }
- //We must reinterpret the exception thrown by meth.invoke()
- //return (meth.invoke(myself, args));
- Object ret = null;
- try{
- ret = meth.invoke(myself, args);
- }catch(InvocationTargetException e){
- Throwable cause = e.getTargetException();
- if (cause instanceof Exception) {
- throw (Exception)cause;
- }
- else if (cause instanceof Error) {
- throw (Error)cause;
- }
- else {
- throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e);
- }
- }
- return ret;
- }
- // Otherwise this is JDK 1.1 style RMI - we find the skeleton
- // and invoke it using the method number. We wrap up our
- // connection system in a UnicastRemoteCall so it appears in a
- // way the Skeleton can handle.
- else {
- if (skel == null) {
- throw new NoSuchMethodException();
- }
- UnicastRemoteCall call = new UnicastRemoteCall(conn);
- skel.dispatch(myself, call, method, hash);
- if (!call.isReturnValue())
- return RMIVoidValue.INSTANCE;
- else
- return (call.returnValue());
- }
-}
-
-}
-
-