Performs the final computation and freezes the collections.
This is a terminal operation, thus no further modifications
are allowed to the specified data sets.

@throws ToolException if an error occurs
768807
void analyze() throws ToolException {
        // compute the specified element, by expanding module dependencies
        computeSpecifiedModules();

        // compute all specified packages and subpackages
        computeSpecifiedPackages();

        // compute the specified types
        computeSpecifiedTypes();

        // compute the packages belonging to all the specified modules
        Set<PackageElement> expandedModulePackages = computeModulePackages();
        initializeIncludedSets(expandedModulePackages);
    }
279135
public void reset() {
        endRange = set.getRangeCount() - 1;
        range = 0;
        endElement = -1;
        nextElement = 0;            
        if (endRange >= 0) {
            loadRange(range);
        }
        stringIterator = null;
        if (set.strings != null) {
            stringIterator = set.strings.iterator();
            if (!stringIterator.hasNext()) {
                stringIterator = null;
            }
        }
    }
379076
public synchronized void finish() {
        if (!isFinished) {
            isFinished = true;
            try {
                matrixDos.close();
                // Re-open as a random access file so we can overwrite the 3 int
                // header that specifies the number of dimensions and values.
                // Note that the location of the matrix data is dependent on
                // whether the matrix is to be transposed.
                File dataFile = (transposeData)
                    ? transposedMatrixFile
                    : matrixFile;
                RandomAccessFile matrixRaf =
                    new RandomAccessFile(dataFile, "rw");

                // Back fill the dimensions of the matrix and the number of
                // non-zero values as the 3 int header in the file
                matrixRaf.writeInt(numRows);
                matrixRaf.writeInt(curCol);
                matrixRaf.writeInt(nonZeroValues);
                matrixRaf.close();

            } catch (IOException ioe) {
                throw new IOError(ioe);
            }

            // If the user specified that the matrix should be tranposed, then
            // transposedMatrixFile will contain the matrix in its un-transposed
            // form.  Issue a call to SVDLIBC to transposed the file contents
            // for us.
            if (transposeData) {
                boolean svdlibcFailed = false;
                try {                    
                    String commandLine = "svd  -r sb " + " -w sb -t -c " 
                        + transposedMatrixFile + " " + matrixFile;
                    Process svdlibc = Runtime.getRuntime().exec(commandLine);
                    LOGGER.fine("transposing svdlibc sparse matrix: " + commandLine);
                    BufferedReader stdout = new BufferedReader(
                        new InputStreamReader(svdlibc.getInputStream()));
                    BufferedReader stderr = new BufferedReader(
                        new InputStreamReader(svdlibc.getErrorStream()));
                    
                    StringBuilder output = new StringBuilder("SVDLIBC output:\n");
                    for (String line = null; (line = stderr.readLine()) != null; ) {
                        output.append(line).append("\n");
                    }
                    LOGGER.fine(output.toString());
                    
                    int exitStatus = svdlibc.waitFor();
                    LOGGER.fine("svdlibc exit status: " + exitStatus);
                    if (exitStatus != 0) {
                        StringBuilder sb = new StringBuilder();
                        for (String line = null; (line = stderr.readLine()) != null; ) {
                            sb.append(line).append("\n");
                        }
                        // warning or error?
                        LOGGER.warning("svdlibc exited with error status.  " + 
                                       "stderr:\n" + sb.toString());
                        svdlibcFailed = true;
                    } 
                }
                catch (Exception e) {
                    svdlibcFailed = true;
                    LOGGER.log(Level.WARNING,
                               "an exception occurred when trying to transpose " + 
                               "with svdlibc; retrying with Java code", e);
                }
                // If SVDLIBC failed in any way, use MatrixIO to transpose the
                // data for us.
                if (svdlibcFailed) {
                    LOGGER.fine("retrying failed svdlibc transpose " + 
                                "with MatrixIO transpose");
                    try {
                        matrixFile = MatrixIO.convertFormat(
                            transposedMatrixFile, Format.SVDLIBC_SPARSE_BINARY,
                            Format.SVDLIBC_SPARSE_BINARY, true);
                    } catch (IOException ioe) {
                        throw new IOError(ioe);
                    }
                }
            }
        }
    }
1270730
@Override
  public void run() {
    List<CompactionVerifier> verifiers = this.suite.getMapReduceVerifiers();
    for (CompactionVerifier verifier : verifiers) {
      if (!verifier.verify(dataset).isSuccessful()) {
        log.error("Verification {} for {} is not passed.", verifier.getName(), dataset.datasetURN());
        this.onMRTaskComplete (false, new IOException("Compaction verification for MR is failed"));
        return;
      }
    }

    super.run();
  }
1323209
private void finalizeCEs() {
        CollationDataBuilder newBuilder = new CollationDataBuilder();
        newBuilder.initForTailoring(baseData);
        CEFinalizer finalizer = new CEFinalizer(nodes.getBuffer());
        newBuilder.copyFrom(dataBuilder, finalizer);
        dataBuilder = newBuilder;
    }
