Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.lutris.appserver.server.sql.standard
Class StandardObjectIdAllocator  view StandardObjectIdAllocator download StandardObjectIdAllocator.java

java.lang.Object
  extended bycom.lutris.appserver.server.sql.standard.StandardObjectIdAllocator
All Implemented Interfaces:
com.lutris.appserver.server.sql.ObjectIdAllocator

public class StandardObjectIdAllocator
extends java.lang.Object
implements com.lutris.appserver.server.sql.ObjectIdAllocator

Object ids can only be created via this manager. Ensures that all object ids are unique across all objects in this logical database. Also ensures good performance for allocating object ids.

The configuration data is specified in the section: DatabaseManager.DB.dbName.ObjectId

Configuration fields are:

Since:
LBS1.8
Version:
$Revision: 1.7.12.1 $

Field Summary
private  long cacheSize
          Default cache size if 1K.
private  com.lutris.appserver.server.sql.ObjectId current
          The object id mos recently allocated.
private  com.lutris.logging.LogChannel log
          The log channel.
private static int LOG_THRESHOLD
          If allocation of object id's fails (because the contents of the table are modified by another process) this object id manager will keep trying to allocate object ids until it succeeds.
private  com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase
          Reference to the logical database for easy access to the connection pool.
private  com.lutris.appserver.server.sql.ObjectId max
          The maximum object id in the cache.
private  com.lutris.appserver.server.sql.ObjectId next
          The next object id that will be allocated.
private  java.lang.String oidMinValue
          Starting value for object id creation, if table is empty.
 
Constructor Summary
protected StandardObjectIdAllocator(com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase, com.lutris.util.Config objIdConfig)
          Initialize the object id manager.
 
Method Summary
 com.lutris.appserver.server.sql.ObjectId allocate()
          Allocates a new object id.
private  void updateCache()
          Updates the cache of object id's.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

max

private com.lutris.appserver.server.sql.ObjectId max
The maximum object id in the cache.


current

private com.lutris.appserver.server.sql.ObjectId current
The object id mos recently allocated.


next

private com.lutris.appserver.server.sql.ObjectId next
The next object id that will be allocated.


cacheSize

private long cacheSize
Default cache size if 1K. Note that if the application is started and stopped frequently you should drop this value in order not to waste object ids.


oidMinValue

private java.lang.String oidMinValue
Starting value for object id creation, if table is empty. This is a string because very large numbers are possible.


logicalDatabase

private com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase
Reference to the logical database for easy access to the connection pool.


LOG_THRESHOLD

private static final int LOG_THRESHOLD
If allocation of object id's fails (because the contents of the table are modified by another process) this object id manager will keep trying to allocate object ids until it succeeds. If it fails more than LOG_THRESHOLD times, then it will log a message to the system.

See Also:
Constant Field Values

log

private com.lutris.logging.LogChannel log
The log channel.

Constructor Detail

StandardObjectIdAllocator

protected StandardObjectIdAllocator(com.lutris.appserver.server.sql.LogicalDatabase logicalDatabase,
                                    com.lutris.util.Config objIdConfig)
                             throws com.lutris.util.ConfigException
Initialize the object id manager.

Method Detail

allocate

public com.lutris.appserver.server.sql.ObjectId allocate()
Allocates a new object id.

Specified by:
allocate in interface com.lutris.appserver.server.sql.ObjectIdAllocator

updateCache

private void updateCache()
Updates the cache of object id's.