|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atomikos.util.UniqueIdMgr
public class UniqueIdMgr
For managing a set of unique IDs on behalf of a given server
| Constructor Summary | |
|---|---|
UniqueIdMgr(String server)
Generate a new instance for a given server. |
|
UniqueIdMgr(String server,
String directorypath)
Preferred constructor: based on file-logged epoch value. |
|
UniqueIdMgr(String server,
String directorypath,
int limit)
Constructor for startup limit. |
|
| Method Summary | |
|---|---|
String |
get()
The main way of obtaining a new UniqueId. |
int |
getMaxIdLengthInBytes()
|
protected long |
readEpoch()
Read the next epoch value from the epoch file. |
void |
setPrefix(String prefix)
Sets the prefix to add to each generated ID. |
void |
setSuffix(String suffix)
Sets the suffix to add to each generated ID. |
protected void |
writeEpoch(long value)
Write the given value into the epoch file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UniqueIdMgr(String server)
public UniqueIdMgr(String server,
String directorypath)
server - The server's unique name.directorypath - The path (with ending slash!) where the epoch
file should be written.
public UniqueIdMgr(String server,
String directorypath,
int limit)
| Method Detail |
|---|
public void setSuffix(String suffix)
suffix - The suffix, defaults to empty string.
This suffix is added directly after the server (base) name
but is not the last part of the ID.public void setPrefix(String prefix)
prefix - The prefix, defaults to empty string.
This value is added at the very beginning of each
generated ID.
protected long readEpoch()
throws IOException
IOException - If reading or writing fails.
protected void writeEpoch(long value)
throws IOException
value - The next epoch value.
IOException - On failure.public String get()
public int getMaxIdLengthInBytes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||