• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stateless Session Bean

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what I understand it:
If I have a instance varible in the stateless session bean and I have two methods. The bean/container won't maintain the instance varible for me between the two method calls. But I tested the scenario in the J2ee server. It appears that the server is maintaining that for me.
Can anybody explain this for me?
Thanks in advance.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're confusing "not throwing an exception" with maintaining.
You CAN define static variables - or preferably constants, providing you're willing to deal with the multi-tasking consequences. However, instance variables are tied to specific instances, and instances are created, recycled, and destroyed according to rules that don't guarantee that any two invocations - whether from the same client or another - will receive the same instance. The heavier the workload, the more likely that your application will fail unpredictably.
A *REALLY* picky appserver could check the EJB's class files and refuse to deploy anything with instance variables, but regardless, there is a reason why there's a separate type of session EJB for when you need to maintain state.
[ June 10, 2002: Message edited by: Tim Holloway ]
 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic