Module org.apache.derby.engine
Package org.apache.derby.catalog

# Interface SequencePreallocator

public interface SequencePreallocator

Logic to determine how many values to pre-allocate for a sequence. By default, Derby boosts concurrency by pre-allocating ranges of numbers for sequences. During orderly database shutdown, the unused numbers are reclaimed so that shutdown will not create holes in the sequences. However, holes may appear if the application fails to shut down its databases before the JVM exits.

Logic in this class is called every time Derby needs to pre-allocate a new range of sequence values. Users can override Derby's default behavior by writing their own implementation of this interface and then setting the following Derby property:

      -Dderby.language.sequence.preallocator=com.acme.MySequencePreallocator

Classes which implement this interface must also provide a public 0-arg constructor so that Derby can instantiate them. Derby will instantiate a SequencePreallocator for every sequence.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `nextRangeSize(String schemaName, String sequenceName)`
  This method returns the size of the next pre-allocated range for the specified sequence.

- ## Method Details

  - ### nextRangeSize

    int nextRangeSize(String schemaName, String sequenceName)

    This method returns the size of the next pre-allocated range for the specified sequence. Names are case-sensitive, as specified in CREATE SEQUENCE and CREATE TABLE statements.

    Parameters:
      `schemaName` - Name of schema holding the sequence.
      `sequenceName` - Specific name of the sequence.
    Returns:
      the size of the next pre-allocated range