Package net.ontopia.persistence.proxy
Class HighLowKeyGenerator
- java.lang.Object
-
- net.ontopia.persistence.proxy.HighLowKeyGenerator
-
- All Implemented Interfaces:
KeyGeneratorIF
public final class HighLowKeyGenerator extends Object implements KeyGeneratorIF
INTERNAL: A key generator using the HIGH/LOW key generator algorithm. It maintains the current counters in a counter table. The key generator is able to preallocate a number of identities which it hand out without having to go the database for every new identity needed. It is used by the RDBMS proxy implementation.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionFactoryIF
connfactory
protected String
database
protected String
global_entry
protected int
grabsize
protected String
keycol
protected long
max_value
protected Map<String,String>
properties
protected String
table
protected String
valcol
protected long
value
-
Constructor Summary
Constructors Constructor Description HighLowKeyGenerator(ConnectionFactoryIF connfactory, String table, String keycol, String valcol, String global_entry, int grabsize, String database, Map<String,String> properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentityIF
generateKey(Class<?> type)
INTERNAL: Generates a new object identity of the specified object type.protected long
incrementInDatabase(Object type)
INTERNAL: Sends a request to the database to retrieve the current counter value.
-
-
-
Field Detail
-
connfactory
protected ConnectionFactoryIF connfactory
-
table
protected String table
-
keycol
protected String keycol
-
valcol
protected String valcol
-
grabsize
protected int grabsize
-
global_entry
protected String global_entry
-
database
protected String database
-
value
protected long value
-
max_value
protected long max_value
-
-
Method Detail
-
generateKey
public IdentityIF generateKey(Class<?> type)
Description copied from interface:KeyGeneratorIF
INTERNAL: Generates a new object identity of the specified object type.- Specified by:
generateKey
in interfaceKeyGeneratorIF
-
incrementInDatabase
protected long incrementInDatabase(Object type)
INTERNAL: Sends a request to the database to retrieve the current counter value. The counter value row is then locked, the counter incremented and the new value stored.
-
-