You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2006/03/15 19:25:55 UTC

DO NOT REPLY [Bug 38986] New: - RequestProcessor does not need synchronization to get action from action map

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986

           Summary: RequestProcessor does not need synchronization to get
                    action from action map
           Product: Struts
           Version: 1.2.8
          Platform: All
        OS/Version: Windows 3.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Action
        AssignedTo: dev@struts.apache.org
        ReportedBy: andrei.a.skvortsov@sprint.com


Why do�we have synchronization on get method that returns Action object from 
the map. It could cause performance issue on high traffic applications. 
Synchronization only needed around the put method that adds Action object to 
the map.

public class RequestProcessor {�����������.
// class level map to cache already created actions
protected HashMap actions = new HashMap();
// method to create or get already created action from the map 
protected Action processActionCreate(�) throws IOException {
����������������������.
Action instance = null;
// Synchronize actions map access
synchronized (actions) {
// get cached action and return it if there is one
            instance = (Action) actions.get(className);
// instance is null at this point, create new instance and put it in the map  
            actions.put(className, instance);
}

        return (instance);
    }

// Comment: Synchronization on getter method is bottleneck that can cause 
performance issue. Multiple treads(users requests) will be waiting in each 
other just to get thread safe object from the map. Synchronization only neared 
in this case if we would need to instantiate Action object to put it in the 
map. 

The code above should be re-factored to something as follows: 
// get cached action and return it if there is one
Action instance = (Action) actions.get(className);
if(instance==null){
// Synchronize actions map access
synchronized (actions) {
// instance action from class name and put it in the map  
��            
actions.put(className, instance);
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 16:26 -------
Well System.out.println synchronizes writing to system�s output stream but 
not �put� and �get� methods that were outside of System.out.println method call.
Anyway, may be code below will help.
Instead of writing to System.out each thread has its own Baffer to collect test 
results. 
Writer starts reader thread after 10th Map entry, just to make sure that reader 
has something to read
Main thread sleeps for 10 seconds and displays results. 
You can also try it without any writing to console. 
After all - all what we looking for in this case is 
ConcurrentModificationException. 
-Regards
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

	public class SynchronizeDemo {
		public static Map actions = new HashMap();
		public static StringBuffer readOut = new StringBuffer();
		public static StringBuffer writeOut = new StringBuffer();

		public static void main(String[] args) throws 
InterruptedException {
			SynchronizeDemo demo = new SynchronizeDemo();
			demo.test(); 
			Thread.sleep(10000); 
			System.out.println("Result: " + writeOut.toString() + 
readOut.toString());
		}
		public void test() throws InterruptedException{
			MapWriter writer = new MapWriter();
			writer.start(); 
		}
		public class MapReader extends Thread{
			public void run(){
				for(int i = 0; i<250; i++){// read Map 250 times
					Set keys = actions.keySet(); 
					readOut.append("\n" + this.getClass
().getName()); 	
					for(int ii = 0; ii < keys.size(); ii++)
{//	display all actions from the map 
						readOut.append(" 
['_action_key_" + ii + "' mapped to '" + actions.get("_action_key_" + ii)
+"']"); 	
					}
				}
			}
		}
		public class MapWriter extends Thread{
			public void run(){
				synchronized(SynchronizeDemo.actions){
					for(int i = 0; i<250; i++){// put new 
action 250 times
						if(i==10){
								MapReader 
reader = new MapReader();
								reader.start();
						}
						actions.put("_action_key_" + 
i, "_action_class_" + i);
						writeOut.append("\n" + 
this.getClass().getName() + "'_action_key_" + i + "' '_action_class_" + i 
+ "'"); 	
					}
				}
			}
		}
	}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 23:10 -------
(In reply to comment #12)
> If you don't like the pooling/syncronizing of the HashMap you can always 
> override the createAction Method and always return a new instance.
> If you are using Tiles you'll have to override TileRequestProcessor
> instead.

I am in favor simple controller framework. I coded it several times for 
different projects and it works. Light weight, thread safe actions can be 
loaded in the Map for reuse or newInstance can be called each time depends upon 
configuration.
But, this brinings another point. What should I extend in Struts in order to 
get just simple controller framework. 
No tiles, no forms, forward response mapped in XML, no maps in ModuleConfigImpl 
itc.
Do you think that lightweight controller framework should be available in a top 
level of Struts object hierarchy?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From struts_user@anotheria.net  2006-03-16 15:35 -------
you should move the discussion the user or dev list.
as for your example, are you aware that System.out.println synchronizes your
thread, and you have no concurrency at all in your example? :-)

If you want a real example, you have to create multiple reader and multiple
writer, start them all simultaneously and let them work for some time and
different time intervals.

leon

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From rleland@apache.org  2006-03-16 22:52 -------
If you don't like the pooling/syncronizing of the HashMap you can always 
override the createAction Method and always return a new instance.
If you are using Tiles you'll have to override TileRequestProcessor
instead.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From struts_user@anotheria.net  2006-03-16 15:14 -------
You example is irrelevant since the cubbyhole object in the example doesn't
modify it's internal data structures during write. HashMap however modifies its
internal data structures in put (especially if it (the HashMap) grows) so that
the entry.next pointer could point to itself and the concurrent read would be
caught in an infinite loop. 

Please consult the Api Documentation for HashMap
(http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html) 

A clearly WONTFIX or rather INVALID, but I'm not a commiter, so I will not close
it, but Nial probably will do :-)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 15:23 -------
Just try example above - it says it all. 
I�d like to think about programming as of precise science of good algorithms 
and common scenes.
Let�s not make VooDoo out of it ;-)     


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986


hrabago@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From hrabago@apache.org  2006-03-16 19:39 -------
Please refer to the API contract imposed by HashMap that Leon noted in comment 
#7.  We adhere to the contract imposed by the API to ensure consistency and 
compatibility.

Closing as INVALID.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From mrdon@twdata.org  2006-03-16 23:17 -------
Take a look at XWork - http://www.opensymphony.com/xwork - which forms the basis
of WebWork 2, which itself will form the basis for Struts Action 2.  Struts
Action 1 is pretty simple really, especially when you start playing with your
own RequestProcessor, or request processing chain in 1.3 parlance.  You could
implement a high performance processor/processing chain then propose it to the
community with benchmarks proving its worth.  The goal of Struts Action 2 is
simplify and make it easier for developers, so I'd be interested to see what you
could come up with to see how we could improve.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986


Joe@Germuska.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From Joe@Germuska.com  2006-03-16 16:43 -------
If official Sun JavaDoc for HashMap prescribes synchronizing both puts and gets
then we are not going to deviate from that advice.

Closing as INVALID.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986


niallp@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From niallp@apache.org  2006-03-16 09:43 -------
We do have to synchronize on the get method because if the get method is 
called at the same time as the HashMap is being modified the results will be 
unpredictable - see Tomcat Bug 36541 for a whole discussion on this and the 
HashMap javadocs on synchronization:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html

Closing as WONTFIX.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From struts_user@anotheria.net  2006-03-16 16:39 -------
ok last time :-)

from the HashMap
    public Object get(Object key) {
        Object k = maskNull(key);
        int hash = hash(k);
        int i = indexFor(hash, table.length);
        Entry e = table[i]; 
        while (true) {
            if (e == null)
                return e;
            if (e.hash == hash && eq(k, e.key)) 
                return e.value;
            e = e.next;
        }
    }
if the map has been modified during in the read process, it can happen that
e.next points to e or something with something.next = e -> infinite loop.

Please read the api contract:
 * <p><b>Note that this implementation is not synchronized.</b> If multiple
 * threads access this map concurrently, and at least one of the threads
 * modifies the map structurally, it <i>must</i> be synchronized externally.
 * (A structural modification is any operation that adds or deletes one or
 * more mappings; merely changing the value associated with a key that an
 * instance already contains is not a structural modification.)  This is
 * typically accomplished by synchronizing on some object that naturally
 * encapsulates the map.  If no such object exists, the map should be
 * "wrapped" using the <tt>Collections.synchronizedMap</tt> method.  This is
 * best done at creation time, to prevent accidental unsynchronized access to
 * the map: <pre> Map m = Collections.synchronizedMap(new HashMap(...));

Please note that the ConcurrentModificationException is only used in the
HashIterator, and even there it doesn't guarantee anything, but provides "best
effort" attempt to detect a concurrent modification.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986





------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 20:08 -------
Sorry for trying to help. It was a bad idea anyway. 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986


andrei.a.skvortsov@sprint.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |




------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 15:04 -------
Object synchronization locks object access to any of its methods in respect any 
other thread that is trying to access this object. Please go over CubbyHole 
example from sun 
(http://java.sun.com/docs/books/tutorial/essential/threads/synchronization.html)
 or just copy and paste following demo into eclipse.
///////////////////////////////////////////////////////////////
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class SynchronizeDemo {
	public static Map actions = new HashMap();
	public static void main(String[] args) {
		SynchronizeDemo demo = new SynchronizeDemo();
		demo.test(); 
	}
	public void test(){
		MapReader reader = new MapReader();
		reader.start(); 
		MapWriter writer = new MapWriter();
		writer.start(); 
	}
	public class MapReader extends Thread{
		public void run(){
			for(int i = 0; i<250; i++){// read Map 250 times
				Set keys = actions.keySet(); 
				System.out.print("\n" + this.getClass().getName
()); 	
				for(int ii = 0; ii < keys.size(); ii++){// 
display all actions from the map 
					System.out.print(" ['_action_key_" + ii 
+ "' mapped to '" + actions.get("_action_key_" + ii)+"']"); 	
				}
			}
		}
	}
	public class MapWriter extends Thread{
		public void run(){
			synchronized(SynchronizeDemo.actions){
				for(int i = 0; i<250; i++){// put new action 
250 times
					actions.put("_action_key_" + 
i, "_action_class_" + i);
					System.out.println(this.getClass
().getName() + "'_action_key_" + i + "' '_action_class_" + i + "'"); 	
				}
			}
		}
	}
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


DO NOT REPLY [Bug 38986] - RequestProcessor does not need synchronization to get action from action map

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38986>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38986


andrei.a.skvortsov@sprint.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From andrei.a.skvortsov@sprint.com  2006-03-16 19:31 -------
This would be the last one 
As far as Struts Action example concerned, we are not removing actions from the 
table, but keep adding.
So if you added the object at the time when someone is trying to read it would 
not problem. 
table.length in HashMap simply will return you the length that is one element 
less than actual length. 
In other words, the element that was just added is not going to be considered 
by the search. 
�table� array in a HashMap is array of Entry objects. 
Each element in array is object that has information about another Entry 
previously added to array. 
Entry e = table[i] get you last object and after that you do e = e.next to get 
previous creted entry.
In other words, no matter what Entry object you started with, it has memory 
location reference to previously added entry.

Note. The point is that is we are not using array's index here to get child 
entry and I do not see how you can get Circular reference that are you talking 
about in your response.

Ok, getting back to as Struts Action paradigm.
Getting Action in synchronized block degrades performance. This way you lining 
up all your user requests and letting them get the action one at the time 
waiting on each other no matter if action loaded or not.  
If Map is concern, It would be better decision to create all Action Objects at 
application start-up, so that you would use the action map as read only.

Cheers ;-)  


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org