你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ProxyBase Class

  • java.lang.Object
    • microsoft.servicefabric.services.remoting.builder.ProxyBase

public class ProxyBase

The base class used by remoting code generator to generate the proxy for the remoted interfaces.

Constructor Summary

Constructor Description
ProxyBase()

Initializes a new instance of the ProxyBase class.

Method Summary

Modifier and Type Method and Description
CompletableFuture<?> continueWith(CompletableFuture<Object> future)

Called by the generated proxy class to continue after getting the response body that does not have value.

<T> CompletableFuture<T> continueWithResult(int interfaceId, int methodId, CompletableFuture<Object> future)

Called by the generated proxy class to get the result from the response body.

abstract Object createRequestMessageBody(Object requestMessageBodyValue)

Create the remoting request message body.

abstract Object deserializeMessage(byte[] msgBodyValue)

Deserialize method.

abstract Object getResponseMessageBodyValue(Object responseMessageBody)

Get the response of the request to remote object.

abstract Object getReturnValue(int interfaceId, int methodId, Object responseBody)

Implemented by the derived class to type cast the response body and extract the value from it.

abstract void invoke(int interfaceId, int methodId, byte[] requestMsgBodyBytes)

Called by the generated proxy class to send the message to the remote object.

void invoke(int interfaceId, int methodId, Object requestMsgBodyValue)

Called by the generated proxy class to send the message to the remote object.

abstract CompletableFuture<byte[]> invokeAsync(int interfaceId, int methodId, byte[] requestMsgBodyBytes, CancellationToken cancellationToken)

Called by the generated proxy class to send the request to the remote object and get the response back.

CompletableFuture<Object> invokeAsync(int interfaceId, int methodId, Object requestMsgBodyValue, CancellationToken cancellationToken)

Called by the generated proxy class to send the request to the remote object and get the response back.

abstract byte [] serializeMessage(Object msgBodyValue)

Serializes the given Object

Constructor Details

ProxyBase

protected ProxyBase()

Initializes a new instance of the ProxyBase class.

Method Details

continueWith

protected CompletableFuture continueWith(CompletableFuture future)

Called by the generated proxy class to continue after getting the response body that does not have value.

Parameters:

future - A CompletableFuture that represents the asynchronous operation for remote method call.

Returns:

A CompletableFuture that represents the asynchronous operation for remote method call.

continueWithResult

protected CompletableFuture continueWithResult(int interfaceId, int methodId, CompletableFuture future)

Called by the generated proxy class to get the result from the response body.

Parameters:

interfaceId - Interface Id for the remoted interface.
methodId - Method Id for the remote method.
future - A CompletableFuture that represents the asynchronous operation for remote method call.

Returns:

A CompletableFuture that represents the asynchronous operation for remote method call.

createRequestMessageBody

protected abstract Object createRequestMessageBody(Object requestMessageBodyValue)

Create the remoting request message body.

Parameters:

requestMessageBodyValue - request message body.

Returns:

an Object with request message body.

deserializeMessage

protected abstract Object deserializeMessage(byte[] msgBodyValue)

Deserialize method.

Parameters:

msgBodyValue - byte array having serialized object value.

Returns:

Original object before serialization.

getResponseMessageBodyValue

protected abstract Object getResponseMessageBodyValue(Object responseMessageBody)

Get the response of the request to remote object.

Parameters:

responseMessageBody - Response body.

Returns:

Get the value of the response.

getReturnValue

protected abstract Object getReturnValue(int interfaceId, int methodId, Object responseBody)

Implemented by the derived class to type cast the response body and extract the value from it.

Parameters:

interfaceId - Interface Id for the actor interface.
methodId - Method Id for the actor method.
responseBody - Response body.

Returns:

Return value of method call as Object.

invoke

protected abstract void invoke(int interfaceId, int methodId, byte[] requestMsgBodyBytes)

Called by the generated proxy class to send the message to the remote object.

Parameters:

interfaceId - Id of the remote interface.
methodId - Id of the remote method to be invokved.
requestMsgBodyBytes - Message body to be sent to remote object.

invoke

protected void invoke(int interfaceId, int methodId, Object requestMsgBodyValue)

Called by the generated proxy class to send the message to the remote object.

Parameters:

interfaceId - Id of the remote interface.
methodId - Id of the remote method to be invokved.
requestMsgBodyValue - Message body to be sent to remote object.

invokeAsync

protected abstract CompletableFuture invokeAsync(int interfaceId, int methodId, byte[] requestMsgBodyBytes, CancellationToken cancellationToken)

Called by the generated proxy class to send the request to the remote object and get the response back.

Parameters:

interfaceId - Id of the remote interface.
methodId - Id of the remote method to be invokved.
requestMsgBodyBytes - Request body.
cancellationToken - Cancellation token

Returns:

A task that represents the asynchronous operation async call to remote object.

invokeAsync

protected CompletableFuture invokeAsync(int interfaceId, int methodId, Object requestMsgBodyValue, CancellationToken cancellationToken)

Called by the generated proxy class to send the request to the remote object and get the response back.

Parameters:

interfaceId - Id of the remote interface.
methodId - Id of the remote method to be invoked.
requestMsgBodyValue - Request body.
cancellationToken -

CancellationToken object to indicate the cancellation status of the operation.

Returns:

A CompletableFuture that represents the asynchronous operation async call to remote object.

serializeMessage

protected abstract byte [] serializeMessage(Object msgBodyValue)

Serializes the given Object

Parameters:

msgBodyValue - Any object which needs to be serialized.

Returns:

byte array containing serialized object.

Applies to