Java+Nettty自定义RPC框架
标签:ISE ali print rup utf-8 trace equal conf png
本次利用Java+netty实现自定义rpc框架,共分为三个工程,公共模块+服务提供者+服务消费者:
rpc-common工程
pom.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0com.rpc.common
rpc-common
0.0.1-SNAPSHOTUTF-81.81.8io.netty
netty-all
4.1.16.Finalcom.alibaba
fastjson
1.2.41org.apache.commons
commons-lang3
3.0org.apache.maven.plugins
maven-compiler-plugin
3.11.8utf-8
RpcDecoder.java
package com.rpc.decoder;
import java.util.List;
import com.rpc.util.SerializationUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
/**
*
* @author linxu
*
*/
public class RpcDecoder extends ByteToMessageDecoder {
private Class> genericClass;
public RpcDecoder(Class> genericClass) {
this.genericClass = genericClass;
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List
Java+Nettty自定义RPC框架
标签:ISE ali print rup utf-8 trace equal conf png
原文地址:https://www.cnblogs.com/mature1021/p/13354230.html
评论