Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How JNDI cache works?  RSS feed

 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to lookup an ejb through a servlet using fully qualified class name of the ejb for lookup.
Something like this ejb/com/MyEJBHome. This I am doing in Websphere.
And it does work fine.

I have read following "When an InitialContext object is instantiated, an association is established between the InitialContext instance and a cache" from http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/cnam_naming_caching.html

Now if i try to lookup that same ejb again (using same context Factory and fully qualified classname of the ejb) through a standalone client will the lookup happen through the cache?

Regards,
Giriraj.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I have done meanwhile.



I used above code twice.
Once inside a servlet and once inside a standalone java app.

Now the server is up and i run the servlet. I get the object reference "ejbHome " as in the snippet above.

Now i run the standlone java app.
Again i get the object reference and i compare it with the one i got while invoking through a servlet.
And they turn out to be same.(something like IOR:00bdbdbd00000039524d493a636f6d2e73312e617263682e616c65727 etc...)

Can i conclude from this that next time the lookup happened through the cache?

Regards,
Giriraj.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!