+1 to that.

bind something that can give you the resource rather than the resource
itself (unless the lifetime is super well defined, like
servletoutputstream).  For example,  guava ByteSource/CharSource would work
great

On Mon, May 2, 2016 at 8:47 AM Tavian Barnes <taviana...@gmail.com> wrote:

> On Friday, 29 April 2016 19:40:44 UTC-4, Andree Surya wrote:
>>
>> Is it a commonplace to inject a resource that should be cleaned-up after 
>> (e.g. Closable)? In general, who has the responsibility for the clean-up?
>>
>>
> If the Reader is unscoped, then everybody who injects it gets a different
> instance, so it's up to the class that injects it to close it.
>
> But in general I'd say binding something like a Reader is questionable.
> I'd rather bind something stateless like a Path, which can be used to open
> a Reader by whoever needs to.
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-guice+unsubscr...@googlegroups.com.
> To post to this group, send email to google-guice@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-guice.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-guice/f293df1e-0653-4bcf-9841-e1c5dc281838%40googlegroups.com
> <https://groups.google.com/d/msgid/google-guice/f293df1e-0653-4bcf-9841-e1c5dc281838%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/CAO9V1MKVE96AxX6vYftRA92o7ObQn-K%2BO1jDbf4%2B-PeStmqu_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to