Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.Lock.unlock()


        Lock lock = readWriteLock.readLock();

        for (int i = 0; i < 100000; i++) {
            lock.lock();
            int degree = singleNode.getEdgesInTree().getCount() + singleNode.getEdgesOutTree().getCount();
            lock.unlock();
        }
    }

    @Test
    public void testWithGlobalLocking() {
View Full Code Here


        lock.lock();
        for (int i = 0; i < 100000; i++) {
            lock.lock();
            int degree = singleNode.getEdgesInTree().getCount() + singleNode.getEdgesOutTree().getCount();
            lock.unlock();
        }
        lock.unlock();
    }

    @Test
View Full Code Here

        for (int i = 0; i < 100000; i++) {
            lock.lock();
            int degree = singleNode.getEdgesInTree().getCount() + singleNode.getEdgesOutTree().getCount();
            lock.unlock();
        }
        lock.unlock();
    }

    @Test
    public void testWithSimpleLocking() {
View Full Code Here

        if (isLeaf || value == FAIL)
          return value;
        else
          return lookup(keyBuffer, keyOffset, keyLength, value);
      } finally {
        blockLock.unlock();
      }
    } finally {
      block.free();
    }
  }
View Full Code Here

      return insert(keyBuffer, keyOffset, keyLength,
                    value, isOverride, true,
                    childBlockId);
    } finally {
      blockLock.unlock();
    }
  }

  private boolean insertWriteChild(byte []keyBuffer,
                                   int keyOffset,
View Full Code Here

     
      validate(block);

      return true;
    } finally {
      blockLock.unlock();
    }
  }
   
  /**
   * Inserts into the next block given the current block and the given key.
View Full Code Here

      try {
        byte []blockBuffer = block.getBuffer();

        os.write(blockBuffer, blockOffset, length);
      } finally {
        lock.unlock();
      }
    } catch (InterruptedException e) {
      throw new IllegalStateException(e);
    } finally {
      block.free();
View Full Code Here

      try {
        split(parent, block);

        validate(block);
      } finally {
        blockLock.unlock();
      }
    } finally {
      block.free();
    }
  }
View Full Code Here

        System.arraycopy(blockBuffer, blockOffset,
                         buffer, offset, length);

        return length;
      } finally {
        lock.unlock();
      }
    } catch (InterruptedException e) {
      throw new IllegalStateException(e);
    } finally {
      block.free();
View Full Code Here

      try {
        splitRoot(rootBlock);

        validate(rootBlock);
      } finally {
        rootLock.unlock();
      }
    } finally {
      rootBlock.free();
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.