https://issues.apache.org/bugzilla/show_bug.cgi?id=50297

--- Comment #4 from Isaac Shabtay <[email protected]> 2010-11-22 11:41:28 EST 
---
Well I'm not sure why my approach is the wrong one; the only alternative I can
see is issuing multiple "copy" tasks, but that seems wasteful.

To fix this with a "Map", without breaking the API, I can only think of the
following:

1) Define a class that extends Hashtable (call it HashtableEx or something,
doesn't matter).

2) Have its constructor receive a reference to a Map, which will basically be
an "observer".

3) Override the "put" and "remove" method so, in addition to putting /removing
stuff to / from the Hashtable, also puts / removes stuff from / to the Map that
was provided in construction time.

4) Define an actual Map inside the Copy task - one for each Hashtable.

>From there on, any addition/removal will be "posted" to the map so the
hashtable and the map are always in sync. Internally, the Copy task should use
the Map rather than the hashtable; we can mark the hashtable instance as
"deprecated" so it can be removed in future releases.

Other than that, I can't really think of another way to resolve this issue.

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

Reply via email to