Package com.clickhouse.client.http
Class HttpUrlConnectionImpl
- java.lang.Object
-
- com.clickhouse.client.http.ClickHouseHttpConnection
-
- com.clickhouse.client.http.HttpUrlConnectionImpl
-
- All Implemented Interfaces:
AutoCloseable
public class HttpUrlConnectionImpl extends ClickHouseHttpConnection
-
-
Field Summary
-
Fields inherited from class com.clickhouse.client.http.ClickHouseHttpConnection
config, defaultHeaders, server, url
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpUrlConnectionImpl(ClickHouseNode server, ClickHouseRequest<?> request, ExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected booleanisReusable()Checks whether the connection is reusable or not.booleanping(int timeout)Sends a request to<baseUrl>/pingfor liveness detection.protected ClickHouseHttpResponsepost(String sql, InputStream data, List<ClickHouseExternalTable> tables, Map<String,String> headers)Posts query and data to server.-
Methods inherited from class com.clickhouse.client.http.ClickHouseHttpConnection
closeQuietly, getBaseUrl, mergeHeaders, query, query, query, query, update, update, update, update
-
-
-
-
Constructor Detail
-
HttpUrlConnectionImpl
protected HttpUrlConnectionImpl(ClickHouseNode server, ClickHouseRequest<?> request, ExecutorService executor) throws IOException
- Throws:
IOException
-
-
Method Detail
-
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(String sql, InputStream data, List<ClickHouseExternalTable> tables, Map<String,String> headers) throws IOException
Description copied from class:ClickHouseHttpConnectionPosts query and data to server.- Specified by:
postin classClickHouseHttpConnection- Parameters:
sql- non-blank querydata- optionally input stream for batch updatingtables- optionally external tables for queryheaders- optionally request headers- 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()
-
-