Package com.sun.sgs.test.util

Examples of com.sun.sgs.test.util.DummyTransaction


      public void abort(boolean retryable) { }
      public void commit() { }
        };
    }
      };
  DummyTransaction txn = new DummyTransaction(
      DummyTransaction.UsePrepareAndCommit.NO);
  txnProxy.setCurrentTransaction(txn);
  contextFactory.joinTransaction();
  txn.commit();
  txn = new DummyTransaction();
  txnProxy.setCurrentTransaction(txn);
  contextFactory.joinTransaction();
  txn.commit();
    }
View Full Code Here


    /* -- Other methods and classes -- */

    /** Creates a transaction. */
    protected static DummyTransaction createTransaction() {
  DummyTransaction txn = new DummyTransaction(timeoutSuccess);
  txnProxy.setCurrentTransaction(txn);
  accessCoordinator.notifyNewTransaction(txn, 0, 1);
  return txn;
    }
View Full Code Here

    /** Creates a transaction with explicit use of prepareAndCommit. */
    static DummyTransaction createTransaction(
  UsePrepareAndCommit usePrepareAndCommit)
    {
  return initTransaction(new DummyTransaction(usePrepareAndCommit));
    }
View Full Code Here

     */
    static DummyTransaction createTransaction(
  UsePrepareAndCommit usePrepareAndCommit, long timeout)
    {
  return initTransaction(
      new DummyTransaction(usePrepareAndCommit, timeout));
    }
View Full Code Here

    @Test
    public void testReadIds() throws Exception {
  byte[] data = new byte[itemSize];
  data[0] = 1;
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  long[] ids = new long[items];
  for (int i = 0; i < items; i++) {
      ids[i] = store.createObject(txn);
      store.setObject(txn, ids[i], data);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        store.getObject(txn, ids[i], false);
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

    @Test
    public void testReadIdsForUpdate() throws Exception {
  byte[] data = new byte[itemSize];
  data[0] = 1;
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  long[] ids = new long[items];
  for (int i = 0; i < items; i++) {
      ids[i] = store.createObject(txn);
      store.setObject(txn, ids[i], data);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        store.getObject(txn, ids[i], true);
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

    @Test
    public void testMarkIdsForUpdate() throws Exception {
  byte[] data = new byte[itemSize];
  data[0] = 1;
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  long[] ids = new long[items];
  for (int i = 0; i < items; i++) {
      ids[i] = store.createObject(txn);
      store.setObject(txn, ids[i], data);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        store.getObject(txn, ids[i], false);
        store.markForUpdate(txn, ids[i]);
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

  props.setProperty(
      JeEnvironment.FLUSH_TO_DISK_PROPERTY, String.valueOf(flush));
  byte[] data = new byte[itemSize];
  data[0] = 1;
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  long[] ids = new long[items];
  for (int i = 0; i < items; i++) {
      ids[i] = store.createObject(txn);
      store.setObject(txn, ids[i], data);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        boolean update = i < modifyItems;
        byte[] result = store.getObject(txn, ids[i], update);
        if (update) {
      result[0] ^= 1;
      store.setObject(txn, ids[i], result);
        }
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

    }

    @Test
    public void testReadNames() throws Exception {
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  for (int i = 0; i < items; i++) {
      store.setBinding(txn, "name" + i, i);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        store.getBinding(txn, "name" + i);
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

    }

    @Test
    public void testWriteNames() throws Exception {
  store = getDataStore();
  DummyTransaction txn = createTransaction(1000);
  for (int i = 0; i < items; i++) {
      store.setBinding(txn, "name" + i, i);
  }
  txn.commit();
  for (int r = 0; r < repeat; r++) {
      long start = System.currentTimeMillis();
      for (int c = 0; c < count; c++) {
    txn = createTransaction(1000);
    for (int i = 0; i < items; i++) {
        boolean update = i < modifyItems;
        long result = store.getBinding(txn, "name" + i);
        if (update) {
      store.setBinding(txn, "name" + i, result + 1);
        }
    }
    txn.commit();
      }
      long stop = System.currentTimeMillis();
      System.err.println(
    "Time: " + (stop - start) / (float) count +
    " ms per transaction");
View Full Code Here

TOP

Related Classes of com.sun.sgs.test.util.DummyTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.