private synchronized Session getSession() throws LoginException, GSSException { if ((clientSession == null) || clientSession.needsRefresh()) { clientSession = createSession(); } return clientSession; }
public static ClientSession stripTransactionId(ClientSession session) { return ClientSession.builder(session) .withoutTransactionId() .build(); }
private static RuntimeException getCause(QueryError queryError) { if (queryError.getFailureInfo() != null) { return queryError.getFailureInfo().toException(); } return null; }
public RuntimeException toException() { return toException(this); }
@Override public void close() { // If the query is not done, abort the query. if (state.compareAndSet(State.RUNNING, State.CLIENT_ABORTED)) { URI uri = currentResults.get().getNextUri(); if (uri != null) { httpDelete(uri); } } }
@Override public void close() { client.close(); }
@Override public void cancelLeafStage() { checkState(!isClientAborted(), "client is closed"); URI uri = currentStatusInfo().getPartialCancelUri(); if (uri != null) { httpDelete(uri); } }
@Test public void testFormat() { assertMillis(0, "0 00:00:00.000"); assertMillis(1, "0 00:00:00.001"); assertMillis(-1, "-0 00:00:00.001"); assertMillis(toMillis(12, 13, 45, 56, 789), "12 13:45:56.789"); assertMillis(toMillis(-12, -13, -45, -56, -789), "-12 13:45:56.789"); assertMillis(Long.MAX_VALUE, "106751991167 07:12:55.807"); assertMillis(Long.MIN_VALUE + 1, "-106751991167 07:12:55.807"); assertMillis(Long.MIN_VALUE, "-106751991167 07:12:55.808"); }
public Set<String> getResetSessionProperties() { return client.getResetSessionProperties(); }
public SqlIntervalDayTime(int day, int hour, int minute, int second, int millis) { milliSeconds = toMillis(day, hour, minute, second, millis); }
@Override public String toString() { String message = getMessage(); if (message != null) { return type + ": " + message; } return type; } }
public static Builder builder() { return new Builder(); }
public static Builder builder() { return new Builder(); }
@Override public String getVersion() { return nodeVersion.getVersion(); }
public static StatementClient newStatementClient(OkHttpClient httpClient, ClientSession session, String query) { return new StatementClientV1(httpClient, session, query); } }
public static Builder builder(ClientSession clientSession) { return new Builder(clientSession); }
public Optional<String> getSetCatalog() { return client.getSetCatalog(); }
public Optional<String> getSetSchema() { return client.getSetSchema(); }
public static void setupSocksProxy(OkHttpClient.Builder clientBuilder, Optional<HostAndPort> socksProxy) { setupProxy(clientBuilder, socksProxy, SOCKS); }
public Set<String> getDeallocatedPreparedStatements() { return client.getDeallocatedPreparedStatements(); }