Java Code Examples for com.bigdata.journal.Journal#close()
The following examples show how to use
com.bigdata.journal.Journal#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMemStore.java From database with GNU General Public License v2.0 | 5 votes |
/** * Can be tested by removing RWStore call to journal.removeCommitRecordEntries * in freeDeferrals. * * final int commitPointsRemoved = journal.removeCommitRecordEntries(fromKey, toKey); * * replaced with * * final int commitPointsRemoved = commitPointsRecycled; * */ public void testVerifyCommitRecordIndex() { final Properties properties = new Properties(getProperties()); properties.setProperty( AbstractTransactionService.Options.MIN_RELEASE_AGE, "400"); final Journal store = getJournal(properties); try { MemStrategy bs = (MemStrategy) store.getBufferStrategy(); for (int r = 0; r < 10; r++) { ArrayList<Long> addrs = new ArrayList<Long>(); for (int i = 0; i < 100; i++) { addrs.add(bs.write(randomData(45))); } store.commit(); for (long addr : addrs) { bs.delete(addr); } store.commit(); } // Age the history (of the deletes!) Thread.currentThread().sleep(400); verifyCommitIndex(store, 20); store.close(); } catch (InterruptedException e) { } finally { store.destroy(); } }
Example 2
Source File: TestRWJournal.java From database with GNU General Public License v2.0 | 5 votes |
/** * Can be tested by removing RWStore call to journal.removeCommitRecordEntries * in freeDeferrals. * * final int commitPointsRemoved = journal.removeCommitRecordEntries(fromKey, toKey); * * replaced with * * final int commitPointsRemoved = commitPointsRecycled; * */ public void testVerifyCommitRecordIndex() { final Properties properties = new Properties(getProperties()); properties.setProperty( AbstractTransactionService.Options.MIN_RELEASE_AGE, "100"); final Journal store = (Journal) getStore(properties); try { RWStrategy bs = (RWStrategy) store.getBufferStrategy(); for (int r = 0; r < 10; r++) { ArrayList<Long> addrs = new ArrayList<Long>(); for (int i = 0; i < 100; i++) { addrs.add(bs.write(randomData(45))); } store.commit(); for (long addr : addrs) { bs.delete(addr); } store.commit(); // Age the history (of the deletes!) Thread.currentThread().sleep(200); } final String fname = bs.getStore().getStoreFile().getAbsolutePath(); store.close(); VerifyCommitRecordIndex.main(new String[]{fname}); } catch (InterruptedException e) { } finally { store.destroy(); } }
Example 3
Source File: TestRWJournal.java From database with GNU General Public License v2.0 | 5 votes |
public void testResetHARootBlock() { final Properties properties = new Properties(getProperties()); final Journal store = (Journal) getStore(properties); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); for (int r = 0; r < 10; r++) { ArrayList<Long> addrs = new ArrayList<Long>(); for (int i = 0; i < 1000; i++) { addrs.add(bs.write(randomData(2048))); } store.commit(); final StorageStats stats1 = rw.getStorageStats(); rw.resetFromHARootBlock(store.getRootBlockView()); final StorageStats stats2 = rw.getStorageStats(); // Now check that we can read all allocations after reset for (long addr : addrs) { store.read(addr); } } final String fname = bs.getStore().getStoreFile().getAbsolutePath(); store.close(); } finally { store.destroy(); } }
Example 4
Source File: TestRWJournal.java From database with GNU General Public License v2.0 | 5 votes |
public void testSimpleReset() { final Properties properties = new Properties(getProperties()); final Journal store = (Journal) getStore(properties); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); for (int r = 0; r < 10; r++) { ArrayList<Long> addrs = new ArrayList<Long>(); for (int i = 0; i < 1000; i++) { addrs.add(bs.write(randomData(2048))); } rw.reset(); } final String fname = bs.getStore().getStoreFile().getAbsolutePath(); store.close(); } finally { store.destroy(); } }
Example 5
Source File: MetabitsUtil.java From database with GNU General Public License v2.0 | 5 votes |
/** * Example usage: * * <pre> * MatabitsUtil -store "/path/store.jnl" -usedemispace true * </pre> */ static public void main(final String[] args) { final String store = getArg(args, "-store", null); if (store == null) { System.err.println("file must be specificed with -store"); return; } final File file = new File(store); if (!file.exists()) { System.err.println("Specified file '" + store + "' not found"); return; } final boolean usedemi = "true".equals(getArg(args, "-usedemispace", "true")); final Journal jnl = getStore(store); try { final RWStore rws = ((RWStrategy) jnl.getBufferStrategy()) .getStore(); if (rws.ensureMetabitsDemispace(usedemi)) { // changed jnl.commit(); } } finally { jnl.close(); } }