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

com.clickhouse.client.ClickHouseSocketFactory Maven / Gradle / Ivy

There is a newer version: 0.7.1-patch1
Show newest version
package com.clickhouse.client;

import java.io.IOException;

/**
 * Generic factory interface for creating sockets used by the TCP and Apache
 * Http clients.
 */
public interface ClickHouseSocketFactory {
    /**
     * Creates a new instance of the provided configuration and class type.
     *
     * @param     type of class to create
     * @param config configuration
     * @param clazz  class instance for the type to instantiate
     * @return non-null new instance of the given class
     * @throws IOException                   when failed to create the instance
     * @throws UnsupportedOperationException when the given class is not supported
     */
     T create(ClickHouseConfig config, Class clazz) throws IOException, UnsupportedOperationException;

    /**
     * Tests whether this factory supports creating instances of the given class
     * type. For example, before calling {@link #create(ClickHouseConfig, Class)},
     * you may want to call this method first to verify the factory can produce the
     * desired type.
     *
     * @param clazz non-null class reflecting the type to check support for
     * @return true if the factory supports creating instances of the given type;
     *         false otherwise
     */
    boolean supports(Class clazz);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy