/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
/** * Queues up a page write that should get done when commit() gets called. */ private void write(final Page page, byte[] data) throws IOException { Long key = page.getPageId(); // how much pages we have for this transaction size = writes.size() * pageFile.getPageSize(); PageWrite write; if (size > maxTransactionSize) { if (tmpFile == null) { tmpFile = new RandomAccessFile(getTempFile(), "rw"); } long location = nextLocation; tmpFile.seek(nextLocation); tmpFile.write(data); nextLocation = location + data.length; write = new PageWrite(page, location, data.length, getTempFile()); } else { write = new PageWrite(page, data); } writes.put(key, write); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }
@SuppressWarnings("unchecked") private <T> void write(Page<T> page, byte[] data) throws IOException { final PageWrite write = new PageWrite(page, data); Entry<Long, PageWrite> entry = new Entry<Long, PageWrite>() { @Override public Long getKey() { return write.getPage().getPageId(); } @Override public PageWrite getValue() { return write; } @Override public PageWrite setValue(PageWrite value) { return null; } }; Entry<Long, PageWrite>[] entries = new Map.Entry[]{entry}; write(Arrays.asList(entries)); }