@InterfaceAudience.Public @InterfaceStability.Evolving public class KuduSession extends Object implements SessionConfiguration
AsyncKuduSession. Offers the same API but with blocking methods.
A major difference with AsyncKuduSession is that the time spent waiting on operations is
defined by setTimeoutMillis(long) which defaults to getting it from
KuduClient.getDefaultOperationTimeoutMs().SessionConfiguration.FlushMode| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Modifier and Type | Method and Description |
|---|---|
OperationResponse |
apply(Operation operation)
Blocking call with a different behavior based on the flush mode.
|
List<OperationResponse> |
close()
Blocking call that flushes the buffers (see
flush() and closes the sessions. |
List<OperationResponse> |
flush()
Blocking call that force flushes this session's buffers.
|
SessionConfiguration.FlushMode |
getFlushMode()
Get the current flush mode.
|
long |
getTimeoutMillis()
Get the current timeout.
|
boolean |
hasPendingOperations()
Check if there are operations that haven't been completely applied.
|
boolean |
isClosed()
Returns true if this session has already been closed.
|
boolean |
isIgnoreAllDuplicateRows()
Tells if the session is currently ignoring row errors when the whole list returned by a tablet
server is of the AlreadyPresent type.
|
void |
setExternalConsistencyMode(ExternalConsistencyMode consistencyMode)
Set the new external consistency mode for this session.
|
void |
setFlushInterval(int interval)
Set the flush interval, which will be used for the next scheduling decision.
|
void |
setFlushMode(SessionConfiguration.FlushMode flushMode)
Set the new flush mode for this session.
|
void |
setIgnoreAllDuplicateRows(boolean ignoreAllDuplicateRows)
Configures the option to ignore all the row errors if they are all of the AlreadyPresent type.
|
void |
setMutationBufferLowWatermark(float mutationBufferLowWatermarkPercentage)
Set the low watermark for this session.
|
void |
setMutationBufferSpace(int size)
Set the number of operations that can be buffered.
|
void |
setTimeoutMillis(long timeout)
Sets the timeout for the next applied operations.
|
public OperationResponse apply(Operation operation) throws Exception
AsyncKuduSession.apply(org.kududb.client.Operation).
operation - operation to applyException - if anything went wrongpublic List<OperationResponse> flush() throws Exception
Exception - if anything went wrong. If it's an issue with some or all batches,
it will be of type DeferredGroupException.public List<OperationResponse> close() throws Exception
flush() and closes the sessions.Exception - if anything went wrong. If it's an issue with some or all batches,
it will be of type DeferredGroupException.public SessionConfiguration.FlushMode getFlushMode()
SessionConfigurationgetFlushMode in interface SessionConfigurationpublic void setFlushMode(SessionConfiguration.FlushMode flushMode)
SessionConfigurationsetFlushMode in interface SessionConfigurationflushMode - new flush mode, can be the same as the previous one.public void setMutationBufferSpace(int size)
SessionConfigurationsetMutationBufferSpace in interface SessionConfigurationsize - number of ops.public void setMutationBufferLowWatermark(float mutationBufferLowWatermarkPercentage)
SessionConfigurationsetMutationBufferLowWatermark in interface SessionConfigurationmutationBufferLowWatermarkPercentage - a new low watermark as a percentage,
has to be between 0 and 1 (inclusive). A value of 1 disables
the low watermark since it's the same as the high onepublic void setFlushInterval(int interval)
SessionConfigurationsetFlushInterval in interface SessionConfigurationinterval - interval in milliseconds.public long getTimeoutMillis()
SessionConfigurationgetTimeoutMillis in interface SessionConfigurationpublic void setTimeoutMillis(long timeout)
SessionConfigurationsetTimeoutMillis in interface SessionConfigurationtimeout - Timeout in milliseconds.public boolean isClosed()
SessionConfigurationisClosed in interface SessionConfigurationpublic boolean hasPendingOperations()
SessionConfigurationhasPendingOperations in interface SessionConfigurationpublic void setExternalConsistencyMode(ExternalConsistencyMode consistencyMode)
SessionConfigurationsetExternalConsistencyMode in interface SessionConfigurationconsistencyMode - new external consistency mode, can the same as the previous one.public boolean isIgnoreAllDuplicateRows()
SessionConfigurationisIgnoreAllDuplicateRows in interface SessionConfigurationpublic void setIgnoreAllDuplicateRows(boolean ignoreAllDuplicateRows)
SessionConfigurationsetIgnoreAllDuplicateRows in interface SessionConfigurationignoreAllDuplicateRows - true if this session should enforce this, else falseCopyright © 2015. All rights reserved.