• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stateless beans - still hazy about caching  RSS feed

 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a ServletContextListener where I do a lookup and store it in an attribute, as per below:




As I kind of understand it, the container has a Stateless bean pool. Would doing the above and using getAttribute to retrieve the bean in a servlet, say, still use the pool, or would it refer to the same bean instance? Or are caching local stateless beans even required? (ps: i know that this way isn't the best practice, I'm just trying to figure out the behaviour of caching stateless beans.)


Thank you very much,

Billy


 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did another test which has me a bit confused. When I call a method on a stateless bean where the method does not return for 10 seconds or so, all other methods on the bean are blocked. If I change the code to do a separate lookup for each method I want to invoke, the methods do not block, which leads me to believe that I should not cache the bean lookup ?


 
Gaurav Ag Agarwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw what you did.. You can go from through this tutorial if you need it has all your basic details at http://www.roseindia.net/javabeans/javabeans.shtml
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gaurav Ag Agarwal wrote:I saw what you did.. You can go from through this tutorial if you need it has all your basic details at http://www.roseindia.net/javabeans/javabeans.shtml


Out of curiosity, how is that "course" related to this specific question? A quick look at that page shows that it provides an overview of EJB applications, but is no way related to the specific question which Billy asked in this thread.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Billy Vandory wrote:I did another test which has me a bit confused. When I call a method on a stateless bean where the method does not return for 10 seconds or so, all other methods on the bean are blocked.


Are you sure it's a stateless bean? And which application server is this?
 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:
Billy Vandory wrote:I did another test which has me a bit confused. When I call a method on a stateless bean where the method does not return for 10 seconds or so, all other methods on the bean are blocked.


Are you sure it's a stateless bean? And which application server is this?


Yep, it's annotated as @Stateless

App server is Geronimo with an OpenEJB plugin.
 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:
Gaurav Ag Agarwal wrote:I saw what you did.. --snip--



Last Summer?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!