Example usage for com.amazonaws ClientConfiguration setClientExecutionTimeout

List of usage examples for com.amazonaws ClientConfiguration setClientExecutionTimeout

Introduction

In this page you can find the example usage for com.amazonaws ClientConfiguration setClientExecutionTimeout.

Prototype

public void setClientExecutionTimeout(int clientExecutionTimeout) 

Source Link

Document

Sets the amount of time (in milliseconds) to allow the client to complete the execution of an API call.

Usage

From source file:com.ibm.stocator.fs.cos.COSAPIClient.java

License:Apache License

/**
 * Initializes connection management/* w  ww  .  j  av  a  2 s . c  om*/
 *
 * @param conf Hadoop configuration
 * @param clientConf client SDK configuration
 */
private void initConnectionSettings(Configuration conf, ClientConfiguration clientConf) throws IOException {
    clientConf.setMaxConnections(
            Utils.getInt(conf, FS_COS, FS_ALT_KEYS, MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS));
    clientConf.setClientExecutionTimeout(
            Utils.getInt(conf, FS_COS, FS_ALT_KEYS, CLIENT_EXEC_TIMEOUT, DEFAULT_CLIENT_EXEC_TIMEOUT));
    clientConf.setMaxErrorRetry(
            Utils.getInt(conf, FS_COS, FS_ALT_KEYS, MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES));
    clientConf.setConnectionTimeout(
            Utils.getInt(conf, FS_COS, FS_ALT_KEYS, ESTABLISH_TIMEOUT, DEFAULT_ESTABLISH_TIMEOUT));
    clientConf
            .setSocketTimeout(Utils.getInt(conf, FS_COS, FS_ALT_KEYS, SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT));
    clientConf.setRequestTimeout(
            Utils.getInt(conf, FS_COS, FS_ALT_KEYS, REQUEST_TIMEOUT, DEFAULT_REQUEST_TIMEOUT));
    int sockSendBuffer = Utils.getInt(conf, FS_COS, FS_ALT_KEYS, SOCKET_SEND_BUFFER,
            DEFAULT_SOCKET_SEND_BUFFER);
    int sockRecvBuffer = Utils.getInt(conf, FS_COS, FS_ALT_KEYS, SOCKET_RECV_BUFFER,
            DEFAULT_SOCKET_RECV_BUFFER);
    clientConf.setSocketBufferSizeHints(sockSendBuffer, sockRecvBuffer);
    String signerOverride = Utils.getTrimmed(conf, FS_COS, FS_ALT_KEYS, SIGNING_ALGORITHM, "");
    if (!signerOverride.isEmpty()) {
        LOG.debug("Signer override = {}", signerOverride);
        clientConf.setSignerOverride(signerOverride);
    }

    String userAgentPrefix = Utils.getTrimmed(conf, FS_COS, FS_ALT_KEYS, USER_AGENT_PREFIX,
            DEFAULT_USER_AGENT_PREFIX);
    String userAgentName = singletoneInitTimeData.getUserAgentName();
    if (!userAgentPrefix.equals(DEFAULT_USER_AGENT_PREFIX)) {
        userAgentName = userAgentPrefix + " " + userAgentName;
    }
    clientConf.setUserAgentPrefix(userAgentName);
}