com.google.common.util.concurrent.FuturesGetChecked.GetCheckedTypeValidator

Here are the examples of the java api class com.google.common.util.concurrent.FuturesGetChecked.GetCheckedTypeValidator taken from open source projects.

1. FuturesGetCheckedBenchmark#benchmarkGetChecked()

Project: guava
File: FuturesGetCheckedBenchmark.java
@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;
}

2. FuturesGetCheckedBenchmark#addOtherEntries()

Project: guava
File: FuturesGetCheckedBenchmark.java
@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);
    }
}