|
Jive Messenger 2.2.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.database.SequenceManager
public class SequenceManager
Manages sequences of unique ID's that get stored in the database. Database support for sequences varies widely; some don't use them at all. Instead, we handle unique ID generation with a combination VM/database solution.
A special table in the database doles out blocks of unique ID's to each virtual machine that interacts with Jive. This has the following consequences:
Each sequence type that this class manages has a different block size value. Objects that aren't created often have a block size of 1, while frequently created objects such as entries and comments have larger block sizes.
Constructor Summary | |
---|---|
SequenceManager(int seqType,
int size)
Creates a new DbSequenceManager. |
Method Summary | |
---|---|
static long |
nextID(int type)
Returns the next ID of the specified type. |
static long |
nextID(Object o)
Method for objects that have defined the annotation JiveID in their class. |
long |
nextUniqueID()
Returns the next available unique ID. |
static void |
setBlockSize(int type,
int blockSize)
Used to set the blocksize of a given SequenceManager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SequenceManager(int seqType, int size)
seqType
- the type of sequence.size
- the number of id's to "checkout" at a time.Method Detail |
---|
public static long nextID(int type)
type
- the type of unique ID.
public static long nextID(Object o)
JiveID
in their class.
The annotation JiveID should contain the id type for the object (the same number you would
use to call nextID(int type))
Example class definition:
\@JiveID(10)
public class MyClass {
}
o
- object that has annotation JiveID
public static void setBlockSize(int type, int blockSize)
type
- the type of unique idblockSize
- how many blocks of ids we shouldpublic long nextUniqueID()
|
Jive Messenger 2.2.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |