static Set < String > serializeComparators ( Criteria criteria , Configuration conf , List < String > comparatorRefs , List < String > comparatorInstanceFiles , String prefix ) throws TupleMRException { Set < String > instanceFiles = new HashSet < String > ( ) ; if ( criteria == null ) { return instanceFiles ; } for ( SortElement element : criteria . getElements ( ) ) { if ( element . getCustomComparator ( ) != null ) { RawComparator < ? > comparator = element . getCustomComparator ( ) ; if ( ! ( comparator instanceof Serializable ) ) { throw new TupleMRException ( "The class '" + comparator . getClass ( ) . getName ( ) + "' is not Serializable." + " The customs comparators must implement Serializable." ) ; } String ref = prefix + "|" + element . getName ( ) ; String uniqueName = UUID . randomUUID ( ) . toString ( ) + ' ' + "comparator.dat" ; try { InstancesDistributor . distribute ( comparator , uniqueName , conf ) ; instanceFiles . add ( uniqueName ) ; } catch ( Exception e ) { throw new TupleMRException ( "The class " + comparator . getClass ( ) . getName ( ) + " can't be serialized" , e ) ; } comparatorRefs . add ( ref ) ; comparatorInstanceFiles . add ( uniqueName ) ; } } return instanceFiles ; }
Returns the instance files created