public class CsnFactory extends Object
Csn.| Modifier and Type | Field and Description |
|---|---|
private int |
changeCount
The integer used to disambiguate CSN generated at the same time
|
private static long |
lastTimestamp
The last timestamp
|
private Object |
lock
A lock used during the instance creation
|
private static int |
PURGE_INSTANCEID
A special instance ID for a purge CSN
|
private int |
replicaId
The replicaId to use for every CSN created by this factory
|
| Constructor and Description |
|---|
CsnFactory(int replicaId)
Creates a new CsnFactory instance
|
| Modifier and Type | Method and Description |
|---|---|
Csn |
newInstance()
Returns a new
Csn. |
Csn |
newInstance(long timestamp,
int changeCount)
Returns a new
Csn created from the given values. |
Csn |
newPurgeCsn(long expirationDate)
Generates a CSN used to purge data.
|
void |
setReplicaId(int replicaId)
Sets the replica ID
|
private static volatile long lastTimestamp
private int changeCount
private int replicaId
private static final int PURGE_INSTANCEID
private Object lock
public CsnFactory(int replicaId)
replicaId - The replica IDpublic Csn newInstance()
Csn.
Generated CSN can be duplicate if user generates CSNs more than 2G
times a milliseconds.public Csn newInstance(long timestamp, int changeCount)
Csn created from the given values.
This method is not to be used except for test purposes.timestamp - The timestamp to usechangeCount - The change count to usepublic Csn newPurgeCsn(long expirationDate)
expirationDate - The time up to the first CSN we want to keeppublic void setReplicaId(int replicaId)
replicaId - The replica IDCopyright © 2003–2019 The Apache Software Foundation. All rights reserved.