示例#1
0
 /// <summary>
 /// Get a comparator for a
 /// <see cref="IWritableComparable{T}"/>
 /// implementation.
 /// </summary>
 public static Org.Apache.Hadoop.IO.WritableComparator Get(Type c, Configuration conf
                                                           )
 {
     Org.Apache.Hadoop.IO.WritableComparator comparator = comparators[c];
     if (comparator == null)
     {
         // force the static initializers to run
         ForceInit(c);
         // look to see if it is defined now
         comparator = comparators[c];
         // if not, use the generic one
         if (comparator == null)
         {
             comparator = new Org.Apache.Hadoop.IO.WritableComparator(c, conf, true);
         }
     }
     // Newly passed Configuration objects should be used.
     ReflectionUtils.SetConf(comparator, conf);
     return(comparator);
 }
示例#2
0
 /// <summary>
 /// Register an optimized comparator for a
 /// <see cref="IWritableComparable{T}"/>
 /// implementation. Comparators registered with this method must be
 /// thread-safe.
 /// </summary>
 public static void Define(Type c, Org.Apache.Hadoop.IO.WritableComparator comparator
                           )
 {
     comparators[c] = comparator;
 }