Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How can I return Stream from Session bean ????

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I return Stream from Session bean ???
I try to create an array with data and return it? but
its not good idea becouse some times i
have exeption out of memory .
thanks beforehand.

 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not a good idea to return streams from EJBs. Most streams are not serializable (which doesn't really matter if you use local interfaces) and you don't want to keep certain resources open longer than necessary or leave them possibly unclosed. In general, you are asking for trouble if you go this route.
What exactly are you passing around that is using so much memory? Quite possibly, EJB may not be a good solution in this particular case...
 
Andrey Solonchuk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, may be i`m wrong using EJB for this task
I have server(j-boss) with has connection thru jdbc to database,
i need build report client side, for this i need data as resul ot query to data base
so i see it as a pipe between client and database
i`ll only get whoe result of query ( only moving forvard geting data) and build report using xslt
i think about, may be i heed somethink like httpsession.....
 
Ranch Hand
Posts: 209
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a streaming solution to this?

I have remote clients that accesses SLSB to download binary files from a CMS. The server will run out of memory if there are too many concurrent client requests, or if some of the files are too large.

I prefer not to use servlets, any other J2EE solutions that can do streaming?
[ September 05, 2007: Message edited by: Chu Tan ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about emulating Stream interface with statefull session bean?

It is true that we are shifting some client responsibility on server side (like closing stream, eating data chunk by chunk etc) but it think it more reliability in tread offs.

We should assume that client will sincerely consume data ASAP and will release our bean. Notably overhead of keeping statefull beans is not going to be much considering java implementation of streams.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isnt it possible over here to create a Data object out of the result set and return that from the session bean?
You can implement a paging logic on the data object if the data is too huge and your client can afford to do so.
I think it will be an overkill to build a streaming solution for this sort of a thing. Having a data object with paging(fetch data on demand) will be more suitable.
 
The City calls upon her steadfast protectors. Now for a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic