diff --git a/src/dorkbox/network/connection/ConnectionImpl.java b/src/dorkbox/network/connection/ConnectionImpl.java index 26c90a28..29316633 100644 --- a/src/dorkbox/network/connection/ConnectionImpl.java +++ b/src/dorkbox/network/connection/ConnectionImpl.java @@ -1280,12 +1280,12 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements CryptoConne * * @see RemoteObject * - * @param objectID this is the remote object ID (assigned by RMI). This is NOT the kryo registration ID + * @param rmiId this is the remote object ID (assigned by RMI). This is NOT the kryo registration ID * @param iFace this is the RMI interface */ @Override public - RemoteObject getProxyObject(final int objectID, final Class iFace) { + RemoteObject getProxyObject(final int rmiId, final Class iFace) { if (iFace == null) { throw new IllegalArgumentException("iface cannot be null."); } @@ -1296,14 +1296,13 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements CryptoConne // we want to have a connection specific cache of IDs // because this is PER CONNECTION, there is no need for synchronize(), since there will not be any issues with concurrent // access, but there WILL be issues with thread visibility because a different worker thread can be called for different connections - RemoteObject remoteObject = proxyIdCache.get(objectID); + RemoteObject remoteObject = proxyIdCache.get(rmiId); if (remoteObject == null) { // duplicates are fine, as they represent the same object (as specified by the ID) on the remote side. - // remoteObject = rmiBridge.createProxyObject(this, objectID, iFace); // the ACTUAL proxy is created in the connection impl. - RmiProxyHandler proxyObject = new RmiProxyHandler(this, objectID, iFace); + RmiProxyHandler proxyObject = new RmiProxyHandler(this, rmiId, iFace); proxyListeners.add(proxyObject.getListener()); Class[] temp = new Class[2]; @@ -1312,7 +1311,7 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements CryptoConne remoteObject = (RemoteObject) Proxy.newProxyInstance(RmiBridge.class.getClassLoader(), temp, proxyObject); - proxyIdCache.put(objectID, remoteObject); + proxyIdCache.put(rmiId, remoteObject); } return remoteObject; diff --git a/src/dorkbox/network/rmi/InvocationHandlerSerializer.java b/src/dorkbox/network/rmi/InvocationHandlerSerializer.java index 3108381a..66c55ccb 100644 --- a/src/dorkbox/network/rmi/InvocationHandlerSerializer.java +++ b/src/dorkbox/network/rmi/InvocationHandlerSerializer.java @@ -39,7 +39,7 @@ class InvocationHandlerSerializer extends Serializer { public void write(Kryo kryo, Output output, Object object) { RmiProxyHandler handler = (RmiProxyHandler) Proxy.getInvocationHandler(object); - output.writeInt(handler.objectID, true); + output.writeInt(handler.rmiObjectId, true); } @Override diff --git a/src/dorkbox/network/rmi/InvocationResultSerializer.java b/src/dorkbox/network/rmi/InvocationResultSerializer.java index d2198bc1..dc421914 100644 --- a/src/dorkbox/network/rmi/InvocationResultSerializer.java +++ b/src/dorkbox/network/rmi/InvocationResultSerializer.java @@ -32,14 +32,14 @@ class InvocationResultSerializer extends FieldSerializer { public void write(Kryo kryo, Output output, InvokeMethodResult result) { super.write(kryo, output, result); - output.writeInt(result.objectID, true); + output.writeInt(result.rmiObjectId, true); } @Override public InvokeMethodResult read(Kryo kryo, Input input, Class type) { InvokeMethodResult result = super.read(kryo, input, type); - result.objectID = input.readInt(true); + result.rmiObjectId = input.readInt(true); return result; } } diff --git a/src/dorkbox/network/rmi/InvokeMethodResult.java b/src/dorkbox/network/rmi/InvokeMethodResult.java index 24808b5f..93f40e9d 100644 --- a/src/dorkbox/network/rmi/InvokeMethodResult.java +++ b/src/dorkbox/network/rmi/InvokeMethodResult.java @@ -39,8 +39,8 @@ package dorkbox.network.rmi; */ public class InvokeMethodResult implements RmiMessage { - public int objectID; + public int rmiObjectId; - public byte responseID; + public byte responseId; public Object result; } diff --git a/src/dorkbox/network/rmi/RmiObjectLocalHandler.java b/src/dorkbox/network/rmi/RmiObjectLocalHandler.java index 77d8bd98..f00699be 100644 --- a/src/dorkbox/network/rmi/RmiObjectLocalHandler.java +++ b/src/dorkbox/network/rmi/RmiObjectLocalHandler.java @@ -256,7 +256,7 @@ class RmiObjectLocalHandler extends RmiObjectHandler { if (o instanceof RemoteObject) { RmiProxyHandler handler = (RmiProxyHandler) Proxy.getInvocationHandler(o); - int id = handler.objectID; + int id = handler.rmiObjectId; field.set(message, connection.getImplementationObject(id)); fields.add(field); } @@ -309,7 +309,7 @@ class RmiObjectLocalHandler extends RmiObjectHandler { if (o instanceof RemoteObject) { RmiProxyHandler handler = (RmiProxyHandler) Proxy.getInvocationHandler(o); - int id = handler.objectID; + int id = handler.rmiObjectId; field.set(message, connection.getImplementationObject(id)); } else { diff --git a/src/dorkbox/network/rmi/RmiProxyHandler.java b/src/dorkbox/network/rmi/RmiProxyHandler.java index 6a63214e..27cba0e2 100644 --- a/src/dorkbox/network/rmi/RmiProxyHandler.java +++ b/src/dorkbox/network/rmi/RmiProxyHandler.java @@ -71,7 +71,7 @@ class RmiProxyHandler implements InvocationHandler { private final boolean[] pendingResponses = new boolean[64]; private final ConnectionImpl connection; - public final int objectID; // this is the RMI id + public final int rmiObjectId; // this is the RMI id public final int ID; // this is the KRYO id @@ -97,16 +97,16 @@ class RmiProxyHandler implements InvocationHandler { /** * @param connection this is really the network client -- there is ONLY ever 1 connection - * @param objectID this is the remote object ID (assigned by RMI). This is NOT the kryo registration ID + * @param rmiId this is the remote object ID (assigned by RMI). This is NOT the kryo registration ID * @param iFace this is the RMI interface */ public - RmiProxyHandler(final ConnectionImpl connection, final int objectID, final Class iFace) { + RmiProxyHandler(final ConnectionImpl connection, final int rmiId, final Class iFace) { super(); this.connection = connection; - this.objectID = objectID; - this.proxyString = ""; + this.rmiObjectId = rmiId; + this.proxyString = ""; EndPoint endPointConnection = this.connection.getEndPoint(); final RmiSerializationManager serializationManager = endPointConnection.getSerialization(); @@ -114,8 +114,7 @@ class RmiProxyHandler implements InvocationHandler { KryoExtra kryoExtra = null; try { kryoExtra = serializationManager.takeKryo(); - this.ID = kryoExtra.getRegistration(iFace) - .getId(); + this.ID = kryoExtra.getRegistration(iFace).getId(); } finally { if (kryoExtra != null) { serializationManager.returnKryo(kryoExtra); @@ -128,9 +127,9 @@ class RmiProxyHandler implements InvocationHandler { @Override public void received(Connection connection, InvokeMethodResult invokeMethodResult) { - byte responseID = invokeMethodResult.responseID; + byte responseID = invokeMethodResult.responseId; - if (invokeMethodResult.objectID != objectID) { + if (invokeMethodResult.rmiObjectId != rmiId) { return; } @@ -165,7 +164,7 @@ class RmiProxyHandler implements InvocationHandler { String name = method.getName(); if (name.equals("close")) { - connection.removeRmiListeners(objectID, getListener()); + connection.removeRmiListeners(rmiObjectId, getListener()); return null; } else if (name.equals("setResponseTimeout")) { @@ -227,10 +226,10 @@ class RmiProxyHandler implements InvocationHandler { } InvokeMethod invokeMethod = new InvokeMethod(); - invokeMethod.objectID = this.objectID; + invokeMethod.objectID = this.rmiObjectId; invokeMethod.args = args; - // which method do we access? + // which method do we access? We always want to access the IMPLEMENTATION (if available!) CachedMethod[] cachedMethods = connection.getEndPoint() .getSerialization() .getMethods(ID); @@ -419,7 +418,7 @@ class RmiProxyHandler implements InvocationHandler { int hashCode() { final int prime = 31; int result = 1; - result = prime * result + this.objectID; + result = prime * result + this.rmiObjectId; return result; } @@ -436,6 +435,6 @@ class RmiProxyHandler implements InvocationHandler { return false; } RmiProxyHandler other = (RmiProxyHandler) obj; - return this.objectID == other.objectID; + return this.rmiObjectId == other.rmiObjectId; } }