Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

isIdentical method for Stateless Session Bean

 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EJB Spec. 2.0, Section 6.9.2,

First paragraph (2nd line) says,
"If a stateless session bean is deployed multiple times (each deployment results in the creation of a distinct home), session objects from different homes will have a different identity"

I really don't understand the above sentence.
If same SLSB is deployed multiple times, how can a client hold all the ejbobject references (one ejbobject per deployment basis).

Can anybody help me in understanding this ?
Thanks in advance.

Micheal
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say that the bean is deployed twice. A client can do two JNDI lookups to get the home interfaces and then get the componenent interface from each of the homes.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if we deploy twice, at any point of time, there will be only one bean in container right ?

Is my understanding correct ?

Suppose say, i deploy first time,
i get objA as my remote reference.

Now i deploy second time, (by this time, already deployed bean is gone, right ?)
i get objB as my remote reference.


If i call objA.isIdentical(), will this not throw NoSuchObjectException ??

Micheal
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm ... I've never seen Michael spelled that way. Is it still pronounced like Michael?

I think you're confusing the session bean with its home stub. You retrieve the home from JNDI, and there is, in fact, only one ... unless you actually write your deployment descriptor to deploy the same bean type twice under two different JNDI names. That means two homes and two separate pools of the stateless session beans, just as if you had deployed two entirely different beans. The point the spec is making is that the two homes can't share a pool, so you can never retrieve the same session object from different homes.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm now i get the point.

If we deploy same session bean twice (both have different jndi home name)
(have two session element in DD)

though the bean is same, isIdentical will return false. (as they are not from same home)

Thanks roger & greg.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic