Example usage for io.netty.handler.codec.serialization ClassResolvers weakCachingResolver

List of usage examples for io.netty.handler.codec.serialization ClassResolvers weakCachingResolver

Introduction

In this page you can find the example usage for io.netty.handler.codec.serialization ClassResolvers weakCachingResolver.

Prototype

public static ClassResolver weakCachingResolver(ClassLoader classLoader) 

Source Link

Document

non-aggressive non-concurrent cache good for non-shared default cache

Usage

From source file:groovyx.gpars.remote.netty.RemoteObjectDecoder.java

License:Apache License

/**
 * Creates a new encoder.//from   ww w. j a  v  a  2s.co  m
 *
 * @param connection connection handling serialization details
 */
public RemoteObjectDecoder(final RemoteConnection connection) {
    super(ClassResolvers.weakCachingResolver(null));
    this.connection = connection;
}

From source file:org.apache.camel.component.netty4.ChannelHandlerFactories.java

License:Apache License

public static ChannelHandlerFactory newObjectDecoder(String protocol) {
    if ("udp".equalsIgnoreCase(protocol)) {
        return new DefaultChannelHandlerFactory() {
            @Override/*from  w  ww .jav  a  2  s  . co m*/
            public ChannelHandler newChannelHandler() {
                return new DatagramPacketObjectDecoder(ClassResolvers.weakCachingResolver(null));
            }
        };
    } else {
        return new DefaultChannelHandlerFactory() {
            @Override
            public ChannelHandler newChannelHandler() {
                return new ObjectDecoder(ClassResolvers.weakCachingResolver(null));
            }
        };
    }
}

From source file:org.starnub.starnubdata.network.initializer.StarNubDataClientInitializer.java

License:Open Source License

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ch.pipeline().addFirst(/*from www  . j  av a  2 s  .c o  m*/
            new ObjectDecoder(ClassResolvers.weakCachingResolver(MESSAGE_TYPE.getClass().getClassLoader())));
    ch.pipeline().addFirst(new ObjectEncoder());
    ch.pipeline().addLast(new CentralReaderClient());
}

From source file:org.starnub.starnubdata.network.initializer.StarNubDataServerInitializer.java

License:Open Source License

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ch.pipeline().addFirst(/*w w w  .  j av a 2s .  c  o m*/
            new ObjectDecoder(ClassResolvers.weakCachingResolver(MESSAGE_TYPE.getClass().getClassLoader())));
    ch.pipeline().addFirst(new ObjectEncoder());
    ch.pipeline().addLast(new CentralReaderServer());
}