public class MultiPrimaryReplicaClient extends MultiPrimaryClient
remark: would have been better using proxy, but for AOT compilation, avoiding to using not supported proxy class.
| Modifier and Type | Field and Description |
|---|---|
protected long |
waitTimeout
timeout before retrying to reconnect failing host
|
closed, conf, currentClient, deniedListTimeout, denyList, lock| Constructor and Description |
|---|
MultiPrimaryReplicaClient(Configuration conf,
ReentrantLock lock)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Executor executor)
Abort current connection
|
void |
close()
Close client
|
void |
closePrepare(Prepare prepare)
Close prepare command
|
List<com.singlestore.jdbc.client.Completion> |
execute(com.singlestore.jdbc.message.ClientMessage message,
Statement stmt,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion,
boolean canRedo)
Send client message and read result
|
List<com.singlestore.jdbc.client.Completion> |
executePipeline(com.singlestore.jdbc.message.ClientMessage[] messages,
Statement stmt,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion,
boolean canRedo)
Send client messages pipelining and read result
|
com.singlestore.jdbc.client.Context |
getContext()
Get connection context
|
ExceptionFactory |
getExceptionFactory()
Get connection exception factory
|
HostAddress |
getHostAddress()
Get connection host
|
int |
getSocketTimeout()
get socket timeout
|
boolean |
isPrimary()
is current client writer or read-only
|
void |
readStreamingResults(List<com.singlestore.jdbc.client.Completion> completions,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion)
Read results
|
protected com.singlestore.jdbc.client.Client |
reConnect()
Reconnect connection, trying to continue transparently if possible.
|
void |
reset()
Reset connection
|
void |
setReadOnly(boolean readOnly)
Switch to a writer/read-only connection, no effet on mono-connection
|
void |
setSocketTimeout(int milliseconds)
Set socket timeout
|
connectHost, execute, execute, executeTransactionReplay, isClosed, replayIfPossible, syncNewStateprotected long waitTimeout
public MultiPrimaryReplicaClient(Configuration conf, ReentrantLock lock) throws SQLException
conf - configurationlock - thread lockerSQLException - if any error occursprotected com.singlestore.jdbc.client.Client reConnect()
throws SQLException
if reconnect succeed on replica / use master, no problem, continuing without interruption // if reconnect primary, then replay transaction / throw exception if was in transaction.
reConnect in class MultiPrimaryClientSQLException - if exceptionpublic List<com.singlestore.jdbc.client.Completion> execute(com.singlestore.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.Clientexecute in interface com.singlestore.jdbc.client.Clientexecute in class MultiPrimaryClientmessage - client messagestmt - statementfetchSize - fetch sizemaxRows - maximum number of rows. 0 = allresultSetConcurrency - concurrencyresultSetType - result-set typecloseOnCompletion - close statement on completioncanRedo - can client message be redone in case of failoverSQLException - if any error occurspublic List<com.singlestore.jdbc.client.Completion> executePipeline(com.singlestore.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.ClientexecutePipeline in interface com.singlestore.jdbc.client.ClientexecutePipeline in class MultiPrimaryClientmessages - client messagestmt - statementfetchSize - fetch sizemaxRows - maximum number of rows. 0 = allresultSetConcurrency - concurrencyresultSetType - result-set typecloseOnCompletion - close statement on completioncanRedo - can client message be redone in case of failoverSQLException - if any error occurspublic void readStreamingResults(List<com.singlestore.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
com.singlestore.jdbc.client.ClientreadStreamingResults in interface com.singlestore.jdbc.client.ClientreadStreamingResults in class MultiPrimaryClientcompletions - List that will have the new resultsfetchSize - fetch sizemaxRows - maximum number of rows. 0 = allresultSetConcurrency - concurrencyresultSetType - result-set typecloseOnCompletion - close statement on completionSQLException - if any error occurspublic void closePrepare(Prepare prepare) throws SQLException
com.singlestore.jdbc.client.ClientclosePrepare in interface com.singlestore.jdbc.client.ClientclosePrepare in class MultiPrimaryClientprepare - prepare commandSQLException - if any error occurspublic void abort(Executor executor) throws SQLException
com.singlestore.jdbc.client.Clientabort in interface com.singlestore.jdbc.client.Clientabort in class MultiPrimaryClientexecutor - executorSQLException - if any error occurspublic void close()
com.singlestore.jdbc.client.Clientclose in interface com.singlestore.jdbc.client.Clientclose in interface AutoCloseableclose in class MultiPrimaryClientpublic void setReadOnly(boolean readOnly)
throws SQLException
com.singlestore.jdbc.client.ClientsetReadOnly in interface com.singlestore.jdbc.client.ClientsetReadOnly in class MultiPrimaryClientreadOnly - must use read-only connectionSQLException - if any error occurspublic int getSocketTimeout()
com.singlestore.jdbc.client.ClientgetSocketTimeout in interface com.singlestore.jdbc.client.ClientgetSocketTimeout in class MultiPrimaryClientpublic void setSocketTimeout(int milliseconds)
throws SQLException
com.singlestore.jdbc.client.ClientsetSocketTimeout in interface com.singlestore.jdbc.client.ClientsetSocketTimeout in class MultiPrimaryClientmilliseconds - timeoutSQLException - if any error occurspublic com.singlestore.jdbc.client.Context getContext()
com.singlestore.jdbc.client.ClientgetContext in interface com.singlestore.jdbc.client.ClientgetContext in class MultiPrimaryClientpublic ExceptionFactory getExceptionFactory()
com.singlestore.jdbc.client.ClientgetExceptionFactory in interface com.singlestore.jdbc.client.ClientgetExceptionFactory in class MultiPrimaryClientpublic HostAddress getHostAddress()
com.singlestore.jdbc.client.ClientgetHostAddress in interface com.singlestore.jdbc.client.ClientgetHostAddress in class MultiPrimaryClientpublic boolean isPrimary()
com.singlestore.jdbc.client.ClientisPrimary in interface com.singlestore.jdbc.client.ClientisPrimary in class MultiPrimaryClientpublic void reset()
com.singlestore.jdbc.client.Clientreset in interface com.singlestore.jdbc.client.Clientreset in class MultiPrimaryClientCopyright © 2023 SingleStore. All rights reserved.