All Downloads are FREE. Search and download functionalities are using the official Maven repository.

oracle.nosql.driver.NoSQLHandleFactory Maven / Gradle / Ivy

There is a newer version: 5.4.16
Show newest version
/*-
 * Copyright (c) 2011, 2020 Oracle and/or its affiliates.  All rights reserved.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 *  https://oss.oracle.com/licenses/upl/
 */

package oracle.nosql.driver;

import static oracle.nosql.driver.util.CheckNull.requireNonNull;

import oracle.nosql.driver.http.NoSQLHandleImpl;

/**
 * Factory class used to produce handles to operate on tables.
 */
public class NoSQLHandleFactory {

    /**
     * Creates a handle that can be used to access tables. The application must
     * invoke {@link NoSQLHandle#close}, when it is done accessing the system to
     * free up resources associated with the handle.
     *
     * @param config the NoSQLHandle configuration parameters
     *
     * @return a valid {@link NoSQLHandle} instance, ready for use
     *
     * @throws IllegalArgumentException if an illegal configuration parameter
     * is specified.
     *
     * @see NoSQLHandle#close
     */
    public static NoSQLHandle createNoSQLHandle(NoSQLHandleConfig config) {
        requireNonNull(
            config,
            "NoSQLHandleFactory.createNoSQLHandle: config cannot be null");
        NoSQLHandleConfig configCopy = config.clone();
        if (configCopy.getRetryHandler() == null) {
            /*
             * Default retry handler: 10 retries, default backoff
             */
            configCopy.configureDefaultRetryHandler(10, 0);
        }
        return new NoSQLHandleImpl(configCopy);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy