<commit_before>/* This file is part of VoltDB.
 * Copyright (C) 2008-2021 VoltDB Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.voltdb.client;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.voltdb.client.VoltBulkLoader.BulkLoaderFailureCallBack;
import org.voltdb.client.VoltBulkLoader.BulkLoaderSuccessCallback;
import org.voltdb.client.VoltBulkLoader.VoltBulkLoader;

/**
 * A <code>Client</code> that connects to one or more nodes in a VoltDB cluster
 * and provides methods for invoking stored procedures and receiving responses.
 * <p>
 * Each client instance is normally backed by a single thread that is responsible
 * for writing requests to, and reading responses from the network, as well as
 * invoking callbacks for stored procedures that are invoked asynchronously.
 * <p>
 * There is an upper limit on the capacity of a single client instance, and it
 * may be necessary to use a pool of instances to get the best throughput and latency.
 * If a heavyweight client instance is requested it will be backed by  multiple threads,
 * but under the current implementation it is better to use multiple single threaded
 * instances.
 * <p>
 * Because callbacks are invoked directly on the network thread, the performance
 * of the client is sensitive to the amount of work and blocking done in callbacks.
 * If there is any question about whether callbacks will block or take a long time,
 * then an application should have callbacks hand off processing to a thread pool
 * controlled by the application.
 */
public interface Client {

    /**
     * Default non-admin port number for volt cluster instances.
     */
    public static final int VOLTDB_SERVER_PORT = 21212;

    /**
     * Create a connection to a VoltDB node, and add it to the set
     * of connections. This is a synchronous operation.
     *
     * @param host Hostname or IP address of the target host, including
     *             optional port in host:port format.
     * @throws UnknownHostException if the hostname can't be resolved.
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createConnection(String host)
    throws UnknownHostException, IOException;

    /**
     * Create a connection to a VoltDB node, and add it to the set
     * of connections. This is a synchronous operation.
     *
     * @param host Hostname or IP address of the target host.
     * @param port Port number on target host to.
     * @throws UnknownHostException if the hostname can't be resolved.
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createConnection(String host, int port)
    throws UnknownHostException, IOException;

    /**
     * Create a connection to the first available VoltDB node
     * from a specified list. Each entry in the list is
     * an address or hostname, optionally followed by a
     * port number, as for {@link #createConnection(String)}.
     * Entries are separated by commas.
     *
     * @param hostList comma-list of host specifications
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createAnyConnection(String hostList)
    throws IOException;

    /**
     * Create a connection to the first available VoltDB node
     * from a specified list. Each entry in the list is
     * an address or hostname, optionally followed by a
     * port number, as for {@link #createConnection(String)}.
     * Entries are separated by commas.
     * <p>
     * If no connection can be made to any of the specified
     * hosts, then this method can retry connecting
     * after a specified delay and until a timeout has
     * expired. The timeout is only checked at the end
     * of each complete pass through the host list.
     * <p>
     * Not all errors are likely to be recoverable on retry.
     * Therefore, only <code>IOException</code>, not including
     * <code>UnknownHostException</code> will be retried.
     * If a particular host produces such an error, it will be
     * ignored on subsequent retries.
     * <p>
     * Connection progress may be monitored via a {@link ClientStatusListenerEx}.
     * The <code>connectionCreated</code> method will be invoked
     * with a status of either <code>UNABLE_TO_CONNECT</code> or
     * <code>SUCCESS</code>.
     *
     * @param hostList comma-list of host specifications
     * @param timeout approximate limit on retrying (millisecs)
     * @param delay wait time between retries (millisecs)
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createAnyConnection(String hostList, long timeout, long delay)
    throws IOException;<commit_msg>Fix bad link in javadoc (#787)<commit_after>/* This file is part of VoltDB.
 * Copyright (C) 2008-2021 VoltDB Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.voltdb.client;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.voltdb.client.VoltBulkLoader.BulkLoaderFailureCallBack;
import org.voltdb.client.VoltBulkLoader.BulkLoaderSuccessCallback;
import org.voltdb.client.VoltBulkLoader.VoltBulkLoader;

/**
 * A <code>Client</code> that connects to one or more nodes in a VoltDB cluster
 * and provides methods for invoking stored procedures and receiving responses.
 * <p>
 * Each client instance is normally backed by a single thread that is responsible
 * for writing requests to, and reading responses from the network, as well as
 * invoking callbacks for stored procedures that are invoked asynchronously.
 * <p>
 * There is an upper limit on the capacity of a single client instance, and it
 * may be necessary to use a pool of instances to get the best throughput and latency.
 * If a heavyweight client instance is requested it will be backed by  multiple threads,
 * but under the current implementation it is better to use multiple single threaded
 * instances.
 * <p>
 * Because callbacks are invoked directly on the network thread, the performance
 * of the client is sensitive to the amount of work and blocking done in callbacks.
 * If there is any question about whether callbacks will block or take a long time,
 * then an application should have callbacks hand off processing to a thread pool
 * controlled by the application.
 */
public interface Client {

    /**
     * Default non-admin port number for volt cluster instances.
     */
    public static final int VOLTDB_SERVER_PORT = 21212;

    /**
     * Create a connection to a VoltDB node, and add it to the set
     * of connections. This is a synchronous operation.
     *
     * @param host Hostname or IP address of the target host, including
     *             optional port in host:port format.
     * @throws UnknownHostException if the hostname can't be resolved.
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createConnection(String host)
    throws UnknownHostException, IOException;

    /**
     * Create a connection to a VoltDB node, and add it to the set
     * of connections. This is a synchronous operation.
     *
     * @param host Hostname or IP address of the target host.
     * @param port Port number on target host to.
     * @throws UnknownHostException if the hostname can't be resolved.
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createConnection(String host, int port)
    throws UnknownHostException, IOException;

    /**
     * Create a connection to the first available VoltDB node
     * from a specified list. Each entry in the list is
     * an address or hostname, optionally followed by a
     * port number, as for {@link #createConnection(String)}.
     * Entries are separated by commas.
     *
     * @param hostList comma-list of host specifications
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createAnyConnection(String hostList)
    throws IOException;

    /**
     * Create a connection to the first available VoltDB node
     * from a specified list. Each entry in the list is
     * an address or hostname, optionally followed by a
     * port number, as for {@link #createConnection(String)}.
     * Entries are separated by commas.
     * <p>
     * If no connection can be made to any of the specified
     * hosts, then this method can retry connecting
     * after a specified delay and until a timeout has
     * expired. The timeout is only checked at the end
     * of each complete pass through the host list.
     * <p>
     * Not all errors are likely to be recoverable on retry.
     * Therefore, only <code>IOException</code>, not including
     * <code>UnknownHostException</code> will be retried.
     * If a particular host produces such an error, it will be
     * ignored on subsequent retries.
     * <p>
     * Connection progress may be monitored via a {@link ClientStatusListenerExt}.
     * The <code>connectionCreated</code> method will be invoked
     * with a status of either <code>UNABLE_TO_CONNECT</code> or
     * <code>SUCCESS</code>.
     *
     * @param hostList comma-list of host specifications
     * @param timeout approximate limit on retrying (millisecs)
     * @param delay wait time between retries (millisecs)
     * @throws IOException if there is a Java network or connection problem.
     */
    public void createAnyConnection(String hostList, long timeout, long delay)
    throws IOException;
{'fraction_non_alphanumeric': 0.06112314915131817, 'fraction_numerical': 0.0027988443481401226, 'mean_word_length': 3.2934108527131785, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6708612', 'n_tokens_mistral': 2860, 'n_tokens_neox': 2771, 'n_words': 1408}