public class SequenceNumber extends Object
java seqnum.SequenceNumber -store <instance name> \ -host <host name> \ -port <port number>For all examples the default instance name is kvstore, the default host name is localhost and the default port number is 5000. These defaults match the defaults for running kvlite, so the simplest way to run the examples along with kvlite is to omit all parameters.
Constructor and Description |
---|
SequenceNumber(KVStore store,
Key key,
int noOfRetries,
long initialValue)
Creates an instance of the sequence number generator.
|
Modifier and Type | Method and Description |
---|---|
long |
incrementAndGet()
Returns the next number in the sequence after it synchronizes with the
store, making a maximum of noOfRetries atempts.
There are three possible outcomes when calling this method: - the next number in the sequence is returned. - the maximum number of retries is reached for trying to synchronize with the store and a RuntimeException is thrown - other exception if thrown by the store |
static void |
main(String[] args) |
public SequenceNumber(KVStore store, Key key, int noOfRetries, long initialValue)
store
- The store name.key
- The key determining the domain of the sequencenoOfRetries
- The number of attempts to synchronize with the storeinitialValue
- The starting value of the sequence (the first
value returned will be an increment of this one.public long incrementAndGet()
java.lang.RuntimeException,
- oracle.kv.DurabilityException
oracle.kv.RequestTimeoutException oracle.kv.FaultException
oracle.kv.ConsistencyExceptionpublic static void main(String[] args)
Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.