Package com.orientechnologies.common.concur.resource

Examples of com.orientechnologies.common.concur.resource.OSharedResourceExternal


public class LockSpeedTest {
  private static final long  MAX  = 10000000;

  public static final void main(String[] args) {

    OSharedResourceExternal lock = new OSharedResourceExternal();

    long timer = System.currentTimeMillis();
    for (int i = 0; i < MAX; ++i) {
    }
    final long fixed = System.currentTimeMillis() - timer;

    for (int i = 0; i < MAX; ++i) {
      lock.acquireSharedLock();
      lock.releaseSharedLock();
    }

    System.out.println("Read Locks: " + (System.currentTimeMillis() - timer - fixed));
    timer = System.currentTimeMillis();

    for (int i = 0; i < MAX; ++i) {
      lock.acquireExclusiveLock();
      lock.releaseExclusiveLock();
    }

    System.out.println("Write Locks: " + (System.currentTimeMillis() - timer - fixed));
    timer = System.currentTimeMillis();
View Full Code Here


public class LockSpeedTest {
  private static final long MAX = 10000000;

  public static final void main(String[] args) {

    OSharedResourceExternal lock = new OSharedResourceExternal();
    OModificationLock storageLock = new OModificationLock();

    long timer = System.currentTimeMillis();
    for (int i = 0; i < MAX; ++i) {
    }
    final long fixed = System.currentTimeMillis() - timer;

    for (int i = 0; i < MAX; ++i) {
      lock.acquireSharedLock();
      lock.releaseSharedLock();
    }

    System.out.println("Read Locks: " + (System.currentTimeMillis() - timer - fixed));
    timer = System.currentTimeMillis();

    for (int i = 0; i < MAX; ++i) {
      lock.acquireExclusiveLock();
      lock.releaseExclusiveLock();
    }

    System.out.println("Write Locks: " + (System.currentTimeMillis() - timer - fixed));
    timer = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of com.orientechnologies.common.concur.resource.OSharedResourceExternal

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.