Fixed RMI so that the impl class does not have to be registered in order to construct a proxy object

This commit is contained in:
nathan 2019-01-09 23:22:54 +01:00
parent 515ee83de4
commit 241b3d4ce2

View File

@ -1144,9 +1144,22 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements CryptoConne
try {
kryo = manager.takeKryo();
// because the INTERFACE is what is registered with kryo (not the impl) we have to temporarily permit unregistered classes (which have an ID of -1)
// so we can cache the instantiator for this class.
boolean registrationRequired = kryo.isRegistrationRequired();
kryo.setRegistrationRequired(false);
// this is what creates a new instance of the impl class, and stores it as an ID.
object = kryo.newInstance(implementationClass);
if (registrationRequired) {
// only if it's different should we call this again.
kryo.setRegistrationRequired(true);
}
rmiId = rmiBridge.register(object);
if (rmiId == RmiBridge.INVALID_RMI) {