/** * Reduces the file down to an empty tree. * * @throws IOException If an I/O error occurs. */ public void clear() throws IOException { avlBlockFile.clear(); }
/** * Close the file. * * @throws IOException If an I/O error occurs. */ public synchronized void close() throws IOException { if (avlBlockFile != null) { avlBlockFile.close(); } }
/** * Deletes the file. * * @throws IOException If and I/O error occurs. */ public synchronized void delete() throws IOException { try { if (avlBlockFile != null) { avlBlockFile.delete(); } } finally { avlBlockFile = null; } }
/** * Wait until all data has been written to the file. * * @throws IOException If an I/O error occurs. */ public void force() throws IOException { avlBlockFile.force(); }
/** * Unmaps the file. This will have no effect if the file is not mapped. */ public synchronized void unmap() { if (avlBlockFile != null) { avlBlockFile.unmap(); } }
/** * Creates a new block file which contains an AVL tree. * * @param objectPool An existing object pool to get blocks from. * @param file A {@link java.io.File} object giving the details of the file. * @param payloadSize Size of the payload in longs. Must be at least 1. * @throws IOException If an i/o error occurs. */ public AVLFile( ObjectPool objectPool, File file, int payloadSize ) throws IOException { if (payloadSize < 1) { throw new IllegalArgumentException("payloadSize is less than 1"); } avlBlockFile = new ManagedBlockFile( objectPool, file, (AVLNode.HEADER_SIZE + payloadSize) * Constants.SIZEOF_LONG, BlockFile.IOType.MAPPED ); this.payloadSize = payloadSize; }
blockFiles[i].force();
for (int i = 0; i < NR_BLOCK_FILES; ++i) { if (blockFiles[i] != null) { blockFiles[i].unmap();
blockFiles[i] = new ManagedBlockFile( writerObjectPool, fileName + ".sp_" + num, blockSize, blockSize > MappedBlockFile.REGION_SIZE ?
/** * Closes and deletes the block file. * * @throws IOException if an I/O error occurs. */ public synchronized void delete() throws IOException { try { close(true); } finally { blockFile = null; freeList = null; } }
/** * METHOD TO DO * * @param phaseNumber PARAMETER TO DO * @throws IOException EXCEPTION TO DO * @throws SimpleXAResourceException EXCEPTION TO DO */ public synchronized void clear( int phaseNumber ) throws IOException, SimpleXAResourceException { if (currentPhase != null) { throw new IllegalStateException( "StringPool already has a current phase." ); } openMetarootFile(true); synchronized (committedPhaseLock) { committedPhaseToken = new Phase().use(); } this.phaseNumber = phaseNumber; phaseIndex = 1; avlFile.clear(); gNodeToDataFile.clear(); for (int i = 0; i < NR_BLOCK_FILES; ++i) { blockFiles[i].clear(); } new Phase(); }
/** * Closes the block file. * * @throws IOException if an I/O error occurs. */ public synchronized void close() throws IOException { close(false); }