Compartir vía


MethodDispatcherBase Class

  • java.lang.Object
    • MethodDispatcher
      • microsoft.servicefabric.services.remoting.builder.MethodDispatcherBase

public class MethodDispatcherBase implements MethodDispatcher

The base class used by remoting code generator to generate the type that dispatches requests from the client to the right interface and method of the remoted object.

Method Summary

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

Internal - used by Service remoting

<TRetval> CompletableFuture<Object> continueWithResult(int methodId, CompletableFuture<TRetval> future)

Internal - used by Service remoting

abstract Object createResponseBody(int methodId, Object returnValue)

This method is implemented by the generated method dispatcher to create the response from the specified return value as a result of dispatching the method to the remoted object.

abstract Object createResponseMessageBody(Object responseMessageBodyValue)

This method is implemented by the generated method to create the response message.

void dispatch(Object objectImplementation, int methodId, Object requestMsgBody)

This method is used to dispatch one way messages to the specified methodId of the interface implemented by the remoted object.

CompletableFuture<Object> dispatchAsync(Object objectImplementation, int methodId, Object requestMsgBody, CancellationToken cancellationToken)

This method is implemented by the generated method dispatcher to dispatch request to the specified methodId of the interface implemented by the remoted object.

int getInterfaceId()

Interface Id is used to identify remoting Interfaces.

String getMethodName(int methodId)
abstract Object getRequestMessageBodyValue(Object requestMessageBody)

This method is implemented by the generated method dispatcher to get the request message,

void initialize(int interfaceId, Map<Integer, String> methodNameMap)
abstract void onDispatch(int methodId, Object remotedObject, Object requestBody)

This method is implemented by the generated method dispatcher to dispatch one way messages to the specified methodId of the interface implemented by the remoted object.

abstract CompletableFuture<Object> onDispatchAsync(int methodId, Object remotedObject, Object requestBody, CancellationToken cancellationToken)

This method is implemented by the generated method dispatcher to dispatch request to the specified methodId of the interface implemented by the remoted object.

Method Details

continueWith

protected CompletableFuture continueWith(CompletableFuture future)

Internal - used by Service remoting

Parameters:

future - continuation future

Returns:

A java.util.concurrent.CompletableFuture that represents outstanding operation.

continueWithResult

protected CompletableFuture continueWithResult(int methodId, CompletableFuture future)

Internal - used by Service remoting

Parameters:

methodId - method id
future - continuation future

Returns:

A java.util.concurrent.CompletableFuture that represents outstanding operation.

createResponseBody

protected abstract Object createResponseBody(int methodId, Object returnValue)

This method is implemented by the generated method dispatcher to create the response from the specified return value as a result of dispatching the method to the remoted object.

Parameters:

methodId - Id of the method.
returnValue - The returned value from the method.

Returns:

A Object that represents the response body to be sent back to the client.

createResponseMessageBody

protected abstract Object createResponseMessageBody(Object responseMessageBodyValue)

This method is implemented by the generated method to create the response message.

Parameters:

responseMessageBodyValue - response message body

Returns:

Object that represents the respnse messge body.

dispatch

public void dispatch(Object objectImplementation, int methodId, Object requestMsgBody)

This method is used to dispatch one way messages to the specified methodId of the interface implemented by the remoted object.

Overrides:

MethodDispatcherBase.dispatch(Object objectImplementation, int methodId, Object requestMsgBody)

Parameters:

objectImplementation - remoted object Implementation.
methodId - methodId of the interface implemented by the remoted object.
requestMsgBody - message body.

dispatchAsync

public CompletableFuture dispatchAsync(Object objectImplementation, int methodId, Object requestMsgBody, CancellationToken cancellationToken)

This method is implemented by the generated method dispatcher to dispatch request to the specified methodId of the interface implemented by the remoted object.

Overrides:

MethodDispatcherBase.dispatchAsync(Object objectImplementation, int methodId, Object requestMsgBody, CancellationToken cancellationToken)

Parameters:

objectImplementation - The remoted object instance
methodId - id of the method
requestMsgBody - The request body
cancellationToken

Returns:

A java.util.concurrent.CompletableFuture that represents outstanding operation. The result of the task is the return value from the method.

getInterfaceId

public int getInterfaceId()

Interface Id is used to identify remoting Interfaces.

Overrides:

MethodDispatcherBase.getInterfaceId()

Returns:

interface id.

getMethodName

public String getMethodName(int methodId)

Overrides:

MethodDispatcherBase.getMethodName(int methodId)

Parameters:

methodId

getRequestMessageBodyValue

protected abstract Object getRequestMessageBodyValue(Object requestMessageBody)

This method is implemented by the generated method dispatcher to get the request message,

Parameters:

requestMessageBody - request message body.

Returns:

A Object that represents the request body.

initialize

public void initialize(int interfaceId, Map methodNameMap)

Parameters:

interfaceId
methodNameMap

onDispatch

protected abstract void onDispatch(int methodId, Object remotedObject, Object requestBody)

This method is implemented by the generated method dispatcher to dispatch one way messages to the specified methodId of the interface implemented by the remoted object.

Parameters:

methodId - Id of the method.
remotedObject - The remoted object instance.
requestBody - message body

onDispatchAsync

protected abstract CompletableFuture onDispatchAsync(int methodId, Object remotedObject, Object requestBody, CancellationToken cancellationToken)

This method is implemented by the generated method dispatcher to dispatch request to the specified methodId of the interface implemented by the remoted object.

Parameters:

methodId - id of the method
remotedObject - the remoted object instance
requestBody - The request body
cancellationToken - Cancellation token to cancel the async request.

Returns:

A java.util.concurrent.CompletableFuture that represents outstanding operation. The result of the task is the return value from the method.

Applies to