HADOOP-7183. WritableComparator.get should not cache comparator objects. Contributed by Tom White

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1100056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-05-06 05:07:22 +00:00
parent ad36a0e6a0
commit a213c5676c
2 changed files with 5 additions and 2 deletions

View File

@ -682,6 +682,9 @@ Release 0.21.1 - Unreleased
HADOOP-7194. Fix resource leak in IOUtils.copyBytes(..). HADOOP-7194. Fix resource leak in IOUtils.copyBytes(..).
(Devaraj K via szetszwo) (Devaraj K via szetszwo)
HADOOP-7183. WritableComparator.get should not cache comparator objects.
(tomwhite via eli)
Release 0.21.0 - 2010-08-13 Release 0.21.0 - 2010-08-13
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -53,7 +53,6 @@ public class WritableComparator implements RawComparator {
// if not, use the generic one // if not, use the generic one
if (comparator == null) { if (comparator == null) {
comparator = new WritableComparator(c, true); comparator = new WritableComparator(c, true);
comparators.put(c, comparator);
} }
} }
return comparator; return comparator;
@ -75,7 +74,8 @@ public class WritableComparator implements RawComparator {
} }
/** Register an optimized comparator for a {@link WritableComparable} /** Register an optimized comparator for a {@link WritableComparable}
* implementation. */ * implementation. Comparators registered with this method must be
* thread-safe. */
public static synchronized void define(Class c, public static synchronized void define(Class c,
WritableComparator comparator) { WritableComparator comparator) {
comparators.put(c, comparator); comparators.put(c, comparator);