java.lang.AutoCloseable@Public
@Evolving
public class Client
extends java.lang.Object
implements java.lang.AutoCloseable
Writable as a
parameter, and return a Writable as their value. A service runs on
a port and is defined by a parameter class and a value class.Server| Modifier and Type | Class | Description |
|---|---|---|
static class |
Client.ConnectionId |
This class holds the address and the user ticket.
|
static class |
Client.IpcStreams |
Manages the input and output streams for an IPC connection.
|
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
Client(java.lang.Class<? extends Writable> valueClass,
Configuration conf) |
Construct an IPC client with the default SocketFactory.
|
Client(java.lang.Class<? extends Writable> valueClass,
Configuration conf,
javax.net.SocketFactory factory) |
Construct an IPC client whose values are of the given
Writable
class. |
| Modifier and Type | Method | Description |
|---|---|---|
Writable |
call(RPC.RpcKind rpcKind,
Writable rpcRequest,
Client.ConnectionId remoteId,
java.util.concurrent.atomic.AtomicBoolean fallbackToSimpleAuth) |
Make a call, passing
rpcRequest, to the IPC server defined by
remoteId, returning the rpc respond. |
Writable |
call(RPC.RpcKind rpcKind,
Writable rpcRequest,
Client.ConnectionId remoteId,
java.util.concurrent.atomic.AtomicBoolean fallbackToSimpleAuth,
AlignmentContext alignmentContext) |
|
void |
close() |
|
static <T extends Writable> |
getAsyncRpcResponse() |
|
static int |
getCallId() |
|
static java.lang.Object |
getExternalHandler() |
|
static int |
getPingInterval(Configuration conf) |
Get the ping interval from configuration;
If not set in the configuration, return the default value.
|
static int |
getRetryCount() |
|
static int |
getRpcTimeout(Configuration conf) |
The time after which a RPC will timeout.
|
static int |
getTimeout(Configuration conf) |
Deprecated.
use
getRpcTimeout(Configuration) instead |
static boolean |
isAsynchronousMode() |
Check if RPC is in asynchronous mode or not.
|
static int |
nextCallId() |
Returns the next valid sequential call ID by incrementing an atomic counter
and masking off the sign bit.
|
static void |
setAsynchronousMode(boolean async) |
Set RPC to asynchronous or synchronous mode.
|
static void |
setCallIdAndRetryCount(int cid,
int rc,
java.lang.Object externalHandler) |
Set call id and retry count for the next call.
|
static void |
setCallIdAndRetryCountUnprotected(java.lang.Integer cid,
int rc,
java.lang.Object externalHandler) |
|
static void |
setConnectTimeout(Configuration conf,
int timeout) |
set the connection timeout value in configuration
|
static void |
setPingInterval(Configuration conf,
int pingInterval) |
set the ping interval value in configuration
|
void |
stop() |
Stop all threads related to this client.
|
java.lang.String |
toString() |
public Client(java.lang.Class<? extends Writable> valueClass, Configuration conf, javax.net.SocketFactory factory)
Writable
class.valueClass - input valueClass.conf - input configuration.factory - input factory.public Client(java.lang.Class<? extends Writable> valueClass, Configuration conf)
valueClass - input valueClass.conf - input Configuration.@Unstable public static <T extends Writable> AsyncGet<T,java.io.IOException> getAsyncRpcResponse()
public static void setCallIdAndRetryCount(int cid,
int rc,
java.lang.Object externalHandler)
cid - input cid.rc - input rc.externalHandler - input externalHandler.public static void setCallIdAndRetryCountUnprotected(java.lang.Integer cid,
int rc,
java.lang.Object externalHandler)
public static int getCallId()
public static int getRetryCount()
public static java.lang.Object getExternalHandler()
public static final void setPingInterval(Configuration conf, int pingInterval)
conf - ConfigurationpingInterval - the ping intervalpublic static final int getPingInterval(Configuration conf)
conf - Configuration@Deprecated public static final int getTimeout(Configuration conf)
getRpcTimeout(Configuration) insteadconf - Configurationpublic static final int getRpcTimeout(Configuration conf)
conf - Configurationpublic static final void setConnectTimeout(Configuration conf, int timeout)
conf - Configurationtimeout - the socket connect timeout valuepublic java.lang.String toString()
toString in class java.lang.Objectpublic void stop()
public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest, Client.ConnectionId remoteId, java.util.concurrent.atomic.AtomicBoolean fallbackToSimpleAuth) throws java.io.IOException
rpcRequest, to the IPC server defined by
remoteId, returning the rpc respond.rpcKind - - input rpcKind.rpcRequest - - contains serialized method and method parametersremoteId - - the target rpc serverfallbackToSimpleAuth - - set to true or false during this method to
indicate if a secure client falls back to simple authjava.io.IOException - raised on errors performing I/O.public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest, Client.ConnectionId remoteId, java.util.concurrent.atomic.AtomicBoolean fallbackToSimpleAuth, AlignmentContext alignmentContext) throws java.io.IOException
java.io.IOException@Unstable public static boolean isAsynchronousMode()
@Unstable public static void setAsynchronousMode(boolean async)
async - true, RPC will be in asynchronous mode, otherwise false for
synchronous modepublic static int nextCallId()
@Unstable
public void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.ExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.