Examples of tryLock()


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

  {
    Block block = readBlock(fragmentAddress);

    try {
      Lock lock = block.getWriteLock();
      lock.tryLock(_blockLockTimeout, TimeUnit.MILLISECONDS);

      try {
        int fragIndex = (int) (fragmentAddress & BLOCK_OFFSET_MASK);
        int offset = fragIndex / 8 + MINI_FRAG_ALLOC_OFFSET;
        int mask = 1 << (fragIndex % 8);
View Full Code Here

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

    Block block = readBlock(addressToBlockId(fragmentAddress));

    try {
      Lock lock = block.getWriteLock();
      lock.tryLock(_blockLockTimeout, TimeUnit.MILLISECONDS);

      try {
        int blockOffset = getMiniFragmentOffset(fragmentAddress);

        byte []blockBuffer = block.getBuffer();
View Full Code Here

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

    Block block = readBlock(addressToBlockId(fragmentAddress));

    try {
      Lock lock = block.getWriteLock();
      lock.tryLock(_blockLockTimeout, TimeUnit.MILLISECONDS);

      try {
        int blockOffset = getMiniFragmentOffset(fragmentAddress);

        byte []blockBuffer = block.getBuffer();
View Full Code Here

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

  private int allocateRow(Block block, DbTransaction xa)
    throws IOException, SQLException, InterruptedException
  {
    Lock blockLock = block.getWriteLock();

    blockLock.tryLock(xa.getTimeout(), TimeUnit.MILLISECONDS);
    try {
      block.read();

      byte []buffer = block.getBuffer();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.tryLock()

    long remainingNanos = timeoutNanos;
    boolean interruptIgnored = false;
    try {
      while (true) {
        try {
          return lock.tryLock(remainingNanos, TimeUnit.NANOSECONDS);
        } catch (InterruptedException ignored) {
          interruptIgnored = true;
          remainingNanos = (timeoutNanos - (System.nanoTime() - startNanos));
        }
      }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.tryLock()

      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    boolean reentrant = lock.isHeldByCurrentThread();
    long startNanos = System.nanoTime();
    if (!lock.tryLock(time, unit)) {
      return false;
    }
    boolean satisfied;
    try {
      long remainingNanos = unit.toNanos(time) - (System.nanoTime() - startNanos);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.tryLock()

    long remainingNanos = timeoutNanos;
    boolean interruptIgnored = false;
    try {
      while (true) {
        try {
          if (lock.tryLock(remainingNanos, TimeUnit.NANOSECONDS)) {
            break;
          } else {
            return false;
          }
        } catch (InterruptedException ignored) {
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.tryLock()

      throws InterruptedException {
    if (guard.monitor != this) {
      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    if (!lock.tryLock(time, unit)) {
      return false;
    }
    boolean satisfied;
    try {
      satisfied = guard.isSatisfied();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.tryLock()

  public boolean tryEnterIf(Guard guard) {
    if (guard.monitor != this) {
      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    if (!lock.tryLock()) {
      return false;
    }
    boolean satisfied;
    try {
      satisfied = guard.isSatisfied();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.tryLock()

        {
          ReadLock readLock = job.getTrunkLock().readLock();
         
          try
          {
            if (readLock.tryLock(10, TimeUnit.MINUTES))
            {
              try
              {
                export(resultPool,destfile,true,true, job.getCursorMap());
              }
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.