Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict exception propagation for loadAll() #137

Open
cruftex opened this issue Dec 14, 2017 · 0 comments
Open

Strict exception propagation for loadAll() #137

cruftex opened this issue Dec 14, 2017 · 0 comments

Comments

@cruftex
Copy link
Member

cruftex commented Dec 14, 2017

The TCK 1.1 corrects the following tests:

  • CacheLoaderTest.shouldPropagateExceptionUsingLoadAll
  • CacheLoaderWithoutReadThroughTest.shouldPropagateExceptionUsingLoadAll

These tests were defunct in the TCK 1.0. The test check that exceptions from the loader are propagated via CompletionListenerFuture.onException.

The JavaDoc of loadAll says:

If a problem is encountered during the retrieving or loading of the objects,
an exception is provided to the {@link CompletionListener}. Once the
operation has completed, the specified CompletionListener is notified.

Implementations may have different concepts of error handling and ideas what "a problem" might be.
One use case of loadAll in a read through configuration is to pre-warm the cache. Maybe the data that caused the exception is never accessed at all.

In cache2k there is support for exceptions and resilience (e.g. a retry to load) per entry. That's why I have chosen to delay exceptions until the data is accessed by the application.

I think there are good arguments for both ways. In case loadAll is used to signal only an intend to read the data, an immediate exception may not be needed.

Maybe the TCK/Spec could be more permissive here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant