class GrpcResponseFuture<RespT> extends DefaultResponseFuture implements StreamObserver<RespT> {
    private final ClientCall<?, RespT> call;

    public GrpcResponseFuture(Request requestObj, int timeout, URL serverUrl, ClientCall<?, RespT> call) {
        super(requestObj, timeout, serverUrl);
        this.call = call;
    }

    @Override
    public boolean cancel() {
        call.cancel("GrpcResponseFuture was cancelled", null);
        return super.cancel();
    }

    private long calculateProcessTime() {
        return System.currentTimeMillis() - createTime;
    }

    @Override
    public void onNext(Object value) {
        this.result = value;
    }

    @Override
    public void onError(Throwable t) {<FILL_FUNCTION_BODY>}

    @Override
    public void onCompleted() {
        this.processTime = calculateProcessTime();
        done();
    }


}

        if (t instanceof Exception) {
            this.exception = (Exception) t;
        } else {
            this.exception = new MotanServiceException("grpc response future has fatal error.", t);
        }
        done();
    
<methods>public void <init>(com.weibo.api.motan.rpc.Request, int, com.weibo.api.motan.rpc.URL) ,public void <init>(com.weibo.api.motan.rpc.Request, int, java.lang.String) ,public void addFinishCallback(java.lang.Runnable, java.util.concurrent.Executor) ,public void addListener(com.weibo.api.motan.rpc.FutureListener) ,public boolean cancel() ,public Map<java.lang.String,java.lang.String> getAttachments() ,public com.weibo.api.motan.rpc.Callbackable getCallbackHolder() ,public long getCreateTime() ,public java.lang.Exception getException() ,public long getProcessTime() ,public long getRequestId() ,public java.lang.Object getRequestObj() ,public byte getRpcProtocolVersion() ,public int getSerializeNumber() ,public com.weibo.api.motan.common.FutureState getState() ,public int getTimeout() ,public com.weibo.api.motan.rpc.TraceableContext getTraceableContext() ,public java.lang.Object getValue() ,public boolean isCancelled() ,public boolean isDone() ,public boolean isSuccess() ,public void onFailure(com.weibo.api.motan.rpc.Response) ,public void onFailure(java.lang.Exception) ,public void onFinish() ,public void onSuccess(com.weibo.api.motan.rpc.Response) ,public void onSuccess(java.lang.Object) ,public void setAttachment(java.lang.String, java.lang.String) ,public void setProcessTime(long) ,public void setReturnType(Class<?>) ,public void setRpcProtocolVersion(byte) ,public void setSerializeNumber(int) <variables>private Map<java.lang.String,java.lang.String> attachments,private final com.weibo.api.motan.rpc.DefaultCallbackHolder callbackHolder,protected long createTime,protected java.lang.Exception exception,protected List<com.weibo.api.motan.rpc.FutureListener> listeners,protected final java.lang.Object lock,protected long processTime,protected java.lang.String remoteInfo,protected com.weibo.api.motan.rpc.Request request,protected java.lang.Object result,protected Class<?> returnType,protected volatile com.weibo.api.motan.common.FutureState state,protected int timeout,private final com.weibo.api.motan.rpc.TraceableContext traceableContext