private Queue<QueueElem> getInstanceSplitList(final AbstractInstance instance) {

		Queue<QueueElem> instanceSplitList = this.instanceMap.get(instance);
		if (instanceSplitList == null) {

			// Create and populate instance specific split list
			instanceSplitList = new PriorityQueue<FileInputSplitList.QueueElem>();
			final Iterator<FileInputSplit> it = this.masterSet.iterator();
			while (it.hasNext()) {

				final FileInputSplit split = it.next();
				final String[] hostNames = split.getHostNames();
				if (hostNames == null) {
					instanceSplitList.add(new QueueElem(split, Integer.MAX_VALUE));

				} else {

					int minDistance = Integer.MAX_VALUE;
					for (int i = 0; i < hostNames.length; ++i) {
						final int distance = instance.getDistance(hostNames[i]);
						if (LOG.isDebugEnabled()) {
							LOG.debug("Distance between " + instance + " and " + hostNames[i] + " is " + distance);
						}
						if (distance < minDistance) {
							minDistance = distance;
						}
					}

					instanceSplitList.add(new QueueElem(split, minDistance));
				}
			}

			this.instanceMap.put(instance, instanceSplitList);
		}

		return instanceSplitList;
	}
private Queue < QueueElem > getInstanceSplitList ( final AbstractInstance instance ) { Queue < QueueElem > instanceSplitList = this . instanceMap . get ( instance ) ; if ( instanceSplitList == null ) { instanceSplitList = new PriorityQueue < FileInputSplitList . QueueElem > ( ) ; final Iterator < FileInputSplit > it = this . masterSet . iterator ( ) ; while ( it . hasNext ( ) ) { final FileInputSplit split = it . next ( ) ; final String [ ] hostNames = split . getHostNames ( ) ; if ( hostNames == null ) { instanceSplitList . add ( new QueueElem ( split , Integer . MAX_VALUE ) ) ; } else { int minDistance = Integer . MAX_VALUE ; for ( int i = 0 ; i < hostNames . length ; ++ i ) { final int distance = instance . getDistance ( hostNames [ i ] ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Distance between " + instance + " and " + hostNames [ i ] + " is " + distance ) ; } if ( distance < minDistance ) { minDistance = distance ; } } instanceSplitList . add ( new QueueElem ( split , minDistance ) ) ; } } this . instanceMap . put ( instance , instanceSplitList ) ; } return instanceSplitList ; }
Returns a list of file input splits specifically ordered for the given {@link AbstractInstance}. When the list is
initially created, it contains all the unconsumed file input splits at that point in time, ascendingly ordered by
the minimum distance between the input splits' storage locations and the given {@link AbstractInstance}.

@param instance
the instance for which the file input split list has been computed
@return the list of file input splits ordered specifically for the given instance