Should I close StreamedContent stream?

UI Components for JSF
primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

15 Aug 2011, 00:44

Hi,

I'm using the FileDownload component. I use the DefaultStreamedContent to keep the file in memory.

Should I at any point close the InputStream manually in this variable, by calling

Code: Select all

file.getStream().close()
, where file is the StreamedContent variable?
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.

Radek
Posts: 1
Joined: 09 Oct 2011, 11:07

09 Oct 2011, 11:40

Hi,

I have a similar problem with graphicImage component. I think there is a big memory leak, because nobody close open input streams. I want to render image which is saved somewhere in filesystem so I have used FileInputStream but it is easy to get "too many open files"...

I thing that DefaultStreamedContent should return new opened stream each call of getStream method and PrimeResourceHandler should close the stream in the end of method handleResourceRequest.

cagatay.civici
Prime
Posts: 18298
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

11 Oct 2011, 11:28

PrimeFaces should close it for you after writing the response but it doesn't seem to do that, please create an issue ticket and post the issue link here.

Thanks.

phanisk
Posts: 2
Joined: 20 Jul 2012, 14:36

20 Jul 2012, 14:51

Is this defect fixed? If so can someone please point to me in which version it got fixed?

I am trying to display an image through DefaultStreamedContent and passing a new InputStream. Seems I don't have any control over to close this stream unless Primefaces closes the stream after reading the content. Otherwise it would lead to very serious issues.

Please reply.

kukeltje
Expert Member
Posts: 9599
Joined: 17 Jun 2010, 13:34
Location: Netherlands

20 Jul 2012, 15:01

if an issue was not created, the chance is big it was not fixed... So check the issue list and see if and when it got fixed. If so, you can kind of make a guestimate which version it got fixed in. If not, please create an issue


User avatar
Oleg
Expert Member
Posts: 3803
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

20 Jul 2012, 15:35

Good to see Cagatay on heavy bug fixing :-)
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

cagatay.civici
Prime
Posts: 18298
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

20 Jul 2012, 15:36

I think 3.4 has enough new features :)

User avatar
Oleg
Expert Member
Posts: 3803
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

20 Jul 2012, 15:38

I think 3.4 has enough new features
Very right vision! :-)
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

kukeltje
Expert Member
Posts: 9599
Joined: 17 Jun 2010, 13:34
Location: Netherlands

20 Jul 2012, 16:21

And he even creates the 'issues' himself at google

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests