GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes Should I use a SL SessionBean or JavaBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Should I use a SL SessionBean or JavaBean" Watch "Should I use a SL SessionBean or JavaBean" New topic
Author

Should I use a SL SessionBean or JavaBean

Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191
hi folks,
I am using JDOM to parse an XML file to display an xml tree in the JSP, this parsing happens at one time and then the whole XML file is cached in the memoray. Currently I am doing this in JSP using a simple Java Class.
My demo is over and the client is Ok with this implementation, now I have to move this implementation to the production server, there I have bea weblogic. may be 100 users will access this application simultaneously,I am thinking to move that tree parsing logic in a stateless session bean, and to call that SLS from a tag lib at the front-end for xml tree rendering.
1 ) What do you suggest? should I use SLS EJB or not.
2 ) Is it ok if SLS is called via tag lib in JSP?

thanks.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10146
    
165

Your usecase does not require a SLSB. Enterprise java beans are heavy components and are useful only when the business logic involved requires transactions, security and other such stuff. Your usecase can be implemented using core java, maybe using the Singleton pattern.


[My Blog] [JavaRanch Journal]
Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191


Your usecase does not require a SLSB. Enterprise java beans are heavy components and are useful only when the business logic involved requires transactions, security and other such stuff. Your usecase can be implemented using core java, maybe using the Singleton pattern


Yes it is true that EJBs are very heavy weight components, in current scenarion i dont require transaction or security. But my concern is heavy processings of xml parsing on every click of my xml tree, and just imagine if 100 users will be there(posiblity of more then 200 users)..then what would happen on a single poor server.
So my idea is to distribute this processings leveraging the EJB architecture.. so here I can achieve scalebility ..do you agree with me.
Regards
A.B
[ October 16, 2006: Message edited by: Awais Bajwa ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10146
    
165

But my concern is heavy processings of xml parsing on every click of my xml tree


In your earlier approach you had mentioned that the parsing of the xml will be done only once and the parsed result will be stored in a cache. So you can have a singleton utility, which will parse this xml only once(when it is first invoked or maybe when the application is being loaded). Later on since this parsed data is read-only, you will not have to worry about the concurrency issues resulting from the number of users accessing the application. Am i missing something here?
Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191

In your earlier approach you had mentioned that the parsing of the xml will be done only once and the parsed result will be stored in a cache.


Its true, but still there might be a heavy DOM object in the memory, and traversing still requires processings(may be in future i think to move to sax approacch in case of tremendous increase in xml file size), and as I have told you about number of concurrent user, so here I am not concerned about data concurrency but a server resourse issue.i.e server processing and resources. Still the question is If I create a singleton , again traversing that stream object requires processinsg ....so delegating this processings for enterprise clients to the SLSB is ok or NOT. Or I am missing something.?
[ October 16, 2006: Message edited by: Awais Bajwa ]
 
GeeCON Prague 2014
 
subject: Should I use a SL SessionBean or JavaBean