funky-eyes commented on code in PR #6208:
URL: https://github.com/apache/incubator-seata/pull/6208#discussion_r1451254322
##########
serializer/seata-serializer-seata/src/main/java/io/seata/serializer/seata/SeataSerializer.java:
##########
@@ -16,52 +16,133 @@
*/
package io.seata.serializer.seata;
-import java.nio.ByteBuffer;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.seata.common.loader.LoadLevel;
+import io.seata.common.loader.Scope;
import io.seata.common.util.BufferUtils;
import io.seata.core.protocol.AbstractMessage;
+import io.seata.core.protocol.ProtocolConstants;
import io.seata.core.serializer.Serializer;
+import java.nio.ByteBuffer;
+
/**
* The Seata codec.
- *
*/
-@LoadLevel(name = "SEATA")
+@LoadLevel(name = "SEATA", scope = Scope.PROTOTYPE)
public class SeataSerializer implements Serializer {
+ Serializer versionSeataSerializer;
+
+ Serializer seataSerializerV0 = new SeataSerializerV0();
+ Serializer seataSerializerV1 = new SeataSerializerV1();
Review Comment:
> version取决于客户端,理论上是都有可能用到的(比如突然有个v1的客户端过来连接),当然也可以改成懒加载的
>
> version depends on the client, theoretically it is possible to use (for
example, suddenly there is a v1 client to connect), of course, can also be
changed to lazy loading
You've already cached the corresponding version of the seataserializer on
your use side, and this is also a multiple instance, so why instantiate 2 of
them?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]