增加RpcRemoteException

This commit is contained in:
Redkale
2018-07-11 16:15:24 +08:00
parent 9efc14e627
commit eedb418299
2 changed files with 35 additions and 2 deletions

View File

@@ -332,7 +332,7 @@ public final class SncpClient {
return bsonConvert.convertFrom(action.handlerFuncParamIndex >= 0 ? Object.class : action.resultTypes, reader);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.log(Level.SEVERE, actions[index].method + " sncp (params: " + jsonConvert.convertTo(params) + ") remote error", e);
throw new RuntimeException(actions[index].method + " sncp remote error", e);
throw new RpcRemoteException(actions[index].method + " sncp remote error", e);
} finally {
bsonConvert.offerBsonReader(reader);
}
@@ -403,7 +403,7 @@ public final class SncpClient {
public void completed(Integer count, Void attachment2) {
try {
if (count < 1 && buffer.remaining() == buffer.limit()) { //没有数据可读
future.completeExceptionally(new RuntimeException(action.method + " sncp[" + conn.getRemoteAddress() + "] remote no response data"));
future.completeExceptionally(new RpcRemoteException(action.method + " sncp[" + conn.getRemoteAddress() + "] remote no response data"));
transport.offerBuffer(buffer);
transport.offerConnection(true, conn);
return;

View File

@@ -0,0 +1,33 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.service;
/**
* 供RPC协议使用
*
* <p>
* 详情见: https://redkale.org
*
* @author zhangjx
*/
public class RpcRemoteException extends RuntimeException {
public RpcRemoteException() {
super();
}
public RpcRemoteException(String s) {
super(s);
}
public RpcRemoteException(String message, Throwable cause) {
super(message, cause);
}
public RpcRemoteException(Throwable cause) {
super(cause);
}
}