RpcEndpoint
RpcEndpoint
is a contract to define an RPC endpoint that can receive messages using callbacks, i.e. functions to execute when a message arrives.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
package org.apache.spark.rpc trait RpcEndpoint { def onConnected(remoteAddress: RpcAddress): Unit def onDisconnected(remoteAddress: RpcAddress): Unit def onError(cause: Throwable): Unit def onNetworkError(cause: Throwable, remoteAddress: RpcAddress): Unit def onStart(): Unit def onStop(): Unit def receive: PartialFunction[Any, Unit] def receiveAndReply(context: RpcCallContext): PartialFunction[Any, Unit] val rpcEnv: RpcEnv } |
RpcEndpoint
lives in RpcEnv after being registered by a name.
A RpcEndpoint can be registered to one and only one RpcEnv.
The lifecycle of a RpcEndpoint is onStart
, receive
and onStop
in sequence.
receive
can be called concurrently.
Tip
|
If you want receive to be thread-safe, use ThreadSafeRpcEndpoint.
|
onError
method is called for any exception thrown.
Method | Description |
---|---|
Receives and processes a message |
Note
|
RpcEndpoint is a private[spark] contract.
|
Activating RPC Endpoint (Just Before Handling Messages) — onStart
Method
Caution
|
FIXME |
stop
Method
Caution
|
FIXME |