@Override public void forceMoveNextFile() throws Exception { debugWait(); journalLock.writeLock().lock(); try { moveNextFile(false); } finally { journalLock.writeLock().unlock(); } }
@Override public void forceMoveNextFile() throws Exception { debugWait(); journalLock.writeLock().lock(); try { moveNextFile(false); } finally { journalLock.writeLock().unlock(); } }
/** * @param size * @return * @throws Exception */ protected JournalFile switchFileIfNecessary(int size) throws Exception { // We take into account the fileID used on the Header if (size > fileSize - currentFile.getFile().calculateBlockStart(JournalImpl.SIZE_HEADER)) { throw new IllegalArgumentException("Record is too large to store " + size); } try { if (!currentFile.getFile().fits(size)) { moveNextFile(true); // The same check needs to be done at the new file also if (!currentFile.getFile().fits(size)) { // Sanity check, this should never happen throw new IllegalStateException("Invalid logic on buffer allocation"); } } return currentFile; } catch (Throwable e) { criticalIO(e); return null; // this will never happen, the method will call throw } }
/** * @param size * @return * @throws Exception */ protected JournalFile switchFileIfNecessary(int size) throws Exception { // We take into account the fileID used on the Header if (size > fileSize - currentFile.getFile().calculateBlockStart(JournalImpl.SIZE_HEADER)) { throw new IllegalArgumentException("Record is too large to store " + size); } try { if (!currentFile.getFile().fits(size)) { moveNextFile(true); // The same check needs to be done at the new file also if (!currentFile.getFile().fits(size)) { // Sanity check, this should never happen throw new IllegalStateException("Invalid logic on buffer allocation"); } } return currentFile; } catch (Throwable e) { criticalIO(e); return null; // this will never happen, the method will call throw } }