public class JdbcKeyRetriever extends java.lang.Object implements KeyRetriever
Modifier and Type | Field and Description |
---|---|
private int |
bucketSize
The number of tables queried at once (in a single SQL statement).
|
private java.lang.String[] |
predictionQueries
Query which returns the number of busy keys in the given range.
|
private java.lang.String[] |
retrievalQueries
Query which retrieves all busy keys in the given range.
|
Constructor and Description |
---|
JdbcKeyRetriever() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Database database)
Initialize key retriever for the given database.
|
private boolean |
isLastInBucket(int i,
int size)
Checks if
i is the last item in the bucket. |
java.util.List<Range> |
retrieveFreeKeys(java.lang.Long minKey,
java.lang.Long maxKey,
org.hibernate.Session session)
Get available keys.
|
private java.lang.String[] predictionQueries
private java.lang.String[] retrievalQueries
private int bucketSize
public void initialize(Database database)
initialize
in interface KeyRetriever
database
- Database for which will be scanned for available keys.public java.util.List<Range> retrieveFreeKeys(java.lang.Long minKey, java.lang.Long maxKey, org.hibernate.Session session)
retrieveFreeKeys
in interface KeyRetriever
minKey
- Lower bound of a range of identifiers on which search will be made.maxKey
- Upper bound of a range of identifiers on which search will be made.session
- Hibernate session which will be used to perform queries.private boolean isLastInBucket(int i, int size)
i
is the last item in the bucket. Useful for combining items in a
bucket; the last item is usually handled differently.i
- The current item, related to global item array.size
- The global item array size.true
if i is the last item in his bucket