/** * 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); }
/** * Rolls back the transaction. */ public void rollback() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Release the pages that were allocated in the transaction... freePages(allocateList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Commits the transaction to the PageFile as a single 'Unit of Work'. Either all page updates associated * with the transaction are written to disk or none will. */ public void commit() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Actually do the page writes... pageFile.write(writes.entrySet()); // Release the pages that were freed up in the transaction.. freePages(freeList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * 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); }
/** * Rolls back the transaction. */ public void rollback() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Release the pages that were allocated in the transaction... freePages(allocateList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Rolls back the transaction. */ public void rollback() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Release the pages that were allocated in the transaction... freePages(allocateList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Commits the transaction to the PageFile as a single 'Unit of Work'. Either all page updates associated * with the transaction are written to disk or none will. */ public void commit() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Actually do the page writes... pageFile.write(writes.entrySet()); // Release the pages that were freed up in the transaction.. freePages(freeList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Rolls back the transaction. */ public void rollback() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Release the pages that were allocated in the transaction... freePages(allocateList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Commits the transaction to the PageFile as a single 'Unit of Work'. Either all page updates associated * with the transaction are written to disk or none will. */ public void commit() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Actually do the page writes... pageFile.write(writes.entrySet()); // Release the pages that were freed up in the transaction.. freePages(freeList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }
/** * Commits the transaction to the PageFile as a single 'Unit of Work'. Either all page updates associated * with the transaction are written to disk or none will. */ public void commit() throws IOException { if( writeTransactionId!=-1 ) { if (tmpFile != null) { tmpFile.close(); pageFile.removeTmpFile(getTempFile()); tmpFile = null; txFile = null; } // Actually do the page writes... pageFile.write(writes.entrySet()); // Release the pages that were freed up in the transaction.. freePages(freeList); freeList.clear(); allocateList.clear(); writes.clear(); writeTransactionId = -1; } else { freePages(allocateList); } size = 0; }