private void databaseCorruptionDetected() throws IndexException { String msg = "Corrupted database: " + this.fLocation.getName(); //$NON-NLS-1$ throw new IndexException(new DBStatus(msg)); }
private void databaseCorruptionDetected() throws IndexException { String msg = "Corrupted database: " + this.fLocation.getName(); //$NON-NLS-1$ throw new IndexException(new DBStatus(msg)); }
void read() throws IndexException { try { final ByteBuffer buf= ByteBuffer.wrap(this.fBuffer); this.fDatabase.read(buf, (long) this.fSequenceNumber * Database.CHUNK_SIZE); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } }
void read() throws IndexException { try { final ByteBuffer buf= ByteBuffer.wrap(this.fBuffer); this.fDatabase.read(buf, (long) this.fSequenceNumber * Database.CHUNK_SIZE); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } }
private boolean markFileIncomplete() throws IndexException { boolean wasInterrupted = false; if (!this.fIsMarkedIncomplete) { this.fIsMarkedIncomplete= true; try { final ByteBuffer buf= ByteBuffer.wrap(new byte[4]); wasInterrupted = performUninterruptableWrite(() -> this.fFile.getChannel().write(buf, 0)); this.bytesWritten += 4; } catch (IOException e) { throw new IndexException(new DBStatus(e)); } } return wasInterrupted; }
private boolean markFileIncomplete() throws IndexException { boolean wasInterrupted = false; if (!this.fIsMarkedIncomplete) { this.fIsMarkedIncomplete= true; try { final ByteBuffer buf= ByteBuffer.wrap(new byte[4]); wasInterrupted = performUninterruptableWrite(() -> this.fFile.getChannel().write(buf, 0)); this.bytesWritten += 4; } catch (IOException e) { throw new IndexException(new DBStatus(e)); } } return wasInterrupted; }
/** * Uninterruptable. Returns true iff an attempt was made to interrupt the flush with * {@link Thread#interrupt()}. */ boolean flush() throws IndexException { if (Database.DEBUG_PAGE_CACHE) { System.out.println( "CHUNK " + this.fSequenceNumber + ": flushing - instance " + System.identityHashCode(this)); //$NON-NLS-1$//$NON-NLS-2$ } boolean wasCanceled = false; try { final ByteBuffer buf= ByteBuffer.wrap(this.fBuffer); wasCanceled = this.fDatabase.write(buf, (long) this.fSequenceNumber * Database.CHUNK_SIZE); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } this.fDirty = false; this.fDatabase.chunkCleaned(this); return wasCanceled; }
/** * Uninterruptable. Returns true iff an attempt was made to interrupt the flush with * {@link Thread#interrupt()}. */ boolean flush() throws IndexException { if (Database.DEBUG_PAGE_CACHE) { System.out.println( "CHUNK " + this.fSequenceNumber + ": flushing - instance " + System.identityHashCode(this)); //$NON-NLS-1$//$NON-NLS-2$ } boolean wasCanceled = false; try { final ByteBuffer buf= ByteBuffer.wrap(this.fBuffer); wasCanceled = this.fDatabase.write(buf, (long) this.fSequenceNumber * Database.CHUNK_SIZE); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } this.fDirty = false; this.fDatabase.chunkCleaned(this); return wasCanceled; }
/** * Closes the database. * <p> * The behavior of any further calls to the Database is undefined * @throws IndexException */ public void close() throws IndexException { assert this.fExclusiveLock; flush(); removeChunksFromCache(); this.log.clear(); // Chunks have been removed from the cache, so we are fine. this.fHeaderChunk.clear(0, CHUNK_SIZE); this.memoryUsage.refresh(); this.fHeaderChunk.fDirty= false; this.dirtyChunkSet.clear(); this.fChunks= new Chunk[] { null }; this.fChunksUsed = this.fChunks.length; try { this.fFile.close(); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } }
/** * Closes the database. * <p> * The behavior of any further calls to the Database is undefined * @throws IndexException */ public void close() throws IndexException { assert this.fExclusiveLock; flush(); removeChunksFromCache(); this.log.clear(); // Chunks have been removed from the cache, so we are fine. this.fHeaderChunk.clear(0, CHUNK_SIZE); this.memoryUsage.refresh(); this.fHeaderChunk.fDirty= false; this.dirtyChunkSet.clear(); this.fChunks= new Chunk[] { null }; this.fChunksUsed = this.fChunks.length; try { this.fFile.close(); } catch (IOException e) { throw new IndexException(new DBStatus(e)); } }
throw new IndexException(new DBStatus(e));
throw new IndexException(new DBStatus(e));
throw new IndexException(new DBStatus(e));
throw new IndexException(new DBStatus(e));