This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Distributed Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Distributed Container" Watch "Distributed Container" New topic
Author

Distributed Container

Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Dear all,
Some articles,that i have read, talked about Distributed Container.
What is the meaning of "Distributed container" ?
thanks
daniel
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Hard to say without the context of the particular article. I'm not sure I've heard of a "distributed container", as much as I've heard of a distributed application (distributed between multiple containers).

In any event...

If you have an application server with more than one servlet container, then your application can be 'distributed' between the two containers. Two containers can theoretically handle twice the load. A single, complete copy of your application is loaded into each container.

Another meaning of distributed is when you cluster servers. This is more than one physical box, each with a single (or even multiple) containers. Like on a server farm.
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
One document that I read about Distributed Container is Servlet 2.4 Specification( Proposed Final Draft)...
It said that
"Context attributes are local to the VM in which they were created. This prevents
ServletContext attributes from being a shared memory store in a distributed
container."
Example we implement distributed container for our application into 2 different machines. Who is reponsible to redirect our request to first machine or the other one?
thanks
daniel
Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
Distributed container is deploying your application in two diffrent systems but logically they appear a single application to the user. In other words its known as clustering the application. This is done for load balancing and better performance
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The segment of the spec you quoted:Context attributes are local to the VM in which they were created. This prevents ServletContext attributes from being a shared memory store in a distributed
container


This is just a warning to developers about the nature of a distributed container. Imagine two instances of the same servlet, one in each of two containers.

Request 1 goes to Container 1 and calls the following:

ServletContext.setAttribute("foo", "bar");

normally, the foo attribute would be available in a JSP through the application object, or in other servlets through ServletContext.getAttribute()

Request 2 goes to Container 2 and calls:

ServletContext.getAttribute("foo");

This would return null, and not the expected "bar" String. Because the containers do not share the ServletContext.


As for you second example...Who is reponsible to redirect our request to first machine or the other one

This is accomplished by the container. If the container is distributed, then generally speaking that container would only be useful if it did its own distribution. The onus is NOT on the developer to do the distributing. All you have to worry about are issues like above, and be aware that certain (all?) objects are not shared.
Alex Qiu
Greenhorn

Joined: Jul 19, 2002
Posts: 24
"Who is reponsible to redirect our request to first machine or the other one"
Does this has some relationship with the JNDI tree that build in the application server and can identify the servlet containers in distributed system ? or other implementation ?
Just curious ...


Nothing is impossible to a willing heart .<br />----------------------------------<br />SCJP SCJD
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Distributed Container
 
Similar Threads
distibuted Transaction in Spring ?
Distributed Web application question
SingleThreadModel in a distributed environment
Query about using Local Interfaces in EJB
Difference between Enterprise and simple Web app