Package java.util.concurrent.locks

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


        int totalLocked = 0;
        for(String path : _relativePaths) {
            ReadWriteLock lock = lockManager.obtainLock(path);
            final Lock rlock = lock.readLock();
            if(rlock.tryLock()) {
                localExecResources.add(new Pair<String, Lock>(path, rlock));
            } else {
                totalLocked++;
                final byte[] k = StringUtils.getBytes(path);
                final GridNodeValueCollector collector = new GridNodeValueCollector(_excludeNodeList);
View Full Code Here


        int totalLocked = 0;
        for(String path : relativePaths) {
            ReadWriteLock lock = lockManager.obtainLock(path);
            final Lock rlock = lock.readLock();
            if(rlock.tryLock()) {
                localExecResources.add(new Pair<String, Lock>(path, rlock));
            } else {
                totalLocked++;
                final List<GridNode> replicatedNodes;
                try {
View Full Code Here

         session = existing;
      }
     
      Lock lock = session.getLock();

      if (!lock.tryLock())
      {
         throw new java.rmi.RemoteException("Concurent calls on session object.");
      }
     
      try
View Full Code Here

         return null;
      }
     
      Lock lock = session.getLock();
     
      if (!lock.tryLock())
      {
         throw new java.rmi.RemoteException("Concurent calls on session object.");
      }
     
      try
View Full Code Here

   {
      PackagedSession session = this.getAppMap(appName).get(keyId);
     
      Lock lock = session.getLock();
     
      if (!lock.tryLock())
      {
         return Boolean.FALSE;
      }

      try
View Full Code Here

      block = _store.loadBlock(blockId);

    try {
      Lock blockLock = block.getReadLock();
     
      blockLock.tryLock(_timeout, TimeUnit.MILLISECONDS);

      try {
        validateIndex(block);
       
        block.read();
View Full Code Here

                                  boolean isOverride,
                                  Block block)
    throws IOException, SQLException, InterruptedException
  {
    Lock blockLock = block.getReadLock();
    blockLock.tryLock(_timeout, TimeUnit.MILLISECONDS);
     
    try {
      validateIndex(block);
       
      block.read();
View Full Code Here

                                   boolean isOverride,
                                   Block block)
    throws IOException, SQLException, InterruptedException
  {
    Lock blockLock = block.getWriteLock();
    blockLock.tryLock(_timeout, TimeUnit.MILLISECONDS);
     
    try {
      block.read();
     
      validate(block);
View Full Code Here

    Block block = readBlock(blockId);

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

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

        os.write(blockBuffer, blockOffset, length);
View Full Code Here

    try {
      validate(block);
       
      Lock blockLock = block.getWriteLock();
      blockLock.tryLock(_timeout, TimeUnit.MILLISECONDS);

      try {
        split(parent, block);

        validate(block);
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.