Originally posted by Desai Sandeep:
I am attempting to answer some of your questions.I believe internally Caching would be implemented on Singleton Pattern.
[b]What is the difference between JNDI reference caching and caching EJB homes ?
When we refer to JNDI caching, probably it means "com.ibm.ejs.ns.jndi.CNInitialContextFactory" would search for th e provider URL (iiop://...).Since each part of the provider URL would be implemented as a Java class, hence the CNInitialContextFactory would be implemented using a Singleton pattern to give the global instance of the Context that has been created earlier using the provider URL.
Caching EJB Home is what you implement while you code a EJB Component.Again it involves validating if the instance has been created earlier or not.If yes, the same instance is returned otherwise the new instance is created.
What exactly gets cached? Is it the EJB home interface?
Yes, we can cache the EJB Home interface by using Singleton Pattern.
What is the bind and rebind operation?
You can bind an object with a name in the session namespace.However, if you use bind you cannot bind the object again with the same name.If you want to that, you would need to unbind the previous mapping and bind it with a new name.This is done by the rebind operation.
what is meant exactly by binding an object to the string?
This is the basic principle on how JNDI works.Instead of remembering the exact structure of the object, you are representing that object with a simplified name which the clients may want to refer to.You may think of JNDI service as a giagantic Collection which maps Objects to simple Strings for accessing objects.
The article says that 'A cache is restricted to a process and does not persist past the life of the process'. Here what does PROCESS mean?
This infact depends on the architecture of the AS.I am new to Websphere environment.I can tell you about a process in Oracle Application Server, where a request by the client would be handled by a seperate lightweight process called sess_iiop (based on some logic).Each of these processes will have its own set of static and non-static variables.These variables are not shared between processes.
When does a 'stale data' scenario occur?
As mentioned in the note that you posted, it occurs when many processes are executing together.This statement "Usually, cached objects are relatively static entities, and objects becoming stale should not be a problem." signifies the use of Singleton pattern which sees to it that stale data doesnot create a problem for us.
Hope this helps,
[This message has been edited by Desai Sandeep (edited June 22, 2001).][/B]
Originally posted by Krithika Venugopal:
I am new to Websphere and J2EE and I have some very basic questions on JNDI caching.
It would be very helpful if someone could clarify all of them. I went through the Infocenter (updated one for Fixpack 2 -http://www-4.ibm.com/software/webservers/appserv/doc/v35/ae/infocenter/was/040302.html), it claims to have implemented Jndi caching by default during lookups. I have the following doubt,
1. The article says that 'A cache is restricted to a process and does not persist past the life of the process'. Here what does PROCESS mean? Is the process the one between the start and stop of the EJB container? If we have many EJB containers (default container and other containers) then does that mean that we have multiple processes running?
2. What is the difference between JNDI reference caching and caching EJB homes ?
3. What is the 'cached object'? What exactly gets cached? Is it the EJB home interface?
4. The article furthur says the following:
'If a bind or rebind operation is executed on an object, the change will not be reflected in any caches other than the one associated with the context from which the bind or rebind was issued. This "stale data" scenario is most likely to happen when multiple processes are involved, since different processes do not share the same cache, and Context objects in all threads in a process will typically share the same cache instance for a given name service provider'.
a. What is the bind and rebind operation? I found out that they are methods in javax.naming.Context. But what is meant exactly by binding an object to the string.
b. When does a 'stale data' scenario occur? When we deploy the same EJB in multiple containers (and hence cached in multiple caches)?
Thanks in advance,