@Override public void run() { for (int i = 0; i < 5000; i++) { for (int rdr = 0; rdr < addrs.length; rdr++) { bs.read(addrs[r.nextInt(addrs.length)]); } try { Thread.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } } };
@Override public void run() { for (int i = 0; i < 5000; i++) { for (int rdr = 0; rdr < addrs.length; rdr++) { bs.read(addrs[r.nextInt(addrs.length)]); } try { Thread.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } } };
@Override public void run() { for (int i = 0; i < 5000; i++) { for (int rdr = 0; rdr < addrs.length; rdr++) { bs.read(addrs[r.nextInt(addrs.length)]); } try { Thread.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } } };
@Override public void run() { for (int i = 0; i < 5000; i++) { for (int rdr = 0; rdr < addrs.length; rdr++) { bs.read(addrs[r.nextInt(addrs.length)]); } try { Thread.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } } };
long old = addr[i]; try { bs.read(old); } catch (Exception e) { throw new RuntimeException("problem handling read: " + i + " in test: " + t + " from address: "
long old = addr[i]; try { bs.read(old); } catch (Exception e) { throw new RuntimeException("problem handling read: " + i + " in test: " + t + " from address: "
final ByteBuffer b = bufferStrategy.read(addr);
final ByteBuffer b = bufferStrategy.read(addr);
/** * Tests whether tasks are able to access and modify data safely by * emulating transactions by calling activateTx and deactivateTx * directly. */ public void test_sessionProtection() { // Sequential logic final Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); final byte[] buf = new byte[300]; // Just some data r.nextBytes(buf); final ByteBuffer bb = ByteBuffer.wrap(buf); long faddr = bs.write(bb); // rw.alloc(buf, buf.length); IRawTx tx = rw.newTx(); bs.delete(faddr); // delettion protected by session bb.position(0); final ByteBuffer rdBuf = bs.read(faddr); // should be able to successfully read from freed address assertEquals(bb, rdBuf); tx.close(); store.commit(); } finally { store.destroy(); } }
/** * Tests whether tasks are able to access and modify data safely by * emulating transactions by calling activateTx and deactivateTx * directly. */ public void test_sessionProtection() { // Sequential logic final Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); final byte[] buf = new byte[300]; // Just some data r.nextBytes(buf); final ByteBuffer bb = ByteBuffer.wrap(buf); long faddr = bs.write(bb); // rw.alloc(buf, buf.length); IRawTx tx = rw.newTx(); bs.delete(faddr); // delettion protected by session bb.position(0); final ByteBuffer rdBuf = bs.read(faddr); // should be able to successfully read from freed address assertEquals(bb, rdBuf); tx.close(); store.commit(); } finally { store.destroy(); } }
bs.read(addr2); fail("Exception expected"); } catch (IllegalArgumentException e) {
bs.read(addr2); fail("Exception expected"); } catch (IllegalArgumentException e) {
bs.read(addr2); fail("Exception expected"); } catch (IllegalArgumentException e) {
bs.read(addr2); fail("Exception expected"); } catch (IllegalArgumentException e) {
bs.read(addr3); fail("Exception expected"); } catch (IllegalArgumentException e) {
bs.read(addr3); fail("Exception expected"); } catch (IllegalArgumentException e) {