Search in sources :

Example 1 with RpcClientFilter

use of rpc.turbo.filter.RpcClientFilter in project turbo-rpc by hank-whu.

the class ConnectorContext method doResponseFilter.

private void doResponseFilter(Request request, Response response, Method method, String serviceMethodName, Throwable throwable) {
    final int filterLength = filters.size();
    if (filterLength == 0) {
        return;
    }
    RemoteContext.setServerAddress(connector.serverAddress);
    RemoteContext.setClientAddress(connector.clientAddress);
    RemoteContext.setRemoteMethod(method);
    RemoteContext.setServiceMethodName(serviceMethodName);
    if (response.getStatusCode() == ResponseStatus.OK) {
        for (int i = 0; i < filterLength; i++) {
            RpcClientFilter filter = filters.get(i);
            filter.onRecive(request, response);
        }
    } else {
        for (int i = 0; i < filterLength; i++) {
            RpcClientFilter filter = filters.get(i);
            filter.onError(request, response, throwable);
        }
    }
}
Also used : RpcClientFilter(rpc.turbo.filter.RpcClientFilter)

Example 2 with RpcClientFilter

use of rpc.turbo.filter.RpcClientFilter in project turbo-rpc by hank-whu.

the class ConnectorContext method doRequestFilter.

private boolean doRequestFilter(Request request, Method method, String serviceMethodName) {
    final int filterLength = filters.size();
    if (filterLength == 0) {
        return true;
    }
    RemoteContext.setServerAddress(connector.serverAddress);
    RemoteContext.setClientAddress(connector.clientAddress);
    RemoteContext.setRemoteMethod(method);
    RemoteContext.setServiceMethodName(serviceMethodName);
    for (int i = 0; i < filterLength; i++) {
        RpcClientFilter filter = filters.get(i);
        if (!filter.onSend(request)) {
            return false;
        }
    }
    return true;
}
Also used : RpcClientFilter(rpc.turbo.filter.RpcClientFilter)

Example 3 with RpcClientFilter

use of rpc.turbo.filter.RpcClientFilter in project turbo-rpc by hank-whu.

the class ConnectorContext method doRequestFilter.

private boolean doRequestFilter(Request request) {
    final int filterLength = filters.size();
    if (filterLength == 0) {
        return true;
    }
    RemoteContext.setServerAddress(connector.serverAddress);
    RemoteContext.setClientAddress(connector.clientAddress);
    for (int i = 0; i < filterLength; i++) {
        RpcClientFilter filter = filters.get(i);
        if (!filter.onSend(request)) {
            return false;
        }
    }
    return true;
}
Also used : RpcClientFilter(rpc.turbo.filter.RpcClientFilter)

Aggregations

RpcClientFilter (rpc.turbo.filter.RpcClientFilter)3