update 电单车协议

This commit is contained in:
Guoqs
2024-08-26 10:13:02 +08:00
parent f0c2869590
commit f27773ba05
12 changed files with 123 additions and 85 deletions

View File

@@ -27,24 +27,7 @@ public class SyncPromise {
this.rpcResult = rpcResult;
}
/**
* 同步等待返回结果
*/
// public RpcResponse get(long timeout, TimeUnit unit) throws InterruptedException {
// // 等待阻塞超时时间内countDownLatch减到0将提前唤醒以此作为是否超时判断
// boolean earlyWakeUp = countDownLatch.await(timeout, unit);
//
// if(earlyWakeUp) {
// // 超时时间内countDownLatch减到0提前唤醒说明已有结果
// return rpcResponse;
// } else {
// // 超时时间内countDownLatch没有减到0自动唤醒说明超时时间内没有等到结果
// isTimeout = true;
// return null;
// }
// }
public byte[] get2(long timeout, TimeUnit unit) throws InterruptedException {
public byte[] get(long timeout, TimeUnit unit) throws InterruptedException {
// 等待阻塞超时时间内countDownLatch减到0将提前唤醒以此作为是否超时判断
boolean earlyWakeUp = countDownLatch.await(timeout, unit);
@@ -61,12 +44,5 @@ public class SyncPromise {
public void wake() {
countDownLatch.countDown();
}
// public RpcResponse getRpcResponse() {
// return rpcResponse;
// }
// public void setRpcResponse(RpcResponse rpcResponse) {
// this.rpcResponse = rpcResponse;
// }
}