Repository navigation
Closed
Labels
JNetReflectorJNetReflector related issueJNetReflector related issueenhancementNew feature or requestNew feature or request
Description
The problem is strictly related to listeners and comes from many things:
- considering
Serializer<TJVMT>, it inherits fromMASES.JCOBridge.C2JBridge.JVMBridgeListenerbecause the .NET side shall be informed if JVM requests something- this invocation in https://github.com/masesgroup/KNet/blob/16b0b133224961e348885dd607ed31130fc5fa33/src/net/KNet/Specific/Serialization/SerDes.cs#L131 requests an instance of JVM
Serializerinterface, not the listener JVM class, and cast it to .NETSerializer<TJVMT>- the class
Serializer<TJVMT>, by definition, hasAutoInitflag set to true, so it initialize anMASES.JCOBridge.C2JBridge.JVMBridgeListenerTo avoid the problem the code shall be updated to:
- create a new class named, e.g.
SerializerDirect<TJVMT>which:
- extends
Serializer<TJVMT>- overrides
AutoInitand set it to false- overrides the
BridgeClassNameand set its value to the JVM interface name e.g.org.apache.kafka.common.serialization.Serializer- override https://github.com/masesgroup/KNet/blob/16b0b133224961e348885dd607ed31130fc5fa33/src/net/KNet/Generated/Org/Apache/Kafka/Common/Serialization/Serde.cs#L269 in a new class named
SerDesDirect<TJVMT>and within it allocate theSerializerDirect<TJVMT>class
Originally posted by @masesdevelopers in masesgroup/KNet#448 (comment)
The idea is to update JNetReflector to create a new class, beside each listener, which:
- extends the original
- overrides
AutoInitand set it to false - overrides the
BridgeClassNameand set its value to the JVM interface name - create a new protected flag named
InitHandlersin listener class which enable or disable execution of https://github.com/masesgroup/KNet/blob/16b0b133224961e348885dd607ed31130fc5fa33/src/net/KNet/Generated/Org/Apache/Kafka/Common/Serialization/Serde.cs#L219, default is set to true; in the new class will be set to false
In case the listener interface is returned back from a method, create an extra method. beside the original one, which uses the new generated class to wrap the JVM reference.
Metadata
Metadata
Assignees
Labels
JNetReflectorJNetReflector related issueJNetReflector related issueenhancementNew feature or requestNew feature or request
Activity
masesdevelopers commentedon May 14, 2024
Latest version of JCOBridge introduced a limitation on method CastTo which raises in
JNet/src/net/JNetReflector/InternalExtensions.cs
Line 733 in 4e9f35a
JNet/src/net/JNetReflector/InternalExtensions.cs
Line 731 in 4e9f35a
masesdevelopers commentedon May 14, 2024
The direct class e.g.
JNet/src/net/JNet/Generated/Java/Awt/EventNs/AllPackageClasses.cs
Line 103 in 00831a4
Meanwhile add the missing developed classes (see https://github.com/masesgroup/JNet/actions/runs/9080784354/job/24953109309)
masesdevelopers commentedon May 14, 2024
On
IsBridgeListenercannot be done an override, however the side-by-side Direct class shall be used only as wrapper and never can be instantiated from CLR.masesdevelopers commentedon Jun 2, 2024
All developed classes under
Java.Util.Functionnamespace shall have the Direct counterpart