@Override public void applySlotChanges( Visitable<SlotChange> slotChangeTree, int slotChangeCount, Slot reservedSlot) { if (slotChangeCount < 1) { return; } Runnable commitHook = _container.commitHook(); flushDatabaseFile(); ensureLogAndLock(); int length = transactionLogSlotLength(slotChangeCount); ByteArrayBuffer logBuffer = new ByteArrayBuffer(length); logBuffer.writeInt(length); logBuffer.writeInt(slotChangeCount); appendSlotChanges(logBuffer, slotChangeTree); write(_logFile, logBuffer); _logFile.sync(); writeToLockFile(LOCK_INT); writeSlots(slotChangeTree); commitHook.run(); flushDatabaseFile(); writeToLockFile(0); }
private void writeToLockFile(int lockSignal) { ByteArrayBuffer lockBuffer = newLockFileBuffer(); lockBuffer.writeInt(lockSignal); lockBuffer.writeInt(lockSignal); write(_lockFile, lockBuffer); _lockFile.sync(); }
public void writePointer(int id, Slot slot) { if (DTrace.enabled) { DTrace.WRITE_POINTER.log(id); DTrace.WRITE_POINTER.logLength(slot); } _pointerIo.seek(0); if (Deploy.debug) { _pointerIo.writeBegin(Const4.YAPPOINTER); } _pointerIo.writeInt(slot.address()); _pointerIo.writeInt(slot.length()); if (Deploy.debug) { _pointerIo.writeEnd(); } if (Debug4.xbytes) { _pointerIo.checkXBytes(false); } writeBytes(_pointerIo, id, 0); }