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:
parent
515ee83de4
commit
241b3d4ce2
|
@ -1144,9 +1144,22 @@ class ConnectionImpl extends ChannelInboundHandlerAdapter implements CryptoConne
|
||||||
|
|
||||||
try {
|
try {
|
||||||
kryo = manager.takeKryo();
|
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.
|
// this is what creates a new instance of the impl class, and stores it as an ID.
|
||||||
object = kryo.newInstance(implementationClass);
|
object = kryo.newInstance(implementationClass);
|
||||||
|
|
||||||
|
if (registrationRequired) {
|
||||||
|
// only if it's different should we call this again.
|
||||||
|
kryo.setRegistrationRequired(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rmiId = rmiBridge.register(object);
|
rmiId = rmiBridge.register(object);
|
||||||
|
|
||||||
if (rmiId == RmiBridge.INVALID_RMI) {
|
if (rmiId == RmiBridge.INVALID_RMI) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user