org.databene.platform.db
Class OfflineSequenceGenerator
java.lang.Object
org.databene.benerator.util.AbstractGenerator<E>
org.databene.benerator.util.ThreadSafeGenerator<java.lang.Long>
org.databene.platform.db.OfflineSequenceGenerator
- All Implemented Interfaces:
- java.io.Closeable, Generator<java.lang.Long>, org.databene.commons.Resettable, org.databene.commons.ThreadAware
public class OfflineSequenceGenerator
- extends ThreadSafeGenerator<java.lang.Long>
Reads the current value of a sequence on first invocation,
increases the value locally on subsequent calls and
finally (on close()) updates the DB sequence with the local value.
This saves database round trips but limits execution to a single
client.
Created: 11.11.2009 18:35:26
- Since:
- 0.6.0
- Author:
- Volker Bergmann
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
OfflineSequenceGenerator
public OfflineSequenceGenerator()
OfflineSequenceGenerator
public OfflineSequenceGenerator(DBSystem target,
java.lang.String sequenceName)
getTarget
public DBSystem getTarget()
setTarget
public void setTarget(DBSystem target)
getSequenceName
public java.lang.String getSequenceName()
setSequenceName
public void setSequenceName(java.lang.String sequenceName)
init
public void init(GeneratorContext context)
- Specified by:
init in interface Generator<java.lang.Long>- Overrides:
init in class AbstractGenerator<java.lang.Long>
getGeneratedType
public java.lang.Class<java.lang.Long> getGeneratedType()
- Description copied from interface:
Generator
- Declares the type of the objects returned by the generate() method.
generate
public java.lang.Long generate()
- Description copied from interface:
Generator
- Returns an instance of the generic type E.
close
public void close()
- Description copied from interface:
Generator
- Closes the generator. After invocation the state is unavailable.
- Specified by:
close in interface java.io.Closeable- Specified by:
close in interface Generator<java.lang.Long>- Overrides:
close in class AbstractGenerator<java.lang.Long>
Copyright © 2011. All Rights Reserved.