nlight-jdev / jcouchdb

Automatically exported from code.google.com/p/jcouchdb
Other
0 stars 0 forks source link

Attachments should provide methods that receive or provide streams #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. attempt to load an attachment (via Database.createAttachment()) that's
larger than the JVM's heap

What is the expected output?
* Using streams, this would "just work"

What do you see instead?
* java.lang.OutOfMemoryError: Java heap space

In the past I've found that transparent support for both reading
(InputStreams) and writing (OutputStreams) arbitrarily large chunks of
binary data is difficult to achieve, so it may make more sense to refactor
Attachment so that the read and write cases are handled by different classes.

Original issue reported on code.google.com by pmo...@gmail.com on 5 Mar 2009 at 5:41

GoogleCodeExporter commented 8 years ago
BTW, I have no problem leaving the existing byte[] methods in place, but for 
anything
other than relatively small files / concurrent load stream based methods will be
preferable.

Original comment by pmo...@gmail.com on 5 Mar 2009 at 5:43

GoogleCodeExporter commented 8 years ago
This is an issue I was aware was but wasn't yet sure how to solve. There are 
several
issues (and maybe other I am not aware of) that require changes to both the 
Database
class and the Server interface/impl. I will fix this as soon as I have a clear 
idea
how to do so.. (same for auth)

Original comment by ff...@gmx.de on 5 Mar 2009 at 9:40

GoogleCodeExporter commented 8 years ago
Here's a patch that might be a step in the right direction.  I've tested the
InputStream based createAttachment methods reasonably well but not the other 
methods.
 Reading attachments in particular is a little tricky, what with the limitations on
when the returned stream can be read (ie. only while the HTTP connection is 
still
open), so it could do with a bit of a thrashing.

Original comment by pmo...@gmail.com on 6 Mar 2009 at 8:09

Attachments:

GoogleCodeExporter commented 8 years ago
This issue is solved with release 0.9.0-2

Original comment by ff...@gmx.de on 19 Apr 2009 at 5:35