Netty Rpc - java.lang.ClassNotFoundException
RPC 的声明如下:
...
@Route(defaultThreadId = ThreadId.ACTOR, nodeType = NodeType.GAME_SERVER)
public interface ActorRpc {
@Rpc
void addReward(List<Long> uidList, List<Reward> rewards);
@Rpc
void resetResource(List<Long> uidList, int resourceId, long value);
}
调用的时候:
ActorRpc proxyRandom = litchi.rpc().getProxyRandom(ActorRpc.class);
proxyRandom.addReward(uidList, new ArrayList<Reward>(){{
add(reward);
}});
参数的类型和声明有差异了,导致找不到方法,修改为:
List<Reward> list = new ArrayList<>();
list.add(reward);
ActorRpc proxyRandom = litchi.rpc().getProxyRandom(ActorRpc.class);
proxyRandom.addReward(uidList, list);
学习记录,方便复习