.vscode | ||
src | ||
.gitignore | ||
.gitmodules | ||
assembly.xml | ||
clear_old_data.sh | ||
design_com.puml | ||
design_main_1.puml | ||
design_main.puml | ||
pom.xml | ||
readme.md | ||
restart.sh | ||
start.sh | ||
stop.sh |
使用
状态机的使用
- 实现一个Master循环
@MasterRegister
public class MasterProcessor implements MasterExecute {
/**
* 主循环入口
*/
@Override
public void loop(MasterContext cxt) {
//TODO:
}
}
- 实现多个Worker RPC接口
@WorkerRegister
public class PacketsProcessor implements RpcProcessor<PacketsProcessor.PacketsRequest> {
/**
* 请求参数类
*/
@Setter
@Getter
public static class PacketsRequest implements Serializable {
private ArrayList<Any> packets = new ArrayList<>(); // 传参
private int Code; // 传参
}
@Override
public void handleRequest(RpcContext rpcCtx, PacketsRequest request) {
// TODO: 处理请求
}
/**
* 返回请求的类名
*/
@Override
public String interest() {
return PacketsRequest.class.getName();
}
}