Hello me,
I'm posting this in response to my question that I have found the
answer to.
The answer is not very.
The synchronization applies only to the SortedMap not the Iterator.
If the Map is altered then the iterator MAY throw a
ConcurrentModificationException though this is not always the case. So
instead of using the iterator, is there someway of getting what you
need without iterating through the map itself, and storing the
reference(s) someplace else?
At least that way you have a snapshot of the Map even though it may
not be current. At least it won't break.
This may or may not be what you need.
It's ok for what I intend.
Good Luck
Matt Melton
ha***********@yahoo.co.uk (matt melton) wrote in message news:<26**************************@posting.google. com>...
hello,
I have been wondering as to what extent the SortedMap that
synchronizedSortedSet( new TreeMap() ) returns is synchronized, and
thought that somebody might be able to help.
If I get the iterator from the sorted set is the iterator also
synchronized?
If another thread attempts to access the sorted set while the iterator
exists will an exception be thrown? or will the thread block and wait
for the iterator to be finished with?
I remember reading something about exceptions being thrown if the data
in the Map or set that an iterator is from, is changed. I cannot find
where I read this, so I might have made it up.
Any pointers will be a great help,
Thanks
Matt Melton