diff options
Diffstat (limited to 'libjava/classpath/gnu/java/rmi')
31 files changed, 718 insertions, 722 deletions
diff --git a/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectInputStream.java index 1400693..f963107 100644 --- a/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectInputStream.java +++ b/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectInputStream.java @@ -7,7 +7,7 @@ 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 @@ -45,21 +45,21 @@ import java.io.IOException; import java.io.ObjectInputStream; /** - * This class is only for java.rmi.MarshalledObject to deserialize object from + * 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 { @@ -67,5 +67,5 @@ public class RMIMarshalledObjectInputStream extends RMIObjectInputStream return null; return locStream.readObject(); } - + } // End of RMIMarshalledObjectInputStream diff --git a/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java index 2bbbaac..3bdf923 100644 --- a/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java +++ b/libjava/classpath/gnu/java/rmi/RMIMarshalledObjectOutputStream.java @@ -7,7 +7,7 @@ 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 @@ -46,34 +46,33 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; /** - * This class is only for java.rmi.MarshalledObject to serialize object and + * 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 +} // End of RMIMarshalledObjectOutputStream diff --git a/libjava/classpath/gnu/java/rmi/activation/ActivationSystemTransient.java b/libjava/classpath/gnu/java/rmi/activation/ActivationSystemTransient.java index 1557220..975e13f 100644 --- a/libjava/classpath/gnu/java/rmi/activation/ActivationSystemTransient.java +++ b/libjava/classpath/gnu/java/rmi/activation/ActivationSystemTransient.java @@ -59,7 +59,7 @@ import java.util.Map; /** * Provides the default transient activation system. - * + * * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public class ActivationSystemTransient @@ -69,8 +69,8 @@ public class ActivationSystemTransient /** * Maps group identifiers into group descriptions. */ - protected final BidiTable groupDescs; - + protected final BidiTable groupDescs; + /** * Maps object identifiers into object activation descriptions */ @@ -80,29 +80,29 @@ public class ActivationSystemTransient * Maps group identifiers into already activated groups. */ protected transient final Map groupInstantiators = new Hashtable(); - + /** * The cache of the activated objects, maps activation ids to remote * object stubs. */ protected transient final Map activatedObjects = new HashMap(); - + /** * The object incarnation counter. */ static long groupIncarnations = 0; - + /** * The singleton of this activation system */ static ActivationSystem singleton; - + /** * Set to true to print the event messages to console. */ public static boolean debug = false; - - + + /** * Creates the group which uses the given maps to store the data. */ @@ -112,7 +112,7 @@ public class ActivationSystemTransient descriptions = objectDescriptions; groupDescs = groupDescriptiopns; } - + /** * Creates the group with transient maps. */ @@ -120,14 +120,14 @@ public class ActivationSystemTransient { this (new BidiTable(), new BidiTable()); } - + public static ActivationSystem getInstance() { if (singleton == null) singleton = new ActivationSystemTransient(); return singleton; } - + /** * Activate the given object (try cache first if force = false) */ @@ -149,7 +149,7 @@ public class ActivationSystemTransient throw new UnknownObjectException("Activating unknown object "+ id == null ? "null" : id.toString()); - ActivationInstantiator group = + ActivationInstantiator group = (ActivationInstantiator) groupInstantiators.get(desc.getGroupID()); if (group == null) @@ -159,7 +159,7 @@ public class ActivationSystemTransient ActivationGroupDesc adesc = (ActivationGroupDesc) groupDescs.get(gid); if (adesc == null) - throw new UnknownGroupException("Activating unknown group " + throw new UnknownGroupException("Activating unknown group " + gid + " for "+ id+" this "+this); synchronized (ActivationSystemTransient.class) @@ -179,7 +179,7 @@ public class ActivationSystemTransient } return object; } - + /** * Returns the activation monitor (THIS) and remebers the instantiator, used * by that group. @@ -192,10 +192,10 @@ public class ActivationSystemTransient groupInstantiators.put(id, group); return this; } - + /** * Get the activation descriptor for the given activation id. - * + * * @return the activation descriptor, never null. * @throws UnknownObjectException if such object is unknown. */ @@ -208,10 +208,10 @@ public class ActivationSystemTransient id == null ? "null" : id.toString()); return desc; } - + /** * Get the descriptor of the given activation group. - * + * * @return the activation group descriptor, never null. * @throws UnknownGroupException if such group is unknown */ @@ -245,7 +245,7 @@ public class ActivationSystemTransient return id; } - + /** * Create the object activation id and put this id-descriptor combination into * the group map. The new ID will only be created if this description has not @@ -261,13 +261,13 @@ public class ActivationSystemTransient id = new ActivationID(this); descriptions.put(id, desc); } - + if (debug) System.out.println("Register object " + id +":"+desc+" this "+this); - + return id; } - + /** * Replace the activation descriptor, return the previous descriptor. */ @@ -279,7 +279,7 @@ public class ActivationSystemTransient descriptions.put(id, desc); return prev; } - + /** * Replace the activation group descriptor, return the previous descriptor. */ @@ -292,7 +292,7 @@ public class ActivationSystemTransient groupDescs.put(groupId, groupDesc); return prev; } - + /** * Calls .shutdown on all bidirectional tables (has no effect if these * table are not persistent). @@ -302,7 +302,7 @@ public class ActivationSystemTransient descriptions.shutdown(); groupDescs.shutdown(); } - + /** * Remove the group from the group map */ @@ -311,11 +311,11 @@ public class ActivationSystemTransient { if (! groupDescs.containsKey(groupId)) throw new UnknownGroupException("Unknown group "+groupId); - + groupDescs.removeKey(groupId); groupInstantiators.remove(groupId); } - + /** * Remove the object id from the active object and description maps. */ @@ -331,7 +331,7 @@ public class ActivationSystemTransient activatedObjects.remove(id); } } - + /** * Put the object into active object map. */ @@ -360,7 +360,7 @@ public class ActivationSystemTransient throw un; } } - + /** * Check if the group is known. Remove all active objects, belonging to * that group, from the active object cache. @@ -370,9 +370,9 @@ public class ActivationSystemTransient { if (! groupInstantiators.containsKey(groupId)) throw new UnknownGroupException("Inactivating unkwnon group"); - + groupInstantiators.remove(groupId); - + // Remove all members of this group from the cache. synchronized (activatedObjects) { diff --git a/libjava/classpath/gnu/java/rmi/activation/BidiTable.java b/libjava/classpath/gnu/java/rmi/activation/BidiTable.java index 5e421fe..ed9d959 100644 --- a/libjava/classpath/gnu/java/rmi/activation/BidiTable.java +++ b/libjava/classpath/gnu/java/rmi/activation/BidiTable.java @@ -45,26 +45,26 @@ import java.util.Map; /** * The bidirectional hash table, maps both a to b and b to a. - * - * @author Audrius Meskauskas (audriusa@bioinformatics.org) + * + * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ -public class BidiTable +public class BidiTable { /** * Use serialVerionUID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Maps keys to values */ protected Map k2v; - + /** * Maps values to keys (in reverse) */ protected Map v2k; - + /** * Create a new table that is ready to use. */ @@ -73,17 +73,17 @@ public class BidiTable k2v = new HashMap(); v2k = new HashMap(); } - + /** * Create a new instance where the hashtable fields are not initialised * (called from derivatives that intialise hashtables in they own way. - * + * * @param flags currently used to mark the different constructor only. */ protected BidiTable(int flags) { } - + /** * Get key by value */ @@ -91,7 +91,7 @@ public class BidiTable { return v2k.get(value); } - + /** * Put key-value pair. */ @@ -100,7 +100,7 @@ public class BidiTable k2v.put(key, value); v2k.put(value, key); } - + /** * Get value from key */ @@ -108,7 +108,7 @@ public class BidiTable { return k2v.get(key); } - + /** * Remove the key-value pair by key */ @@ -121,7 +121,7 @@ public class BidiTable v2k.remove(value); } } - + /** * Check if the table contains this key. */ @@ -129,7 +129,7 @@ public class BidiTable { return k2v.containsKey(key); } - + /** * This method is called before exit and may be used to write the database * to the disk. The default method does nothing. @@ -137,7 +137,7 @@ public class BidiTable public synchronized void shutdown() { } - + /** * Get the size. */ @@ -145,7 +145,7 @@ public class BidiTable { return k2v.size(); } - + /** * Get the key collection. */ @@ -157,7 +157,7 @@ public class BidiTable Iterator iter = keys.iterator(); for (int i = 0; i < k.length; i++) k[i] = iter.next(); - + return k; } } diff --git a/libjava/classpath/gnu/java/rmi/activation/DefaultActivationGroup.java b/libjava/classpath/gnu/java/rmi/activation/DefaultActivationGroup.java index 3a654f2..526d2ef 100644 --- a/libjava/classpath/gnu/java/rmi/activation/DefaultActivationGroup.java +++ b/libjava/classpath/gnu/java/rmi/activation/DefaultActivationGroup.java @@ -55,9 +55,9 @@ import java.rmi.activation.UnknownObjectException; /** * The default activation group class. This activation group assumes that * all classes are accessible via current thread context class loader. - * The remote class loading is not supported for security reasons. The + * The remote class loading is not supported for security reasons. The * activation always occurs in the current jre. - * + * * @author Audrius Meskauskas (audriusa@Bioinformatics.org) */ public class DefaultActivationGroup @@ -67,7 +67,7 @@ public class DefaultActivationGroup * Use the serialVersionUID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Used during the group creation (required constructor). */ @@ -76,23 +76,23 @@ public class DefaultActivationGroup ActivationID.class, MarshalledObject.class }; - - + + /** * Create the new default activation group. - * + * * @param id the group activation id. * @param data may contain the group initialization data (unused and can be * null) * @throws RemoteException if the super constructor does - */ + */ public DefaultActivationGroup(ActivationGroupID id, MarshalledObject data) throws RemoteException { super(id); } - - + + /** * May be overridden and used as a hook. This method is called each time * the new object is instantiated. @@ -108,14 +108,14 @@ public class DefaultActivationGroup * information, stored in the passed descriptor. The method expects the object * class to have the two parameter constructor, the first parameter being the * {@link ActivationID} and the second the {@link MarshalledObject}. - * + * * @param id the object activation id * @param desc the activation descriptor, providing the information, necessary * to create and activate the object * @return the marshalled object, containing the exported stub of the created * object * @throws ActivationException if the activation fails due any reason - */ + */ public MarshalledObject newInstance(ActivationID id, ActivationDesc desc) throws ActivationException, RemoteException { @@ -123,7 +123,7 @@ public class DefaultActivationGroup { if (ActivationSystemTransient.debug) System.out.println("Instantiating "+desc.getClassName()); - + Remote object; Class objectClass; @@ -132,19 +132,19 @@ public class DefaultActivationGroup Constructor constructor = objectClass.getConstructor(cConstructorTypes); object = (Remote) constructor.newInstance( new Object[] { id, desc.getData() }); - + // Make the object accessible and create the stub. ActivatableServerRef ref = UnicastServer.getActivatableRef(id); Remote stub = ref.exportObject(object); - + MarshalledObject marsh = new MarshalledObject(stub); - + // Notify the activation monitor. activeObject(id, marsh); - + // Make call to the hook that may be overridden. activeObject(id, stub); - + return marsh; } catch (Exception e) diff --git a/libjava/classpath/gnu/java/rmi/activation/DefaultActivationSystem.java b/libjava/classpath/gnu/java/rmi/activation/DefaultActivationSystem.java index 754b5dc..3d16250 100644 --- a/libjava/classpath/gnu/java/rmi/activation/DefaultActivationSystem.java +++ b/libjava/classpath/gnu/java/rmi/activation/DefaultActivationSystem.java @@ -44,7 +44,7 @@ import java.rmi.registry.Registry; /** * Finds and returns the default activation system for this jre. - * + * * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public abstract class DefaultActivationSystem @@ -53,17 +53,17 @@ public abstract class DefaultActivationSystem * The activation system (assigned if once found). */ static ActivationSystem system; - + /** * The default activation registry port. */ static int ACTIVATION_REGISTRY_PORT; - + /** * The name of the activation system registry port property. */ static String AS_PORT_PROPERTY = "java.rmi.activation.port"; - + /** * The defalut name of the activation system in the activation registry. */ diff --git a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl.java b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl.java index a5c036e..5efbf27 100644 --- a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl.java +++ b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl.java @@ -68,12 +68,12 @@ public class DGCImpl * The DGCImpl extends UnicastServerRef and not UnicastRemoteObject, because * UnicastRemoteObject must exportObject automatically. */ - + /** * Use the serial version UID for interoperability. */ private static final long serialVersionUID = 1; - + /** * Protects the array of object Id's for the scheduled period of time * (lease). After the time expires, the protector is automatically discarded, @@ -87,11 +87,11 @@ public class DGCImpl * multiple references that are stored to collection. */ Collection[] references; - + /** * Create the new instance of the reference protector that protects the * given array of ids and exists for the given period of time. - * + * * @param ids the ids to protect. */ RefProtector(ObjID[] ids, long timeToLive) @@ -101,11 +101,11 @@ public class DGCImpl { references[i] = UnicastServer.getExported(ids[i]); } - + // Schedule the existence. LeaseRenewingTask.timer.schedule(this, timeToLive); } - + /** * Break all links, ensuring easy collection of the references by the gc. */ @@ -118,16 +118,16 @@ public class DGCImpl } } } - + /** * This defauld lease value is used if the lease value, passed to the * {@link #dirty} is equal to zero. */ static final long LEASE_VALUE = 600000L; - + /** * Create the new DGC implementation. - * + * * @throws RemoteException if the super constructor throws or the * socket factory fails. */ @@ -138,7 +138,7 @@ public class DGCImpl /** * Mark the given objects referecnes as used on the client side. - * + * * @param ids the ids of the used objects. * @param sequenceNum the number of the call (used to detect and discard late * calls). @@ -147,17 +147,17 @@ public class DGCImpl */ public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException - { + { // We do not fill in VMID because in this implementation it is not used. long leaseValue = lease.getValue(); - + // Grant the maximal default lease time if the passed value is zero. if (leaseValue <= 0) leaseValue = LEASE_VALUE; - + // Create (and shedule of the given existence) the new reference // protector. - new RefProtector(ids, leaseValue); + new RefProtector(ids, leaseValue); lease = new Lease(lease.getVMID(), leaseValue); return lease; @@ -165,7 +165,7 @@ public class DGCImpl /** * Mark the given objects as no longer used on the client side. - * + * * @param ids the ids of the objects that are no longer used. * @param sequenceNum the number of the call (used to detect and discard late * calls) diff --git a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Skel.java b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Skel.java index 5f032e7..a40b48c 100644 --- a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Skel.java +++ b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Skel.java @@ -44,16 +44,16 @@ 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) { @@ -69,7 +69,7 @@ public final class DGCImpl_Skel 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: @@ -84,7 +84,7 @@ public final class DGCImpl_Skel $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); @@ -104,7 +104,7 @@ public final class DGCImpl_Skel } break; } - + case 1: { java.rmi.server.ObjID[] $param_0; @@ -115,7 +115,7 @@ public final class DGCImpl_Skel $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); @@ -136,7 +136,7 @@ public final class DGCImpl_Skel } break; } - + default: throw new java.rmi.UnmarshalException("invalid method number"); } diff --git a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java index 9f18d12..dac8b6f 100644 --- a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java +++ b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java @@ -45,39 +45,39 @@ public final class DGCImpl_Stub 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) { @@ -114,7 +114,7 @@ public final class DGCImpl_Stub 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) { @@ -154,5 +154,5 @@ public final class DGCImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + } diff --git a/libjava/classpath/gnu/java/rmi/dgc/LeaseRenewingTask.java b/libjava/classpath/gnu/java/rmi/dgc/LeaseRenewingTask.java index ffb5560..7995af7 100644 --- a/libjava/classpath/gnu/java/rmi/dgc/LeaseRenewingTask.java +++ b/libjava/classpath/gnu/java/rmi/dgc/LeaseRenewingTask.java @@ -54,11 +54,11 @@ import java.util.WeakHashMap; * sheduled task does not prevent it from being garbage collected. If the * reference has not been garbage collected, the task is resheduled after * the lease is renewed. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class LeaseRenewingTask -{ +{ /** * The sheduled timer task to call the renew() method. */ @@ -69,12 +69,12 @@ public class LeaseRenewingTask renew(); } } - + /** * The default requested lease duration time (one minute by default). */ public static long REQUEST_LEASE_DURATION = 60000; - + /** * The reference to the UnicastRef that must renew its lease until not * garbage collected. The different members of this list may point to the @@ -84,28 +84,28 @@ public class LeaseRenewingTask * frequent deletions from the middle easy. */ LinkedList ref = new LinkedList(); - + /** * The granted (or supposed) lease. */ Lease lease = new Lease(null, REQUEST_LEASE_DURATION); - + /** * The timer, shared by all lease renewing tasks. The same instance is also * used for the reference protector discarding in DGCImpl. */ static Timer timer = new Timer(true); - + /** * Maps the UnicastRef to its renewing task. */ - static WeakHashMap existingTasks = new WeakHashMap(); - + static WeakHashMap existingTasks = new WeakHashMap(); + /** * Creates the lease renewing task that renews the lease of the given * UnicastRef until it is not collected. This constructor requests the lease * value from the server and schedules the lease renewal action. - * + * * @param renewIt the reference that must be renewed. */ public LeaseRenewingTask(UnicastRef renewIt) @@ -117,10 +117,10 @@ public class LeaseRenewingTask ref.add(new WeakReference(renewIt)); } } - + /** * Schedule periodic leases for the given UnicastRef reference. - * + * * @param renewIt the reference, for that the leases must be scheduled. */ public static void scheduleLeases(UnicastRef renewIt) @@ -155,23 +155,23 @@ public class LeaseRenewingTask throw ierr; } } - + /** * Shedule the renewing call, taking into consideration that the following * lease was granted. - * + * * @param lease the lease that was granted. */ public void schedule(Lease lease) { long value = lease.getValue(); - + // Shedule a 10 % earlier because some time is needed for the message // to reach the server. long reduced = (value * 90)/100; if (reduced == 0) reduced = value; - + timer.schedule(new LeaseTimerTask(), reduced); } @@ -197,11 +197,11 @@ public class LeaseRenewingTask iter.remove(); } } - + if (renewIt!=null) { Lease lease = notifyDGC( (UnicastRef) renewIt); - + // Schedule the next renewing session. if (lease!=null) schedule(lease); @@ -210,10 +210,10 @@ public class LeaseRenewingTask // All references collected - discard this entry. } } - + /** * Notify DGC that we still hold this reference. - * + * * @param renewIt the reference we still have (must not be null). */ public Lease notifyDGC(UnicastRef renewIt) diff --git a/libjava/classpath/gnu/java/rmi/registry/RegistryImpl.java b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl.java index 78c600a..acdd463 100644 --- a/libjava/classpath/gnu/java/rmi/registry/RegistryImpl.java +++ b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl.java @@ -8,7 +8,7 @@ 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 @@ -56,99 +56,99 @@ import java.util.Enumeration; import java.util.Hashtable; public class RegistryImpl - extends UnicastRemoteObject implements Registry { + extends UnicastRemoteObject implements Registry { private Hashtable bindings = new Hashtable(); public RegistryImpl(int port) throws RemoteException { - this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()); + 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); + 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); + 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); + 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); - } + 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); + 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); + 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 2011 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); + System.out.println("rmiregistry (" + + System.getProperty("java.vm.name") + + ") " + + System.getProperty("java.vm.version")); + System.out.println("Copyright 2011 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( + 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); + 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"); - } + 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/classpath/gnu/java/rmi/registry/RegistryImpl_Skel.java b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Skel.java index 8cf14cc..defa3bf 100644 --- a/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Skel.java +++ b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Skel.java @@ -44,7 +44,7 @@ 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("), @@ -52,11 +52,11 @@ public final class RegistryImpl_Skel 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) { @@ -81,7 +81,7 @@ public final class RegistryImpl_Skel 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: @@ -92,7 +92,7 @@ public final class RegistryImpl_Skel 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); @@ -112,12 +112,12 @@ public final class RegistryImpl_Skel } break; } - + case 1: { try { java.io.ObjectInput in = call.getInputStream(); - + } catch (java.io.IOException e) { throw new java.rmi.UnmarshalException("error unmarshalling arguments", e); @@ -135,14 +135,14 @@ public final class RegistryImpl_Skel } 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); @@ -163,7 +163,7 @@ public final class RegistryImpl_Skel } break; } - + case 3: { java.lang.String $param_0; @@ -172,7 +172,7 @@ public final class RegistryImpl_Skel 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); @@ -192,14 +192,14 @@ public final class RegistryImpl_Skel } 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); @@ -219,7 +219,7 @@ public final class RegistryImpl_Skel } break; } - + default: throw new java.rmi.UnmarshalException("invalid method number"); } diff --git a/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Stub.java b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Stub.java index b289426..786a5e1 100644 --- a/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Stub.java +++ b/libjava/classpath/gnu/java/rmi/registry/RegistryImpl_Stub.java @@ -45,11 +45,11 @@ public final class RegistryImpl_Stub 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()"), @@ -57,13 +57,13 @@ public final class RegistryImpl_Stub 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 }); @@ -73,20 +73,20 @@ public final class RegistryImpl_Stub $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) { @@ -127,7 +127,7 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException { try { if (useNewInvoke) { @@ -167,7 +167,7 @@ public final class RegistryImpl_Stub 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) { @@ -211,7 +211,7 @@ public final class RegistryImpl_Stub 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) { @@ -249,7 +249,7 @@ public final class RegistryImpl_Stub 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) { @@ -289,5 +289,5 @@ public final class RegistryImpl_Stub throw new java.rmi.UnexpectedException("undeclared checked exception", e); } } - + } diff --git a/libjava/classpath/gnu/java/rmi/server/ActivatableRef.java b/libjava/classpath/gnu/java/rmi/server/ActivatableRef.java index e7580bc..a6faaca 100644 --- a/libjava/classpath/gnu/java/rmi/server/ActivatableRef.java +++ b/libjava/classpath/gnu/java/rmi/server/ActivatableRef.java @@ -58,7 +58,7 @@ import java.rmi.server.RemoteRef; * appears to be not accessible, it tries to reactivate it before reporting * any errors. Apart the fields of the UnicastRef, the activatable reference * contains the ActivationID that is used for this activation. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class ActivatableRef extends UnicastRef @@ -67,12 +67,12 @@ public class ActivatableRef extends UnicastRef * Use serial version UID for iteroperability */ private static final long serialVersionUID = 1; - + /** * The activation id. */ ActivationID actId; - + /** * Delegate call to the superclass. */ @@ -128,7 +128,7 @@ public class ActivatableRef extends UnicastRef out.writeUTF("UnicastRef2"); super.writeExternal(out); } - + /** * Invoke the remote method on the given object and try to activate the object * if it is not reacheable with the current manager. @@ -153,10 +153,10 @@ public class ActivatableRef extends UnicastRef } else if (Proxy.isProxyClass(reactivated.getClass())) { - RemoteObjectInvocationHandler hander = - (RemoteObjectInvocationHandler) + RemoteObjectInvocationHandler hander = + (RemoteObjectInvocationHandler) Proxy.getInvocationHandler(reactivated); - + RemoteRef ref = hander.getRef(); manager = ((UnicastRef) ref).manager; } diff --git a/libjava/classpath/gnu/java/rmi/server/ActivatableServerRef.java b/libjava/classpath/gnu/java/rmi/server/ActivatableServerRef.java index 5b7dadf..31e825a 100644 --- a/libjava/classpath/gnu/java/rmi/server/ActivatableServerRef.java +++ b/libjava/classpath/gnu/java/rmi/server/ActivatableServerRef.java @@ -54,7 +54,7 @@ import java.rmi.server.Skeleton; * additionally activates the associated object on demand, during the first * incoming call. When UnicastServerReference takes the working reference, * the ActivatableServerRef takes the activation id instead. - * + * * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */ public class ActivatableServerRef extends UnicastServerRef @@ -63,7 +63,7 @@ public class ActivatableServerRef extends UnicastServerRef * Use SVUID for interoperability */ private static final long serialVersionUID = 1; - + /** * The object activation id. */ @@ -76,7 +76,7 @@ public class ActivatableServerRef extends UnicastServerRef { super(); } - + /** * Create the new activatable server reference that will activate object on * the first call using the given activation id. @@ -87,13 +87,13 @@ public class ActivatableServerRef extends UnicastServerRef { super(id, aPort, ssFactory); actId = anId; - + // The object ID will be placed in the object map and should deliver // incoming call to {@link #incommingMessageCall}. The object itself // is currently null. UnicastServer.exportActivatableObject(this); } - + /** * Inactivate the object (stop the server). */ @@ -101,7 +101,7 @@ public class ActivatableServerRef extends UnicastServerRef { manager.stopServer(); } - + /** * Activate the object (normally during the first call). */ @@ -110,7 +110,7 @@ public class ActivatableServerRef extends UnicastServerRef try { Remote self = actId.activate(false); - + // This will call UnicastServer.exportObject, replacing null by // the activated object (self) in the object map. exportObject(self); @@ -139,7 +139,7 @@ public class ActivatableServerRef extends UnicastServerRef } /** - * Export object and ensure it is present in the server activation table + * Export object and ensure it is present in the server activation table * as well. */ public Remote exportObject(Remote obj) throws RemoteException @@ -148,11 +148,11 @@ public class ActivatableServerRef extends UnicastServerRef UnicastServer.registerActivatable(this); return r; } - + /** * Export object and ensure it is present in the server activation table as * well. - * + * * @param aClass the class being exported, must implement Remote. */ public Remote exportClass(Class aClass) throws RemoteException @@ -161,17 +161,17 @@ public class ActivatableServerRef extends UnicastServerRef throw new InternalError(aClass.getName()+" must implement Remote"); String ignoreStubs; - - ClassLoader loader =aClass.getClassLoader(); - + + ClassLoader loader =aClass.getClassLoader(); + // Stubs are always searched for the bootstrap classes that may have // obsolete pattern and may still need also skeletons. if (loader==null) ignoreStubs = "false"; else - ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", + ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", "false"); - + if (! ignoreStubs.equals("true")) { // Find and install the stub @@ -223,5 +223,5 @@ public class ActivatableServerRef extends UnicastServerRef super.writeExternal(out); out.writeObject(actId); } - + } diff --git a/libjava/classpath/gnu/java/rmi/server/CombinedClassLoader.java b/libjava/classpath/gnu/java/rmi/server/CombinedClassLoader.java index 6225fb3..3d01d09 100644 --- a/libjava/classpath/gnu/java/rmi/server/CombinedClassLoader.java +++ b/libjava/classpath/gnu/java/rmi/server/CombinedClassLoader.java @@ -49,8 +49,8 @@ import java.util.ArrayList; * This class supports the multiple class loaders to load the resources. It is * used for constructing proxy classes that implement interfaces, loaded by * the several different class loaders. - * - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ public class CombinedClassLoader extends ClassLoader { @@ -58,20 +58,20 @@ public class CombinedClassLoader extends ClassLoader * The class loader array. */ ClassLoader[] loaders; - + /** * Create a new combined class loader that uses the given collection of * loaders to load the classes and resources. The loader order is equal to * the order, returned by the collection interator. The duplicate loaders * are discarded and the system class loader is added as the last loader. - * + * * @param a_loaders the loadery collection (may contain duplicate instances * that will be discarded. */ public CombinedClassLoader(Collection a_loaders) { ArrayList sLoaders = new ArrayList(a_loaders.size()); - + Iterator iter = a_loaders.iterator(); Object cl; while (iter.hasNext()) @@ -80,7 +80,7 @@ public class CombinedClassLoader extends ClassLoader if (cl!=null && !sLoaders.contains(cl)) sLoaders.add(cl); } - + loaders = new ClassLoader[sLoaders.size()]; for (int i = 0; i < loaders.length; i++) diff --git a/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java b/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java index 9f2b370..86660fe 100644 --- a/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java +++ b/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java @@ -7,7 +7,7 @@ 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 @@ -45,61 +45,61 @@ import java.util.Arrays; class ConnectionRunnerPool { - - public static + + 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(); - } - } + 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){} + 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++){ @@ -109,42 +109,42 @@ class ConnectionRunnerPool } 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, Integer.toString(size)); - a.start(); - freelist.add(a); + ++size; + ConnectionRunner a = new ConnectionRunner(group, Integer.toString(size)); + a.start(); + freelist.add(a); }else - while(freelist.size() == 0) - try{ - ConnectionRunnerPool.class.wait(); - }catch(InterruptedException e){} + 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()]; @@ -152,5 +152,5 @@ class ConnectionRunnerPool for(int i = 0; i < list.length; i++) ((ConnectionRunner)list[i]).exit(); } - + } diff --git a/libjava/classpath/gnu/java/rmi/server/ProtocolConstants.java b/libjava/classpath/gnu/java/rmi/server/ProtocolConstants.java index 30fb5e8..72fbefe 100644 --- a/libjava/classpath/gnu/java/rmi/server/ProtocolConstants.java +++ b/libjava/classpath/gnu/java/rmi/server/ProtocolConstants.java @@ -7,7 +7,7 @@ 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 diff --git a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java index 9c3edef..b090d34 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java @@ -90,21 +90,21 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi private final String annotation; } - /** - * This class is used to identify a cached classloader by its codebase and + /** + * This class is used to identify a cached classloader by its codebase and * the context classloader that is its parent. - */ + */ private static class CacheKey { private String mCodeBase; private ClassLoader mContextClassLoader; - + public CacheKey (String theCodebase, ClassLoader theContextClassLoader) { mCodeBase = theCodebase; mContextClassLoader = theContextClassLoader; } - + /** * @return true if the codebase and the context classloader are equal */ @@ -113,13 +113,13 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi if (theOther instanceof CacheKey) { CacheKey key = (CacheKey) theOther; - + return (equals (this.mCodeBase,key.mCodeBase) && equals (this.mContextClassLoader, key.mContextClassLoader)); } return false; } - + /** * Test if the two objects are equal or both null. * @param theOne @@ -132,17 +132,17 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi } /** - * @return hashCode + * @return hashCode */ public int hashCode() { - return ((mCodeBase != null ? mCodeBase.hashCode() : 0) + return ((mCodeBase != null ? mCodeBase.hashCode() : 0) ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1)); } public String toString() { - return "[" + mCodeBase + "," + mContextClassLoader + "]"; + return "[" + mCodeBase + "," + mContextClassLoader + "]"; } } @@ -214,7 +214,7 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi ClassLoader defaultLoader) throws MalformedURLException, ClassNotFoundException { - try + try { if (defaultLoader != null) return Class.forName(name, false, defaultLoader); @@ -236,7 +236,7 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi { clss[i] = loadClass(codeBase, interfaces[i], defaultLoader); } - + // Chain all class loaders (they may differ). ArrayList loaders = new ArrayList(clss.length); ClassLoader loader = null; @@ -266,11 +266,11 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi /** * Gets a classloader for the given codebase and with the current * context classloader as parent. - * + * * @param codebase - * + * * @return a classloader for the given codebase - * + * * @throws MalformedURLException if the codebase contains a malformed URL */ public ClassLoader getClassLoader(String codebase) @@ -283,23 +283,23 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi CacheKey loaderKey = new CacheKey (codebase, Thread.currentThread().getContextClassLoader()); loader = (ClassLoader) cacheLoaders.get (loaderKey); - + if (loader == null) { //create an entry in cacheLoaders mapping a loader to codebases. // codebases are separated by " " StringTokenizer tok = new StringTokenizer (codebase, " "); ArrayList urls = new ArrayList(); - + while (tok.hasMoreTokens()) urls.add (new URL(tok.nextToken())); - + loader = new MyClassLoader((URL[]) urls.toArray(new URL [urls.size()]), Thread.currentThread().getContextClassLoader(), codebase); cacheLoaders.put (loaderKey, loader); } - + return loader; } @@ -315,38 +315,38 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi public String getClassAnnotation(Class cl) { ClassLoader loader = cl.getClassLoader(); - + if (loader == null || loader == ClassLoader.getSystemClassLoader()) { return System.getProperty ("java.rmi.server.codebase"); } - + if (loader instanceof MyClassLoader) { return ((MyClassLoader) loader).getClassAnnotation(); } - + String s = (String) cacheAnnotations.get (loader); - + if (s != null) return s; - + if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); - + if (urls.length == 0) return null; - + CPStringBuilder annotation = new CPStringBuilder (64 * urls.length); - + for (int i = 0; i < urls.length; i++) { annotation.append (urls [i].toExternalForm()); annotation.append (' '); } - + s = annotation.toString(); cacheAnnotations.put (loader, s); return s; diff --git a/libjava/classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java b/libjava/classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java index 628e1cc..7115ba5 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java @@ -7,7 +7,7 @@ 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 @@ -43,17 +43,17 @@ import java.net.Socket; import java.rmi.server.RMISocketFactory; public class RMIDefaultSocketFactory - extends RMISocketFactory { + extends RMISocketFactory { public RMIDefaultSocketFactory() { } public Socket createSocket(String host, int port) throws IOException { - return (new Socket(host, port)); + return (new Socket(host, port)); } public ServerSocket createServerSocket(int port) throws IOException { - return (new ServerSocket(port)); + return (new ServerSocket(port)); } } diff --git a/libjava/classpath/gnu/java/rmi/server/RMIHashes.java b/libjava/classpath/gnu/java/rmi/server/RMIHashes.java index c3665a4..03eb09f 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIHashes.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIHashes.java @@ -7,7 +7,7 @@ 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 @@ -51,7 +51,7 @@ 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) { @@ -62,7 +62,7 @@ public class RMIHashes //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md); ByteArrayOutputStream digest_out = new ByteArrayOutputStream(); DataOutputStream data_out = new DataOutputStream (digest_out); - + CPStringBuilder sbuf = new CPStringBuilder(); sbuf.append(meth.getName()); sbuf.append('('); @@ -75,7 +75,7 @@ public class RMIHashes sbuf.append(TypeSignature.getEncodingOfClass(rcls)); else sbuf.append('V'); - + data_out.writeUTF (sbuf.toString()); data_out.flush(); data_out.close (); @@ -97,4 +97,3 @@ public class RMIHashes return clazz.hashCode (); } } - diff --git a/libjava/classpath/gnu/java/rmi/server/RMIIncomingThread.java b/libjava/classpath/gnu/java/rmi/server/RMIIncomingThread.java index 990d37b..352b48b 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIIncomingThread.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIIncomingThread.java @@ -7,7 +7,7 @@ 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 @@ -35,24 +35,24 @@ 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; - } - +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/classpath/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java index 65a13f9..4ac7a0a 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java @@ -8,7 +8,7 @@ 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 @@ -48,44 +48,44 @@ import java.net.MalformedURLException; import java.rmi.server.RMIClassLoader; public class RMIObjectInputStream - extends ObjectInputStream { + extends ObjectInputStream { public RMIObjectInputStream(InputStream strm) throws IOException { - super(strm); - enableResolveObject(true); + super(strm); + enableResolveObject(true); } protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { - try { + try { return RMIClassLoader.loadClass( (String)getAnnotation(), desc.getName(), VMStackWalker.firstNonNullClassLoader()); - } - catch (MalformedURLException x) { - throw new ClassNotFoundException(desc.getName(), x); - } + } + catch (MalformedURLException x) { + throw new ClassNotFoundException(desc.getName(), x); + } } //Separate it for override by MarshalledObject protected Object getAnnotation() - throws IOException, ClassNotFoundException + throws IOException, ClassNotFoundException { return readObject(); } - + protected Class resolveProxyClass(String intfs[]) throws IOException, ClassNotFoundException { - try + try { return RMIClassLoader.loadProxyClass( (String)getAnnotation(), intfs, VMStackWalker.firstNonNullClassLoader()); } - catch (MalformedURLException x) + catch (MalformedURLException x) { throw new ClassNotFoundException(null, x); } diff --git a/libjava/classpath/gnu/java/rmi/server/RMIObjectOutputStream.java b/libjava/classpath/gnu/java/rmi/server/RMIObjectOutputStream.java index d42908a..aaf0986 100644 --- a/libjava/classpath/gnu/java/rmi/server/RMIObjectOutputStream.java +++ b/libjava/classpath/gnu/java/rmi/server/RMIObjectOutputStream.java @@ -8,7 +8,7 @@ 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 @@ -47,11 +47,11 @@ import java.rmi.server.RMIClassLoader; import java.rmi.server.RemoteStub; public class RMIObjectOutputStream - extends ObjectOutputStream { + extends ObjectOutputStream { public RMIObjectOutputStream(OutputStream strm) throws IOException { - super(strm); - enableReplaceObject(true); + super(strm); + enableReplaceObject(true); } //Separate it for override by MarshalledObject @@ -60,7 +60,7 @@ protected void setAnnotation(String annotation) throws IOException{ } protected void annotateClass(Class cls) throws IOException { - setAnnotation(RMIClassLoader.getClassAnnotation(cls)); + setAnnotation(RMIClassLoader.getClassAnnotation(cls)); } protected void annotateProxyClass(Class cls) @@ -68,14 +68,14 @@ protected void annotateProxyClass(Class cls) { 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(); + UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj); + if (ref != null) + return ref.getStub(); } return obj; } diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastConnection.java b/libjava/classpath/gnu/java/rmi/server/UnicastConnection.java index 216e453..8245e04 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastConnection.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastConnection.java @@ -8,7 +8,7 @@ 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 @@ -49,8 +49,8 @@ import java.io.ObjectOutputStream; import java.net.Socket; import java.rmi.RemoteException; -public class UnicastConnection - implements Runnable, ProtocolConstants { +public class UnicastConnection + implements Runnable, ProtocolConstants { UnicastConnectionManager manager; Socket sock; @@ -64,78 +64,78 @@ long reviveTime = 0; long expireTime = Long.MAX_VALUE; UnicastConnection(UnicastConnectionManager man, Socket sock) { - this.manager = man; - this.sock = 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 ... + 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())); + din = new DataInputStream(new BufferedInputStream(sock.getInputStream())); - dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); + dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); - // Send header - dout.writeInt(PROTOCOL_HEADER); - dout.writeShort(PROTOCOL_VERSION); - dout.writeByte(protocol); + // 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 ... + + 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); + return (din); } DataOutputStream getDataOutputStream() throws IOException { - return (dout); + return (dout); } /* @@ -144,10 +144,10 @@ DataOutputStream getDataOutputStream() throws IOException { * */ ObjectInputStream getObjectInputStream() throws IOException { - if (oin == null) { - throw new IOException("no ObjectInputtream for reading more objects"); - } - return (oin); + if (oin == null) { + throw new IOException("no ObjectInputtream for reading more objects"); + } + return (oin); } /** @@ -156,7 +156,7 @@ ObjectInputStream getObjectInputStream() throws IOException { * */ ObjectInputStream startObjectInputStream() throws IOException { - return (oin = new RMIObjectInputStream(din)); + return (oin = new RMIObjectInputStream(din)); } /** @@ -165,10 +165,10 @@ ObjectInputStream startObjectInputStream() throws IOException { * */ ObjectOutputStream getObjectOutputStream() throws IOException { - if (oout == null) { - throw new IOException("no ObjectOutputStream for sending more objects"); - } - return (oout); + if (oout == null) { + throw new IOException("no ObjectOutputStream for sending more objects"); + } + return (oout); } /** @@ -177,23 +177,23 @@ ObjectOutputStream getObjectOutputStream() throws IOException { * */ ObjectOutputStream startObjectOutputStream() throws IOException { - return (oout = new RMIObjectOutputStream(dout)); -} + return (oout = new RMIObjectOutputStream(dout)); +} void disconnect() { - try { - if(oout != null) - oout.close(); + try { + if(oout != null) + oout.close(); sock.close(); - } - catch (IOException _) { + } + catch (IOException _) { } - oin = null; + oin = null; oout = null; - din = null; - dout = null; - sock = null; + din = null; + dout = null; + sock = null; } public static final long CONNECTION_TIMEOUT = 10000L; @@ -215,15 +215,15 @@ static void resetTime(UnicastConnection conn){ */ public void run() { do{ - try { - UnicastServer.dispatch(this); + try { + UnicastServer.dispatch(this); //don't discardConnection explicitly, only when - // exception happens or the connection's expireTime + // exception happens or the connection's expireTime // comes } catch (Exception e ){ - manager.discardConnection(this); + manager.discardConnection(this); break; - } + } }while(true); } diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastConnectionManager.java b/libjava/classpath/gnu/java/rmi/server/UnicastConnectionManager.java index a9992af..981d117 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastConnectionManager.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastConnectionManager.java @@ -8,7 +8,7 @@ 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 @@ -56,7 +56,7 @@ import java.util.Hashtable; import java.util.Iterator; public class UnicastConnectionManager - implements Runnable, ProtocolConstants { + implements Runnable, ProtocolConstants { private static String localhost; // use different maps for server/client type UnicastConnectionManager @@ -100,8 +100,8 @@ static { catch (UnknownHostException _) { localhost = "localhost"; } - - + + } //Only one scavenger thread running globally @@ -134,7 +134,7 @@ private static void startScavenger(){ if (UnicastConnection.isExpired(conn, l)){ conns.remove(last); conn.disconnect(); - conn = null; + conn = null; }else liveon = true; //there're still live connections } @@ -159,11 +159,11 @@ private static void startScavenger(){ * Client UnicastConnectionManager constructor */ private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) { - ssock = null; - serverName = host; - serverPort = port; - serverFactory = null; - clientFactory = csf; + ssock = null; + serverName = host; + serverPort = port; + serverFactory = null; + clientFactory = csf; connections = new ArrayList(); } @@ -172,24 +172,24 @@ private UnicastConnectionManager(String host, int port, RMIClientSocketFactory c */ 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); - } - // Note that for compatibility the serverName is "localhost", - // not UnicastConnectionManager.localhost, which is the name - // of the local box. A server listening on localhost:port is - // listening on the loopback interface, 127.0.0.1, but - // UnicastConnectionManager.localhost is an externally - // accessible IP address. - serverName = "localhost"; - serverFactory = ssf; - clientFactory = null; + 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); + } + // Note that for compatibility the serverName is "localhost", + // not UnicastConnectionManager.localhost, which is the name + // of the local box. A server listening on localhost:port is + // listening on the loopback interface, 127.0.0.1, but + // UnicastConnectionManager.localhost is an externally + // accessible IP address. + serverName = "localhost"; + serverFactory = ssf; + clientFactory = null; } /** @@ -198,31 +198,31 @@ private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws Re */ public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) { //System.out.println("getInstance: " + host + "," + port + "," + csf); - if (csf == null) { + if (csf == null) { csf = defaultSocketFactory; - } - // change host name to host address to avoid name resolving issues - try{ - host = InetAddress.getByName(host).getHostAddress(); + } + // 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); + + 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); - + 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 (man); } /** @@ -231,50 +231,50 @@ public static synchronized UnicastConnectionManager getInstance(String host, int */ public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException { //System.out.println("getInstance: " + port + "," + ssf); - if (ssf == null) { + 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); + } + 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); + // 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()); - } + if (ssock == null) { + return (getClientConnection()); + } + else { + return (getServerConnection()); + } } /** * Accept a connection to this server. */ private UnicastConnection getServerConnection() throws IOException { - Socket sock = ssock.accept(); + Socket sock = ssock.accept(); sock.setTcpNoDelay(true); //?? - UnicastConnection conn = new UnicastConnection(this, sock); - conn.acceptConnection(); + 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); + return (conn); } /** @@ -283,37 +283,37 @@ private UnicastConnection getServerConnection() throws IOException { 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; + conn = null; } } } - - Socket sock = clientFactory.createSocket(serverName, serverPort); + + Socket sock = clientFactory.createSocket(serverName, serverPort); conn = new UnicastConnection(this, sock); - conn.makeConnection(DEFAULT_PROTOCOL); - + conn.makeConnection(DEFAULT_PROTOCOL); + if (debug) { ncsock++; System.out.println("\n\n ====== " + ncsock + " client socks.\n\n"); } - return (conn); + return (conn); } /** @@ -332,13 +332,13 @@ public void discardConnection(UnicastConnection conn) { //System.out.println("Discarding connection " + conn); //conn.disconnect(); if (ssock != null) //server connection - conn.disconnect(); + 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 + connections.add(conn); //borrow this lock to garantee thread safety if (scavenger == null) startScavenger(); } @@ -350,15 +350,15 @@ public void discardConnection(UnicastConnection conn) { * already got one running. */ public void startServer() { - synchronized(this) { - if (ssock == null || serverThread != null) { - return; - } - serverThread = new Thread(this); + 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(); + } + serverThread.start(); } /** @@ -366,12 +366,12 @@ public void startServer() { */ public void stopServer() { synchronized(this) { - if(serverThread != null){ - serverThread = null; - try{ - ssock.close(); - }catch(Exception _){} - } + if(serverThread != null){ + serverThread = null; + try{ + ssock.close(); + }catch(Exception _){} + } } } @@ -379,26 +379,26 @@ public void stopServer() { * Server thread for connection manager. */ public void run() { - for (;serverThread != null;) { // if serverThread==null, then exit thread - try { + for (;serverThread != null;) { // if serverThread==null, then exit thread + try { //System.out.println("Waiting for connection on " + serverPort); - UnicastConnection conn = getServerConnection(); + UnicastConnection conn = getServerConnection(); - // get address of remote host for the RMIIncomingThread object - String remoteHost = null; - if (conn.sock != null) { - remoteHost = conn.sock.getInetAddress().getHostAddress(); - } + // 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 + // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new RMIIncomingThread(conn, remoteHost)).start(); -// (new Thread(conn)).start(); - } - catch (Exception e) { +// (new Thread(conn)).start(); + } + catch (Exception e) { e.printStackTrace(); - } - } + } + } } /** @@ -432,9 +432,9 @@ int port; Object other; TripleKey(String host, int port, Object other) { - this.host = host; - this.port = port; - this.other = other; + this.host = host; + this.port = port; + this.other = other; } /** @@ -442,19 +442,19 @@ TripleKey(String host, int port, Object other) { * this has unusual matching behaviour. */ public int hashCode() { - return (host.hashCode() ^ other.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 && + 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); + return (true); + } + } + return (false); } /** diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastRef.java b/libjava/classpath/gnu/java/rmi/server/UnicastRef.java index def1acd..ca2bab5 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastRef.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastRef.java @@ -8,7 +8,7 @@ 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 @@ -461,7 +461,7 @@ public class UnicastRef { return ("UnicastRef"); } - + /** * Return the string representing the remote reference information. */ @@ -497,7 +497,7 @@ public class UnicastRef /** * Check if this UnicastRef points to the object as the passed UnicastRef. * Both the object Id and manager must be the same. - * + * * @return true if the passed reference points to the same remote object as * this reference, false otherwise. */ diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastRemoteCall.java b/libjava/classpath/gnu/java/rmi/server/UnicastRemoteCall.java index c5206e7..d0d7730 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastRemoteCall.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastRemoteCall.java @@ -54,7 +54,7 @@ import java.rmi.server.UID; import java.util.Vector; public class UnicastRemoteCall - implements RemoteCall, ProtocolConstants + implements RemoteCall, ProtocolConstants { private UnicastConnection conn; @@ -89,12 +89,12 @@ public class UnicastRemoteCall this.hash = hash; this.objid = objid; } - + UnicastConnection getConnection() { return conn; } - + public ObjectOutput getOutputStream() throws IOException { if (vec == null) @@ -106,33 +106,33 @@ public class UnicastRemoteCall { 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; + 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(); @@ -142,14 +142,14 @@ public class UnicastRemoteCall * * (re)starts ObjectInputStream * - */ + */ public ObjectInput startInputStream() throws IOException { - if (conn != null) { - return (oin = conn.startObjectInputStream()); - } else { - return getInputStream(); // dummy Input Stream - } + if (conn != null) { + return (oin = conn.startObjectInputStream()); + } else { + return getInputStream(); // dummy Input Stream + } } @@ -157,15 +157,15 @@ public class UnicastRemoteCall { if (conn != null) { - if(oin == null) - return (oin = conn.getObjectInputStream()); - else - return oin; + if(oin == null) + return (oin = conn.getObjectInputStream()); + else + return oin; } else { - ptr = 0; - return (new DummyObjectInputStream()); + ptr = 0; + return (new DummyObjectInputStream()); } } @@ -180,34 +180,34 @@ public class UnicastRemoteCall 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); + 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); + throw new MarshalException("Try to write header but failed.", ex); } try { - releaseOutputStream(); - DataInputStream din = conn.getDataInputStream(); + releaseOutputStream(); + DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) - throw new RemoteException("Call not acked"); + throw new RemoteException("Call not acked"); oin = startInputStream(); returncode = oin.readByte(); @@ -217,31 +217,31 @@ public class UnicastRemoteCall { throw new UnmarshalException("Try to read header but failed:", ex); } - + //check return code switch(returncode) { case RETURN_ACK: //it's ok - return; + 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; - + 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"); + throw new UnmarshalException("Invalid return code"); } } @@ -254,7 +254,7 @@ public class UnicastRemoteCall { return vec.size() > 0; } - + Object returnValue() { // This is not the first one (Boolean) but the second. diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastRemoteStub.java b/libjava/classpath/gnu/java/rmi/server/UnicastRemoteStub.java index 87e932d..179f301 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastRemoteStub.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastRemoteStub.java @@ -7,7 +7,7 @@ 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 @@ -41,10 +41,10 @@ import java.rmi.server.RemoteRef; import java.rmi.server.RemoteStub; public class UnicastRemoteStub - extends RemoteStub { + extends RemoteStub { public static void setStubRef(RemoteStub stub, RemoteRef ref) { - setRef(stub, ref); + setRef(stub, ref); } } diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java index 7fe5395..db2bd2f 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java @@ -8,7 +8,7 @@ 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 @@ -75,21 +75,21 @@ public class UnicastServer * Mapping obj itself to server ref by identity. */ static private Map refcache = Collections.synchronizedMap(new WeakIdentityHashMap()); - + /** * Mapping the registered activatable objects into they server references. */ public static Map actIds = new Hashtable(); - + /** - * The reference to the local distributed garbage collector. + * The reference to the local distributed garbage collector. */ static private DGCImpl dgc; - + /** * Connect this server reference to the server, allowing the local * implementation, associated with this object, to receive remote calls. - * + * * @param obj the server reference, encloses the (usually local) remote * object. */ @@ -100,7 +100,7 @@ public class UnicastServer refcache.put(obj.myself, obj); obj.manager.startServer(); } - + /** * Register the activatable object into the table of the activatable * objects. @@ -109,7 +109,7 @@ public class UnicastServer { actIds.put(ref.actId, ref); } - + /** * Export tha activatable object. The object id is placed into the map, * but the object itself not. This is enough to deliver call to @@ -123,8 +123,8 @@ public class UnicastServer ref.manager.startServer(); actIds.put(ref.actId, ref); } - - + + /** * Get the activatable server reference that is handling activation of the * given activation id. @@ -137,15 +137,15 @@ public class UnicastServer throw new ActivationException(id + " was not registered with this server"); return ref; } - + /** * Unregister the previously registered activatable server reference. */ public static void unregisterActivatable(ActivationID id) { - actIds.remove(id); + actIds.remove(id); } - + // FIX ME: I haven't handle force parameter /** * Remove the given server reference. The remote object, associated with @@ -156,7 +156,7 @@ public class UnicastServer objects.remove(obj.objid); refcache.remove(obj.myself); obj.manager.stopServer(); - + if (obj instanceof ActivatableServerRef) { ActivationID id = ((ActivatableServerRef) obj).actId; @@ -164,15 +164,15 @@ public class UnicastServer } return true; } - + /** * Get the exported reference of the given Remote. The identity map is used, * the non-null value will only be returned if exactly the passed remote - * is part of the registered UnicastServerRef. - * - * @param remote the Remote that is connected to this server via + * is part of the registered UnicastServerRef. + * + * @param remote the Remote that is connected to this server via * {@link UnicastServerRef}. - * + * * @return the UnicastServerRef that is used to connect the passed * remote with this server or null, if this Remote is not connected * to this server. @@ -186,7 +186,7 @@ public class UnicastServer * Get the server references to the object, previously exported via this * server. As the identity map is scanned, more than one reference may match * this Id. - * + * * @param id the id of the exported object * @return the server reference to this object, null if none. */ @@ -244,10 +244,10 @@ public class UnicastServer throw new Exception("bad method type"); } } - + /** * This method is invoked when the remote call is received. The method - * dispatches the call to the responsible object, connected to this + * dispatches the call to the responsible object, connected to this * server via UnicastServerReference. */ private static void incomingMessageCall(UnicastConnection conn) @@ -287,7 +287,7 @@ public class UnicastServer catch (Error e) { returnval = new ServerError( - "Server error, ObjID: " + objid + + "Server error, ObjID: " + objid + ", method: " + method + ", hash: "+ hash, e); returncode = RETURN_NACK; } diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastServerRef.java b/libjava/classpath/gnu/java/rmi/server/UnicastServerRef.java index 2f7cb9a..59a9f08 100644 --- a/libjava/classpath/gnu/java/rmi/server/UnicastServerRef.java +++ b/libjava/classpath/gnu/java/rmi/server/UnicastServerRef.java @@ -8,7 +8,7 @@ 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 @@ -60,39 +60,39 @@ import java.util.Iterator; /** * This class connects the local, remotely available (exported) object to - * the local RMI server that accepts the remote calls. + * the local RMI server that accepts the remote calls. */ public class UnicastServerRef extends UnicastRef -{ +{ /** * Use GNU Classpath v 0.20 SVUID for interoperability */ private static final long serialVersionUID = - 5585608108300801246L; - + /** - * The class array, defining parameters of the jdk 1.2 RMI stub constructor. + * The class array, defining parameters of the jdk 1.2 RMI stub constructor. */ private static final Class[] stubprototype = new Class[] { RemoteRef.class }; - + /** * The exported remote object itself. */ Remote myself; // save the remote object itself - + /** * The skeleton (if any), associated with the exported remote object. */ protected Skeleton skel; - + /** * The stub, associated with the exported remote object (may be proxy class). */ protected Remote stub; - + /** - * The method table (RMI hash code to method) of the methods of the + * The method table (RMI hash code to method) of the methods of the * exported object. */ protected Hashtable methods = new Hashtable(); @@ -110,15 +110,15 @@ public class UnicastServerRef super(id); manager = UnicastConnectionManager.getInstance(port, ssf); } - + /** * Export the object and return its remote stub. The method tries to locate * existing stubs and skeletons. If this fails, the method instantiates the * proxy stub class. - * - * Stubs and skeletons are always ignored (even if present) if the + * + * Stubs and skeletons are always ignored (even if present) if the * java.rmi.server.ignoreStubClasses property is set to true. - * + * * @param obj the object being exported. * @return the stub (existing class or proxy) of the exported object. * @throws RemoteException if the export failed due any reason @@ -133,17 +133,17 @@ public class UnicastServerRef manager.serverobj = obj; String ignoreStubs; - - ClassLoader loader =obj.getClass().getClassLoader(); - + + ClassLoader loader =obj.getClass().getClassLoader(); + // Stubs are always searched for the bootstrap classes that may have // obsolete pattern and may still need also skeletons. if (loader==null) ignoreStubs = "false"; else - ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", + ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses", "false"); - + if (! ignoreStubs.equals("true")) { // Find and install the stub @@ -172,21 +172,21 @@ public class UnicastServerRef return stub; } - + /** * Get the stub (actual class or proxy) of the exported remote object. - * + * * @return the remote stub (null if exportObject has not been called). */ public Remote getStub() { return stub; } - + /** - * Unexport the object (remove methods from the method hashcode table + * Unexport the object (remove methods from the method hashcode table * and call UnicastServer.unexportObject. - * + * * @param obj the object being unexported * @param force passed to the UnicastServer.unexportObject. * @return value, returned by the UnicastServer.unexportObject. @@ -202,7 +202,7 @@ public class UnicastServerRef * Return the class in the hierarchy for that the stub class is defined. * The Subs/Skels might not there for the actual class, but maybe for one of * the superclasses. - * + * * @return the class having stub defined, null if none. */ protected Class findStubSkelClass(Class startCls) @@ -231,17 +231,17 @@ public class UnicastServerRef } } } - + /** - * Get the helper (assisting) class with the given type. - * + * Get the helper (assisting) class with the given type. + * * @param cls the class, for that the helper class is requested. This class * and the requested helper class must share the same class loader. - * + * * @param type the type of the assisting helper. The only currently supported * non deprecated value is "_Stub" (load jdk 1.1 or 1.2 RMI stub). Another * (deprecated) value is "_Skel" (load skeleton). - * + * * @return the instantiated instance of the helper class or null if the * helper class cannot be found or instantiated. */ @@ -303,14 +303,14 @@ public class UnicastServerRef { return RemoteServer.getClientHost(); } - + /** * Build the method has code table and put it into {@link #methods} * (mapping RMI hashcode tos method). The same method is used to remove * the table. - * - * @param cls the class for that the method table is built. - * @param build if true, the class methods are added to the table. If + * + * @param cls the class for that the method table is built. + * @param build if true, the class methods are added to the table. If * false, they are removed from the table. */ protected void buildMethodHash(Class cls, boolean build) @@ -342,7 +342,7 @@ public class UnicastServerRef else return null; } - + /** * This method is called from the {@link UnicastServer#incomingMessageCall} * to deliver the remote call to this object. @@ -422,7 +422,7 @@ public class UnicastServerRef { if (skel == null) throw new NoSuchMethodException("JDK 1.1 call - Skeleton required"); - + UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (! call.isReturnValue()) @@ -431,16 +431,16 @@ public class UnicastServerRef return (call.returnValue()); } } - + /** * Create the 1.2 proxy stub in the case when the pre-generated stub is not * available of the system is explicitly instructed to use proxy stubs. - * + * * @param stubFor the class for that the proxy class must be constructed. * @param reference the remote reference, used to find the given object - * + * * @return the applicable proxy stub. - * + * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ Remote createProxyStub(Class stubFor, RemoteRef reference) @@ -467,17 +467,15 @@ public class UnicastServerRef for (int i = 0; i < intfs.length; i++) intfs[i] = (Class) it.next(); - - RemoteObjectInvocationHandler handler = + + RemoteObjectInvocationHandler handler = new RemoteObjectInvocationHandler(reference); - - Object proxy = + + Object proxy = Proxy.newProxyInstance(stubFor.getClassLoader(), intfs, handler); return (Remote) proxy; } - - -} +} |