Package com.clickhouse.client.http
Class HttpUrlConnectionImpl
java.lang.Object
com.clickhouse.client.http.ClickHouseHttpConnection
com.clickhouse.client.http.HttpUrlConnectionImpl
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class com.clickhouse.client.http.ClickHouseHttpConnection
config, defaultHeaders, rm, server, url -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpUrlConnectionImpl(ClickHouseNode server, ClickHouseRequest<?> request, ExecutorService executor, Map<String, Serializable> additionalParams) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected final Stringprotected booleanChecks whether the connection is reusable or not.booleanping(int timeout) Sends a request to<baseUrl>/pingfor liveness detection.protected ClickHouseHttpResponsepost(ClickHouseConfig config, String sql, com.clickhouse.data.ClickHouseInputStream data, List<com.clickhouse.data.ClickHouseExternalTable> tables, com.clickhouse.data.ClickHouseOutputStream output, String url, Map<String, String> headers, Runnable postCloseAction) Posts query and data to server.Methods inherited from class com.clickhouse.client.http.ClickHouseHttpConnection
closeQuietly, createDefaultHeaders, getBaseUrl, getProxy, getUserAgent, mergeHeaders, parseErrorFromException, postData, query, query, query, query, update, update, update, update
-
Constructor Details
-
HttpUrlConnectionImpl
protected HttpUrlConnectionImpl(ClickHouseNode server, ClickHouseRequest<?> request, ExecutorService executor, Map<String, Serializable> additionalParams) throws IOException- Throws:
IOException
-
-
Method Details
-
getDefaultUserAgent
- Overrides:
getDefaultUserAgentin classClickHouseHttpConnection
-
isReusable
protected boolean isReusable()Description copied from class:ClickHouseHttpConnectionChecks whether the connection is reusable or not. This method will be called inClickHouseHttpClient.checkConnection(ClickHouseHttpConnection, ClickHouseNode, ClickHouseNode, ClickHouseRequest)for making a decision of whether to create a new connection. In addition to that, if a connection is NOT reusable, it will be closed right after corresponding ClickHouseResponse is closed.- Overrides:
isReusablein classClickHouseHttpConnection- Returns:
- true if it's reusable; false otherwise
-
post
protected ClickHouseHttpResponse post(ClickHouseConfig config, String sql, com.clickhouse.data.ClickHouseInputStream data, List<com.clickhouse.data.ClickHouseExternalTable> tables, com.clickhouse.data.ClickHouseOutputStream output, String url, Map<String, String> headers, Runnable postCloseAction) throws IOExceptionDescription copied from class:ClickHouseHttpConnectionPosts query and data to server.- Specified by:
postin classClickHouseHttpConnection- Parameters:
config- non-null configurationsql- non-blank querydata- optionally input stream for batch updatingtables- optionally external tables for queryoutput- optionally output streamurl- optionally urlheaders- optionally request headerspostCloseAction- optionally post action- Returns:
- response
- Throws:
IOException- when error occured posting request and/or server failed to respond
-
ping
public boolean ping(int timeout) Description copied from class:ClickHouseHttpConnectionSends a request to<baseUrl>/pingfor liveness detection.- Specified by:
pingin classClickHouseHttpConnection- Parameters:
timeout- timeout in millisecond- Returns:
- true if server responded
Ok.; false otherwise
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classClickHouseHttpConnection
-