|
20 | 20 | import java.util.concurrent.locks.ReentrantLock; |
21 | 21 |
|
22 | 22 | /** |
23 | | - * Optimizer which uses a pool of values, storing the next low value of the range |
24 | | - * in the database. |
| 23 | + * Optimizer which uses a pool of values, backed by a <em>logical sequence</em>. |
| 24 | + * A logical sequence is usually just an unpooled sequence or table generator. |
25 | 25 | * <p> |
26 | | - * This optimizer works essentially the same as the {@link HiLoOptimizer}, except |
27 | | - * that here the bucket ranges are actually encoded into the database structures. |
| 26 | + * The pool size is controlled by the {@code allocationSize} of a |
| 27 | + * {@linkplain jakarta.persistence.SequenceGenerator sequence generator} or |
| 28 | + * {@linkplain jakarta.persistence.TableGenerator sequence generator}. |
28 | 29 | * <p> |
29 | | - * If you prefer that the database value be interpreted as the bottom end of our |
30 | | - * current range, then use the {@link PooledLoOptimizer} strategy. |
| 30 | + * This optimizer interprets the current value held by its underlying logical |
| 31 | + * sequence (that is, the last value generated by a database sequence, or the |
| 32 | + * current value of a table row emulating a sequence) as an upper bound on the |
| 33 | + * range of already-allocated ids. From time to time, the optimizer allocates |
| 34 | + * a range of values to itself, interpreting the next value retrieved from the |
| 35 | + * logical sequence as an upper bound on the range of newly allocated ids. |
| 36 | + * <p> |
| 37 | + * The {@link PooledLoOptimizer} is similar, but interprets the current value |
| 38 | + * of the logical sequence as a lower bound on the range of already-allocated |
| 39 | + * ids. |
| 40 | + * <p> |
| 41 | + * This optimizer has similar performance characteristics to the |
| 42 | + * {@link HiLoOptimizer}, but here the range bounds are stored directly by the |
| 43 | + * underlying database structures. |
31 | 44 | * |
32 | 45 | * @author Steve Ebersole |
33 | 46 | * |
34 | 47 | * @see PooledLoOptimizer |
| 48 | + * @see jakarta.persistence.SequenceGenerator#allocationSize |
| 49 | + * @see jakarta.persistence.TableGenerator#allocationSize |
35 | 50 | */ |
36 | 51 | public class PooledOptimizer extends AbstractOptimizer implements InitialValueAwareOptimizer { |
37 | 52 |
|
|
0 commit comments