use of com.google.common.util.concurrent.FuturesGetChecked.GetCheckedTypeValidator in project guava by google.
the class FuturesGetCheckedBenchmark method benchmarkGetChecked.
@Benchmark
int benchmarkGetChecked(int reps) {
int tmp = 0;
GetCheckedTypeValidator validator = this.validator.validator;
Future<Object> future = this.result.future;
Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;
for (int i = 0; i < reps; ++i) {
try {
tmp += getChecked(validator, future, exceptionType).hashCode();
} catch (Exception e) {
tmp += e.hashCode();
}
}
return tmp;
}
use of com.google.common.util.concurrent.FuturesGetChecked.GetCheckedTypeValidator in project guava by google.
the class FuturesGetCheckedBenchmark method addOtherEntries.
@BeforeExperiment
void addOtherEntries() throws Exception {
GetCheckedTypeValidator validator = this.validator.validator;
Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;
for (Class<? extends Exception> exceptionClass : OTHER_EXCEPTION_TYPES.asList().subList(0, otherEntriesInDataStructure)) {
getChecked(validator, immediateFuture(""), exceptionClass);
}
for (int i = 0; i < otherEntriesInDataStructure; i++) {
ClassValue<Boolean> classValue = new ClassValue<Boolean>() {
@Override
protected Boolean computeValue(Class<?> type) {
return true;
}
};
classValue.get(exceptionType);
retainedReferencesToOtherClassValues.add(classValue);
}
}
Aggregations