com.jivesoftware.base.database.sequence
Class DefaultSequenceProvider
java.lang.Object
com.jivesoftware.base.database.sequence.DefaultSequenceProvider
- All Implemented Interfaces:
- SequenceProvider
public class DefaultSequenceProvider
- extends java.lang.Object
- implements SequenceProvider
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:
- There is no need to go to the database every time we want a new unique id.
- Multiple app servers can interact with the same db without id collision.
- The order of unique id's may not correspond to the creation date of objects.
- There can be gaps in ID's after server restarts since blocks will get "lost" if the block
size is greater than 1.
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultSequenceProvider
public DefaultSequenceProvider()
getNextSequence
public long getNextSequence(int type)
- Specified by:
getNextSequence
in interface SequenceProvider
getNextSequence
public long getNextSequence(java.lang.String name)
- Specified by:
getNextSequence
in interface SequenceProvider
removeNamedSequence
public void removeNamedSequence(java.lang.String name)
- Specified by:
removeNamedSequence
in interface SequenceProvider
isNamedSequencesSupported
public boolean isNamedSequencesSupported()
- Specified by:
isNamedSequencesSupported
in interface SequenceProvider
reset
public void reset()
- Specified by:
reset
in interface SequenceProvider
getCurrentSequence
public long getCurrentSequence(java.lang.String name)
- Specified by:
getCurrentSequence
in interface SequenceProvider
Copyright © 1999-2006 Jive Software.