code style

xingchun-chen-patch-1
CalvinKirs 2021-02-01 22:46:35 +08:00
parent 4578079368
commit d3a1da47a7
3 changed files with 6 additions and 5 deletions

View File

@ -72,6 +72,7 @@ public class ConsumerInterceptor {
rsp = nettyClient.sendMsg(host, protocol, async);
} catch (InterruptedException e) {
logger.warn("send msg error ", e);
Thread.currentThread().interrupt();
}
//success
if (null != rsp && rsp.getStatus() == 0) {

View File

@ -39,9 +39,9 @@ public class RpcFuture implements Future<Object> {
private long requestId;
public RpcFuture(RpcRequest rpcRequest,long requestId) {
public RpcFuture(RpcRequest rpcRequest, long requestId) {
this.request = rpcRequest;
this.requestId=requestId;
this.requestId = requestId;
}
@Override
@ -71,9 +71,9 @@ public class RpcFuture implements Future<Object> {
}
@Override
public RpcResponse get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
public RpcResponse get(long timeout, TimeUnit unit) throws InterruptedException {
boolean success = latch.await(timeout, unit);
if (!success) {
if (!success) {
throw new RuntimeException("Timeout exception. Request id: " + requestId
+ ". Request class name: " + this.request.getClassName()
+ ". Request method: " + this.request.getMethodName());

View File

@ -21,6 +21,6 @@ import org.apache.dolphinscheduler.rpc.remote.NettyServer;
public class Server {
public static void main(String[] args) {
NettyServer nettyServer=new NettyServer(new NettyServerConfig());
NettyServer nettyServer = new NettyServer(new NettyServerConfig());
}
}