This repository has been archived by the owner on Aug 31, 2019. It is now read-only.
forked from google/guice
-
Notifications
You must be signed in to change notification settings - Fork 1
BeCarefulAboutIoInProviders
Sam Berlin edited this page Jul 10, 2014
·
2 revisions
The Provider
interface is convenient for the caller, but it lacks semantics:
-
Provider doesn't declare checked exceptions. If you're writing code that needs to recover from specific types of failures, you can't catch
TransactionRolledbackException
.ProvisionException
allows you to recover from general provision failures, and you can iterate its causes, but you can't specify what those causes may be. - Provider doesn't support a timeout.
-
Provider doesn't define a retry-strategy. When a value is unavailable, calling
get()
multiple times may cause multiple failed provisions.
ThrowingProviders is a Guice extension that implements an exception-throwing provider. It allows failures to be scoped, so a failed lookup only happens once per request or session.
- User's Guide
- Best Practices
- Frequently Asked Questions
- Integration
- Extensions
- Internals
- Releases
- Community