output.writeMessage(11, getInodeFile());
.computeMessageSize(11, getInodeFile());
private void inodeLockTest(LockMode take, LockMode tryToTake, boolean expectBlocking) throws Exception { InodeLockManager lockManager = new InodeLockManager(); AtomicBoolean threadFinished = new AtomicBoolean(false); MutableInodeFile inode = MutableInodeFile.create(0, 0, "name", 0, CreateFileContext.defaults()); LockResource lock = lockManager.lockInode(inode, take); Thread t = new Thread(() -> { // Copy the inode to make sure we aren't comparing inodes by reference. MutableInodeFile inodeCopy = MutableInodeFile.fromJournalEntry(inode.toJournalEntry().getInodeFile()); try (LockResource lr = lockManager.lockInode(inodeCopy, tryToTake)) { threadFinished.set(true); } }); t.start(); if (expectBlocking) { CommonUtils.sleepMs(20); assertFalse(threadFinished.get()); lock.close(); } CommonUtils.waitFor("lock to be acquired by the second thread", () -> threadFinished.get()); }
@Override public void processJournalEntry(JournalEntry entry) throws IOException { if (entry.hasInodeFile()) { mInodeTree.addInodeFileFromJournal(entry.getInodeFile()); InodeFileEntry inodeFileEntry = entry.getInodeFile(); if (inodeFileEntry.hasTtl()) { mTtlBuckets.insert(InodeFile.fromJournalEntry(inodeFileEntry));
mergeInodeFile(other.getInodeFile());
result = result && getInodeFile() .equals(other.getInodeFile());
hash = (53 * hash) + getInodeFile().hashCode();
mergeInodeFile(other.getInodeFile());
apply(entry.getInodeDirectory()); } else if (entry.hasInodeFile()) { apply(entry.getInodeFile()); } else if (entry.hasNewBlock()) { apply(entry.getNewBlock());