/** Initialize the scan, returning false if there was some error. */ public boolean init(TransactionManager tran) throws StandardException { if (SanityManager.DEBUG) { // We really expect to have at least one // merge run. SanityManager.ASSERT(mergeRuns != null); SanityManager.ASSERT(mergeRuns.size() > 0); // This sort scan also expects that the // caller has ensured that the sort buffer // capacity will hold a row from all the // merge runs. SanityManager.ASSERT(sortBuffer.capacity() >= mergeRuns.size()); } // Clear the sort buffer. sortBuffer.reset(); // Create an array to hold a scan controller // for each merge run. openScans = new StreamContainerHandle[mergeRuns.size()]; if (openScans == null) return false; // Open a scan on each merge run. int scanindex = 0; Enumeration e = mergeRuns.elements(); while (e.hasMoreElements()) { // get the container id long id = ((Long) e.nextElement()).longValue(); Transaction rawTran = tran.getRawStoreXact(); // get raw transaction int segmentId = StreamContainerHandle.TEMPORARY_SEGMENT; openScans[scanindex++] = rawTran.openStreamContainer(segmentId, id, hold); } // Load the initial rows. for (scanindex = 0; scanindex < openScans.length; scanindex++) mergeARow(scanindex); // Success! return true; }