SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
Originally posted by RajaniKanth Bhargava:
Hi Brahin,
I think the Hashtable itself would have to be declared static ( which you have not, may be its just a typing mistake).
If you are not using it to put some new Objects into it then I think it would be a performance issue as the other threads will have to wait if you synchronize the Hashtable.
I think all the Objects in the ServletContext are returned by value when you call through the getAttribute() method (otherwise what would happen if another servlet is calling the same Object?).
Hope this info is good enough.
SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
Originally posted by William Brogden:
1. Compared to all the other time consuming operations that take place in servlets, the extra time consumed would be miniscule.
2. Of course you only get a reference when you retrieve something from a ServletContext. There are no collections in Java that return a copy of an object.
SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
Well, the simple test I did shows that attributes are returned:
- by reference if the object is a Hashtable (probably HashMap too)
- by value if it is a Vector or any other object
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Originally posted by William Brogden:
You are trying to tell me that if a ServletContext contains a reference to a Vector then when you do a get, what it returns is NOT a copy of the reference but a clone?
I am eagerly awaiting your proof of this.
Bill![]()
SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
Do Re Mi Fa So La Tiny Ad
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|