At 04:51 PM 5/10/2002 +0100, you wrote:
>Hi,
> 
>Does anyone have the answer to why the  get(int index) method in the java.util.Vector 
>class is synchronized?
>Since it doesn't modify anything two threads can safely access it concurrently - no?
> 
>thanks,
>Jesper Jorgensen


For safety/data integrity.  No one can be allowed to get an element from the Vector 
while the vector is being modified or an exception could occur.

So basically it's synchronizes so that any modify methods will be atomic.


DR



To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to