public static class QueryUtility.PagedDataFetchSettings extends Object
QueryUtility.fetchPagedDataAndCount(javax.persistence.Query, javax.persistence.Query,
org.rhq.core.domain.util.PageControl, org.rhq.enterprise.server.util.QueryUtility.PagedDataFetchSettings)
method.
If a no-arg constructor is used, the instance is initialized with the following values:
falseQueryUtility.PHANTOM_READ_MAX_ATTEMPTSQueryUtility.PHANTOM_READ_MIN_WAIT_TIMEQueryUtility.PHANTOM_READ_MAX_WAIT_TIME| Constructor and Description |
|---|
QueryUtility.PagedDataFetchSettings() |
| Modifier and Type | Method and Description |
|---|---|
float |
getLagIncreaseCoefficient()
The coefficient of a geometric progression starting from
getMinWaitTime() and going to
getMaxWaitTime() over getMaxAttempts(). |
int |
getMaxAttempts()
Never negative, but might be zero (which has the same semantics as 1).
|
int |
getMaxWaitTime()
Positive integer, never 0.
|
long |
getMinimumTotalWaitTime() |
int |
getMinWaitTime()
Positive integer, never 0.
|
boolean |
isThrowOnMaxAttempts() |
void |
setMaxAttempts(int maxAttempts) |
void |
setMaxWaitTime(int maxWaitTime) |
void |
setMinWaitTime(int minWaitTime) |
void |
setThrowOnMaxAttempts(boolean throwOnMaxAttempts) |
public float getLagIncreaseCoefficient()
getMinWaitTime() and going to
getMaxWaitTime() over getMaxAttempts().
This is how this coefficient is computed and used in QueryUtility.fetchPagedDataAndCount(
javax.persistence.Query, javax.persistence.Query, org.rhq.core.domain.util.PageControl,
org.rhq.enterprise.server.util.QueryUtility.PagedDataFetchSettings):
fetch(0);
wait(0) = min;
fetch(1);
wait(1) = wait(0) * q;
fetch(2);
wait(2) = wait(1) * q;
...
wait(A-2) = wait(A-3) * q = max;
fetch(A-1);
q = pow(max / min, 1 / (A - 2));
min is the min wait time, max is max wait time, q is the coefficient and
A is the number of attempts.
Computing the pause between the attempts for data fetches this way, we assume that the longer we have
inconsistent results, the longer it is probable to last. I.e. all operations are either relatively fast
and should clean up in a couple of milliseconds or last quite long.public long getMinimumTotalWaitTime()
maximum number of attempts to
prevent a phantom read.public int getMaxAttempts()
public void setMaxAttempts(int maxAttempts)
IllegalArgumentException - when a negative value is passedpublic int getMaxWaitTime()
public void setMaxWaitTime(int maxWaitTime)
IllegalArgumentException - when a negative number or 0 is passedpublic int getMinWaitTime()
public void setMinWaitTime(int minWaitTime)
IllegalArgumentException - when a negative number or 0 is passedpublic boolean isThrowOnMaxAttempts()
public void setThrowOnMaxAttempts(boolean throwOnMaxAttempts)
Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.