Client (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.ipc
Class Client

    java.lang.Object
      org.apache.hadoop.ipc.Client

    public class Client

extends Object

A client for an IPC service. IPC calls take a single `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.

See Also:
  `Server`

Field Summary
`static int` | `IPC_CLIENT_CONNECT_MAX_RETRIES_DEFAULT`
`static String` | `IPC_CLIENT_CONNECT_MAX_RETRIES_KEY`
`static org.apache.commons.logging.Log` | `LOG`

Constructor Summary
`Client(Class<? extends Writable> valueClass, Configuration conf)` Construct an IPC client with the default SocketFactory
`Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory)` Construct an IPC client whose values are of the given `Writable` class.

Method Summary
`Writable[]` | `call(Writable[] params, InetSocketAddress[] addresses)` Deprecated. Use `call(Writable[], InetSocketAddress[], Class, UserGroupInformation, Configuration)` instead
`Writable[]` | `call(Writable[] params, InetSocketAddress[] addresses, Class<?> protocol, UserGroupInformation ticket)` Deprecated. Use `call(Writable[], InetSocketAddress[], Class, UserGroupInformation, Configuration)` instead
`Writable[]` | `call(Writable[] params, InetSocketAddress[] addresses, Class<?> protocol, UserGroupInformation ticket, Configuration conf)` Makes a set of calls in parallel.
`Writable` | `call(Writable param, org.apache.hadoop.ipc.Client.ConnectionId remoteId)` Make a call, passing `param`, to the IPC server defined by `remoteId`, returning the value.
`Writable` | `call(Writable param, InetSocketAddress address)` Deprecated. Use `call(Writable, ConnectionId)` instead
`Writable` | `call(Writable param, InetSocketAddress addr, Class<?> protocol, UserGroupInformation ticket, int rpcTimeout)` Deprecated. Use `call(Writable, ConnectionId)` instead
`Writable` | `call(Writable param, InetSocketAddress addr, Class<?> protocol, UserGroupInformation ticket, int rpcTimeout, Configuration conf)` Make a call, passing `param`, to the IPC server running at `address` which is servicing the `protocol` protocol, with the `ticket` credentials, `rpcTimeout` as timeout and `conf` as configuration for this connection, returning the value.
`Writable` | `call(Writable param, InetSocketAddress addr, UserGroupInformation ticket)` Deprecated. Use `call(Writable, ConnectionId)` instead
`static int` | `getTimeout(Configuration conf)` The time after which a RPC will timeout.
`static void` | `setPingInterval(Configuration conf, int pingInterval)` set the ping interval value in configuration
`void` | `stop()` Stop all threads related to this client.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### IPC_CLIENT_CONNECT_MAX_RETRIES_KEY

    public static final String IPC_CLIENT_CONNECT_MAX_RETRIES_KEY

See Also:
  Constant Field Values

### IPC_CLIENT_CONNECT_MAX_RETRIES_DEFAULT

    public static final int IPC_CLIENT_CONNECT_MAX_RETRIES_DEFAULT

See Also:
  Constant Field Values

### LOG

    public static final org.apache.commons.logging.Log LOG

Constructor Detail

### Client

    public Client(Class<? extends Writable> valueClass,
                  Configuration conf,
                  SocketFactory factory)

  Construct an IPC client whose values are of the given `Writable` class.

### Client

    public Client(Class<? extends Writable> valueClass,
                  Configuration conf)

  Construct an IPC client with the default SocketFactory

  Parameters:
    `valueClass` -
    `conf` -

Method Detail

### setPingInterval

    public static final void setPingInterval(Configuration conf,
                                             int pingInterval)

  set the ping interval value in configuration

  Parameters:
    `conf` - Configuration
    `pingInterval` - the ping interval

### getTimeout

    public static final int getTimeout(Configuration conf)

  The time after which a RPC will timeout. If ping is not enabled (via ipc.client.ping), then the timeout value is the same as the pingInterval. If ping is enabled, then there is no timeout value.

  Parameters:
    `conf` - Configuration
  Returns:
    the timeout period in milliseconds. -1 if no timeout value is set

### stop

    public void stop()

  Stop all threads related to this client. No further calls may be made using this client.

### call

    @Deprecated
    public Writable call(Writable param,
                                    InetSocketAddress address)
                  throws InterruptedException,
                         IOException

  Deprecated. Use `call(Writable, ConnectionId)` instead

  Make a call, passing `param`, to the IPC server running at `address`, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

  Throws:
    `InterruptedException`
    `IOException`

### call

    @Deprecated
    public Writable call(Writable param,
                                    InetSocketAddress addr,
                                    UserGroupInformation ticket)
                  throws InterruptedException,
                         IOException

  Deprecated. Use `call(Writable, ConnectionId)` instead

  Make a call, passing `param`, to the IPC server running at `address` with the `ticket` credentials, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

  Throws:
    `InterruptedException`
    `IOException`

### call

    @Deprecated
    public Writable call(Writable param,
                                    InetSocketAddress addr,
                                    Class<?> protocol,
                                    UserGroupInformation ticket,
                                    int rpcTimeout)
                  throws InterruptedException,
                         IOException

  Deprecated. Use `call(Writable, ConnectionId)` instead

  Make a call, passing `param`, to the IPC server running at `address` which is servicing the `protocol` protocol, with the `ticket` credentials and `rpcTimeout` as timeout, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

  Throws:
    `InterruptedException`
    `IOException`

### call

    public Writable call(Writable param,
                         InetSocketAddress addr,
                         Class<?> protocol,
                         UserGroupInformation ticket,
                         int rpcTimeout,
                         Configuration conf)
                  throws InterruptedException,
                         IOException

  Make a call, passing `param`, to the IPC server running at `address` which is servicing the `protocol` protocol, with the `ticket` credentials, `rpcTimeout` as timeout and `conf` as configuration for this connection, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

  Throws:
    `InterruptedException`
    `IOException`

### call

    public Writable call(Writable param,
                         org.apache.hadoop.ipc.Client.ConnectionId remoteId)
                  throws InterruptedException,
                         IOException

  Make a call, passing `param`, to the IPC server defined by `remoteId`, returning the value. Throws exceptions if there are network problems or if the remote code threw an exception.

  Throws:
    `InterruptedException`
    `IOException`

### call

    @Deprecated
    public Writable[] call(Writable[] params,
                                      InetSocketAddress[] addresses)
                    throws IOException,
                           InterruptedException

  Deprecated. Use `call(Writable[], InetSocketAddress[], Class, UserGroupInformation, Configuration)` instead

  Throws:
    `IOException`
    `InterruptedException`

### call

    @Deprecated
    public Writable[] call(Writable[] params,
                                      InetSocketAddress[] addresses,
                                      Class<?> protocol,
                                      UserGroupInformation ticket)
                    throws IOException,
                           InterruptedException

  Deprecated. Use `call(Writable[], InetSocketAddress[], Class, UserGroupInformation, Configuration)` instead

  Throws:
    `IOException`
    `InterruptedException`

### call

    public Writable[] call(Writable[] params,
                           InetSocketAddress[] addresses,
                           Class<?> protocol,
                           UserGroupInformation ticket,
                           Configuration conf)
                    throws IOException,
                           InterruptedException

  Makes a set of calls in parallel. Each parameter is sent to the corresponding address. When all values are available, or have timed out or errored, the collected results are returned in an array. The array contains nulls for calls that timed out or errored.

  Throws:
    `IOException`
    `InterruptedException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation