File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes vector: synchronized data and synchronized method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "vector: synchronized data and synchronized method" Watch "vector: synchronized data and synchronized method" New topic
Author

vector: synchronized data and synchronized method

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 136
One SCJD textbook says:

Vector provides synchronized methods to access data, but vector itself is not synchronized data, and there is a big difference.

I do not see how they are different from a programmer 's viewpoint: since all methods are synchronized, the internal data integrity of a vector is always maintained.

What did I miss?
Thanks.
Yan
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
If you have a reference to an object that is contained by a Vector, you can modify the value of that object in an thread un-safe manner. The synchronization just protects the list so-to-speak not the content.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

They have some really strange and confusing ways of wording those questions. I bet they think they are clear too...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: vector: synchronized data and synchronized method
 
Similar Threads
vector: synchronized data or synchronized method
vector or arrayList
Vector vs ArrayList
A Vector class is a Threadsafe
synchronized classes?