Closed cruftex closed 8 years ago
Regarding the loadAll()
the remarks from @christian-esken:
org.jsr107.tck.integration.CacheLoaderTest
// Observation: shouldPropagateExceptionUsingLoadAll() requires a CacheLoaderException
// Issue: Javadocs do not mandate this for Cache.loadAll().
// a) Javadoc states: "If a problem is
// encountered during the retrieving or loading of the objects,
// an exception is provided to the {@link CompletionListener}."
// b) The @throws declaration is "@throws CacheException thrown if there is a problem performing the load."
// Proposed change: Change CacheLoaderTest to check for CacheException
The relevant code is
CompletionListenerFuture future = new CompletionListenerFuture();
cache.loadAll(keys, false, future);
//wait for the load to complete
try{
future.get();
} catch (ExecutionException e) {
assertThat(e.getCause(), instanceOf(CacheLoaderException.class));
}
OTOH CompletionListenerFuture
does correctly document that it wraps with ExecutionException
on the method get()
, opposing my initial statement.
Re-evaluating everything I think the current checks and Spec is consistent and useful as well.
ExceutionException
as documentedCacheLoaderException
which is correct, too, since an exception originated from the loaderEffectively in this case the original cause is double wrapped. Once by the CacheLoaderException
, and again by the ExecutionException
. That's suprising, but the only way to fulfill the future interface contract.
BTW: There is a mistake in the test not including a fail()
. Opening a TCK issue for that.
The Spec says:
But the code, does not wrap:
ExecutionException
means probably java.util.concurrent.ExecutionException. Should be linked or fully qualified if exceptions are mentioned not in the scope ofjavax.cache
. Shouldn't it be aCacheLoaderException
?!TODO:
Releated: https://github.com/jsr107/jsr107tck/issues/99 https://github.com/jsr107/jsr107tck/issues/85
We need probably more specific issues on what actually needs change. Any more findings and suggestions are appreciated.
Relevant tests:
org.jsr107.tck.integration.CacheLoaderTest
org.jsr107.tck.integration.CacheWriterTest