871936
public void close() {
		stopFetching = true;
		if(rowFetcher != null)
			rowFetcher.interrupt();
		try {
			results.close();
		} catch (OWLException e) {
			// TODO: Handle this in a reasonable manner
			System.out.println(e);
		}
	}
223357
public void finish() throws SQLException{
		Statement statement = connection.createStatement();
		statement.execute("CREATE INDEX articleIdx on revisions(ArticleID);");
		statement.close();
		statement = connection.createStatement();
		statement.execute("ALTER TABLE index_articleID_rc_ts ENABLE KEYS;");
		statement.close();
		statement = connection.createStatement();
		statement.execute("ALTER TABLE index_revisionID ENABLE KEYS;");
		statement.close();
		statement = connection.createStatement();
		statement.execute("ALTER TABLE index_chronological ENABLE KEYS;");
		statement.close();
	}
1207465
public void finish() throws IOException {
    if (finished) {
      return;
    }
    finished = true;
    sum.writeValue(barray, 0, false);
    out.write (barray, 0, sum.getChecksumSize());
    out.flush();
  }
997431
@Override
    public void save(Collection<T> items) {
        for (T item : items) {
            save(item);
        }
    }
495001
def freeze(self):
        """"""
        self.in_connections = frozenset(self.in_connections)
        self.out_connections = frozenset(self.out_connections)
833499
public function collections(array $collections) : void {
        foreach ($collections as $name => $callback) {
            $this->make($name, $callback);
        }
    }
1131979
@Override
	public void execute() {
		if (this.batches.isEmpty())
			return;
		
		// Reset the collection before making the call to eliminate callback chatter when
		// the batches call back to the master.
		List<Batch> old = this.batches;
		
		// Reset our batches
		this.batches = new ArrayList<Batch>();
		this.queryBatch = null;
		
		for (Batch batch: old) {
			batch.execute();
		}
	}
618885
@SuppressWarnings("unchecked")
	protected void executeOnCollections(List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
		OutputFormat<IN> format = this.formatWrapper.getUserCodeObject();
		TypeInformation<IN> inputType = getInput().getOperatorInfo().getOutputType();

		if (this.localOrdering != null) {
			int[] sortColumns = this.localOrdering.getFieldPositions();
			boolean[] sortOrderings = this.localOrdering.getFieldSortDirections();

			final TypeComparator<IN> sortComparator;
			if (inputType instanceof CompositeType) {
				sortComparator = ((CompositeType<IN>) inputType).createComparator(sortColumns, sortOrderings, 0, executionConfig);
			} else if (inputType instanceof AtomicType) {
				sortComparator = ((AtomicType<IN>) inputType).createComparator(sortOrderings[0], executionConfig);
			} else {
				throw new UnsupportedOperationException("Local output sorting does not support type "+inputType+" yet.");
			}

			Collections.sort(inputData, new Comparator<IN>() {
				@Override
				public int compare(IN o1, IN o2) {
					return sortComparator.compare(o1, o2);
				}
			});
		}

		if(format instanceof InitializeOnMaster) {
			((InitializeOnMaster)format).initializeGlobal(1);
		}
		format.configure(this.parameters);

		if(format instanceof RichOutputFormat){
			((RichOutputFormat<?>) format).setRuntimeContext(ctx);
		}
		format.open(0, 1);
		for (IN element : inputData) {
			format.writeRecord(element);
		}
		
		format.close();
		
		if(format instanceof FinalizeOnMaster) {
			((FinalizeOnMaster)format).finalizeGlobal(1);
		}
	}
1201754
private void processPredecessors() throws SQLException
   {
      List<Row> rows = getRows("select * from " + m_schema + "taskpred where proj_id=? and delete_date is null", m_projectID);
      m_reader.processPredecessors(rows);
   }
274541
void closeResultData() throws SQLException {

        if (currentResultSet != null) {
            currentResultSet.close();
        }

        if (generatedResultSet != null) {
            generatedResultSet.close();
        }
        generatedResultSet = null;
        generatedResult    = null;
        resultIn           = null;
    }
1326224
private void processPredecessors() throws SQLException
   {
      List<Row> rows = getTable("LINK");
      List<Row> completedSections = getTable("TASK_COMPLETED_SECTION");
      Collections.sort(rows, LINK_COMPARATOR);
      m_reader.processPredecessors(rows, completedSections);
   }
83330
public void close() {

        // result set
        if (m_resultset != null) {
            try {
                m_resultset.close();
            } catch (Exception e) {
                e.printStackTrace();

            }
        }
        // statement
        if (m_statement != null) {
            try {
                m_statement.close();
            } catch (Exception e) {
                e.printStackTrace();

            }
        }
        // prepared statement
        if (m_preparedStatement != null) {
            try {
                m_preparedStatement.close();
            } catch (Exception e) {
                e.printStackTrace();

            }
        }

    }