How to implement ObjectDecoder (ClassResolver) in Netty 3.2.7

In netty version 3.2.5 in the method

public ChannelPipeline getPipeline() throws Exception { ... } 

have a decoder defined as follows:

 pipeline.addLast("decoder", new ObjectDecoder()); 

I updated the version of Netty version 3.2.7, which ObjectDecoder() deprecated, and it now requires a ClassResolver . Does anyone have sample code on how to implement new ObjectDecoder(ClassResolver) in the getPipeline() method in version 3.2.7?

+4
source share
1 answer

Here is the Netty ClassResolver documentation.

http://netty.io/docs/stable/api/org/jboss/netty/handler/codec/serialization/ClassResolvers.html

Choose the class recognizer that best suits your needs.

I think you can probably do something like this:

 new ObjectDecoder(ClassResolvers.weakCachingConcurrentResolver(null)) 
+1
source

Source: https://habr.com/ru/post/1388359/


All Articles