@Override
	protected void initialize() throws Exception {
		super.initialize();

		// sanity check: the tail has to update either the workset or the solution set
		if (!isWorksetUpdate && !isSolutionSetUpdate) {
			throw new RuntimeException("The iteration tail doesn't update workset or the solution set.");
		}

		// set the last output collector of this task to reflect the iteration tail state update:
		// a) workset update,
		// b) solution set update, or
		// c) merged workset and solution set update

		Collector<OT> outputCollector = null;
		if (isWorksetUpdate) {
			outputCollector = createWorksetUpdateOutputCollector();

			// we need the WorksetUpdateOutputCollector separately to count the collected elements
			if (isWorksetIteration) {
				worksetUpdateOutputCollector = (WorksetUpdateOutputCollector<OT>) outputCollector;
			}
		}

		if (isSolutionSetUpdate) {
			if (isWorksetIteration) {
				outputCollector = createSolutionSetUpdateOutputCollector(outputCollector);
			}
			// Bulk iteration with termination criterion
			else {
				outputCollector = new Collector<OT>() {
					@Override
					public void collect(OT record) {}

					@Override
					public void close() {}
				};
			}

			if (!isWorksetUpdate) {
				solutionSetUpdateBarrier = SolutionSetUpdateBarrierBroker.instance().get(brokerKey());
			}
		}

		setLastOutputCollector(outputCollector);
	}
@ Override protected void initialize ( ) throws Exception { super . initialize ( ) ; if ( ! isWorksetUpdate && ! isSolutionSetUpdate ) { throw new RuntimeException ( "The iteration tail doesn't update workset or the solution set." ) ; } Collector < OT > outputCollector = null ; if ( isWorksetUpdate ) { outputCollector = createWorksetUpdateOutputCollector ( ) ; if ( isWorksetIteration ) { worksetUpdateOutputCollector = ( WorksetUpdateOutputCollector < OT > ) outputCollector ; } } if ( isSolutionSetUpdate ) { if ( isWorksetIteration ) { outputCollector = createSolutionSetUpdateOutputCollector ( outputCollector ) ; } else { outputCollector = new Collector < OT > ( ) { @ Override public void collect ( OT record ) { } @ Override public void close ( ) { } } ; } if ( ! isWorksetUpdate ) { solutionSetUpdateBarrier = SolutionSetUpdateBarrierBroker . instance ( ) . get ( brokerKey ( ) ) ; } } setLastOutputCollector ( outputCollector ) ; }
--------------------------------------------------------------------------------------------