The file condition to wait for during execution.

@deprecated in favor of {@link #file()}
3233
@Deprecated
    public WaitFileConditionBuilder file(String filePath) {
        FileCondition condition = new FileCondition();
        condition.setFilePath(filePath);
        container.setCondition(condition);
        this.buildAndRun();
        return new WaitFileConditionBuilder(condition, this);
    }
344924
public synchronized boolean needsReload(final File file) throws IOException {
        final long lastMod = file.lastModified();
        if (!file.exists()) {
            mtimes.remove(file);
        }
        final Long aLong = mtimes.get(file);
        return null == aLong || lastMod > aLong;
    }
482117
public static boolean waitForFile(File file) {
        if (file.isFile()) {
            return true;
        } else {
            // Start waiting 10 seconds maximum
            long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
            while (System.currentTimeMillis() <= timeout) {
                sleepQuietly(10);
                if (file.isFile()) {
                    return true;
                }
            }
        }
        // Timeout reached
        return false;
    }
866691
public Wait action(TestAction action) {
        if (action instanceof TestActionBuilder) {
            getCondition().setAction(((TestActionBuilder) action).build());
            this.action.setAction(((TestActionBuilder) action).build());
            getBuilder().actions(((TestActionBuilder) action).build());
        } else {
            getCondition().setAction(action);
            this.action.setAction(action);
            getBuilder().actions(action);
        }

        return getBuilder().build();
    }
237840
@Override
    public File call() throws Exception {
        try {
            latch.await();

            if (isTimeoutEnabled()) {
                timedExecutor.schedule(new Runnable() {
                    public void run() {
                        try {
                            if (abortableDownload.getState() != Transfer.TransferState.Completed) {
                                abortableDownload.abort();
                            }
                        } catch (Exception e) {
                            throw new SdkClientException(
                                "Unable to abort download after timeout", e);
                        }
                    }
                }, timeout, TimeUnit.MILLISECONDS);
            }

            setState(Transfer.TransferState.InProgress);
            createParentDirectoryIfNecessary(dstfile);

            if (isDownloadParallel) {
                downloadInParallel();
            } else {
                downloadAsSingleObject();
            }
            return dstfile;
        } catch (Throwable t) {
            cleanupAfterException();
            if (t instanceof Exception) {
                throw (Exception) t;
            } else {
                throw (Error) t;
            }
        }
    }
151165
public CallOptions withWaitForReady() {
    CallOptions newOptions = new CallOptions(this);
    newOptions.waitForReady = Boolean.TRUE;
    return newOptions;
  }
186518
public synchronized void waitForEnd()
	throws ServerException,
	       ClientException,
	       IOException {
        try {
            while(!isDone() && !hasError()) {
                wait();
            }
        } catch(InterruptedException e) {
            // break
        }
	    checkError();
    }
1333301
private synchronized DatanodeInfo blockSeekTo(long target,
      boolean throwWhenNotFound) throws IOException {
    // We only allow to seek before the end of the file, or the end of the file
    // and allowSeedtoEnd, which is the case called by available().
    //
    if (target > getFileLength() || (target == getFileLength() && throwWhenNotFound)) {
      throw new IOException("Attempted to read past end of file");
    }

    // Will be getting a new BlockReader.
    if ( blockReader != null ) {
      closeBlockReader(blockReader, false);
      blockReader = null;
    }
    
    //
    // Compute desired block.
    //
    LocatedBlock targetBlock = getBlockAt(target, true, throwWhenNotFound);
    // Given target<= fileLength, when and only whenallowSeektoEnd is true and
    // there is no block for the file yet, getBlockAt() returns null, in this
    // case we should simply return null.
    //
    if (targetBlock == null) {
      assert target == 0;
      return null;
    }
    assert (target==this.pos) : "Wrong postion " + pos + " expect " + target;
    long offsetIntoBlock = target - targetBlock.getStartOffset();

    //
    // Connect to best DataNode for desired Block, with potential offset
    //
    DatanodeInfo chosenNode = null;
    BlockSeekContext seekContext = new BlockSeekContext(targetBlock);
    while (true) {
      DNAddrPair retval = chooseDataNode(seekContext);
      chosenNode = retval.info;
      InetSocketAddress targetAddr = retval.addr;
      final InetAddress chosenDataNodeAddress = targetAddr.getAddress();
      final boolean isChosenDatanodeLocal = NetUtils.isLocalAddressWithCaching(chosenDataNodeAddress)
          || (dfsClient.localHost != null && dfsClient.localHost.equals(chosenDataNodeAddress));
      
      // try reading the block locally. if this fails, then go via
      // the datanode
      Block blk = seekContext.getTargetBlock().getBlock();
      try {
        if (DFSClient.LOG.isDebugEnabled()) {
          DFSClient.LOG.warn("blockSeekTo shortCircuitLocalReads "
                   + dfsClient.shortCircuitLocalReads +
                   " localhost " + dfsClient.localHost +
                   " targetAddr " + targetAddr);
        }
        if (dfsClient.shortCircuitLocalReads && isChosenDatanodeLocal) {
          blockReader = BlockReaderLocalBase.newBlockReader(dfsClient.conf, src,
                                                 dfsClient.namespaceId, blk,
                                                 chosenNode,
                                                 offsetIntoBlock,
                                                 blk.getNumBytes() - offsetIntoBlock,
                                                 dfsClient.metrics, 
                                                 this.verifyChecksum,
                                                 this.clearOsBuffer,
                                                 false);
          if (blockReader != null) {
            blockReader.setReadLocal(true);
            blockReader.setFsStats(dfsClient.stats);
            if (cliData != null) {
              cliData.recordReadBlockSeekToTime();
            }
            return chosenNode;
          } else if (!dfsClient.shortcircuitDisableWhenFail) {
            throw new IOException(
                "Short circuit local read not supported for inline checksum file.");
          }
        }
      } catch (IOException ex) {
        DFSClient.LOG.info("Failed to read block " + seekContext.getTargetBlock().getBlock() +
                 " on local machine " + dfsClient.localHost +
                 ". Try via the datanode on " + targetAddr + ":"
                  + StringUtils.stringifyException(ex));
      }

      try {
        long minReadSpeedBps = (dfsClient.numNodeLeft(seekContext.getTargetBlock().getLocations(),
            deadNodes) > 1) ? dfsClient.minReadSpeedBps : -1;
        blockReader = getBlockReader(
            dfsClient.getDataTransferProtocolVersion(), dfsClient.namespaceId,
            targetAddr, src, blk.getBlockId(),
            blk.getGenerationStamp(),
            offsetIntoBlock, blk.getNumBytes() - offsetIntoBlock,
            buffersize, verifyChecksum,
            dfsClient.clientName, dfsClient.bytesToCheckReadSpeed,
            minReadSpeedBps, false, cliData);
        blockReader.setReadLocal(isChosenDatanodeLocal);
        blockReader.enableThrowForSlow = dfsClient.enableThrowForSlow;
        if (!isChosenDatanodeLocal) {
          blockReader
              .setReadRackLocal(dfsClient.isInLocalRack(targetAddr));
        }
        blockReader.setFsStats(dfsClient.stats);
        if (cliData != null) {
          cliData.recordReadBlockSeekToTime();
        }
        return chosenNode;
      } catch (IOException ex) {
        // Put chosen node into dead list, continue
        DFSClient.LOG.warn("Failed to connect to " + targetAddr, ex);
        addToDeadNodes(chosenNode);
      }
    }
  }
243765
public void waitForExit()
    throws IOException
  {
    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    
    try {
      thread.setContextClassLoader(_systemManager.getClassLoader());
      
      _waitForExitService = new WaitForExitService3(this, 
                                                    _systemManager);

      _waitForExitService.waitForExit();
    } finally {
      thread.setContextClassLoader(oldLoader);
    }
  }
790477
private FileOutputStream fos() throws IOException {
        if (closed)
            throw new IOException("Output stream is already closed");
        if (os == null || currFileBytesWritten >= partSize) {
            if (os != null) {
                os.close();
                // notify about the new file ready for processing
                observer.onPartCreate(new PartCreationEvent(
                        getFile(filesCreated), filesCreated, false, this));
            }
            currFileBytesWritten = 0;
            filesCreated++;
            blockIfNecessary();
            final File file = getFile(filesCreated);
            os = new FileOutputStream(file);
        }
        return os;
    }
588348
@Override
    public File call() throws Exception {
        try {
            latch.await();

            if (isTimeoutEnabled()) {
                timedExecutor.schedule(new Runnable() {
                    public void run() {
                        try {
                            if (download.getState() != TransferState.Completed) {
                                download.abort();
                            }
                        } catch (Exception e) {
                            throw new SdkClientException(
                                "Unable to abort download after timeout", e);
                        }
                    }
                }, timeout, TimeUnit.MILLISECONDS);
            }

            download.setState(TransferState.InProgress);
            createParentDirectoryIfNecessary(dstfile);

            if (isDownloadParallel) {
                downloadInParallel(ServiceUtils.getPartCount(req, s3));
            } else {
                S3Object s3Object = retryableDownloadS3ObjectToFile(dstfile,
                                                                    new DownloadTaskImpl(s3, download, req));
                updateDownloadStatus(s3Object);
            }
            return dstfile;
        } catch (Throwable t) {
            // Cancel all the futures
            for (Future<Long> f : futures) {
                f.cancel(true);
            }
            // Downloads aren't allowed to move from canceled to failed
            if (download.getState() != TransferState.Canceled) {
                download.setState(TransferState.Failed);
            }
            if (t instanceof Exception)
                throw (Exception) t;
            else
                throw (Error) t;
        }
    }
844529
function() {
				this.result = null;
				
				if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
					return;
				} else if (this.readyState === FileReader.LOADING) {
					this.readyState = FileReader.DONE;
				}

				if (_fr) {
					_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
				}
				
				this.trigger('abort');
				this.trigger('loadend');
			}
1340070
public static final Process openDocument(File file,
			boolean waitForTermination) throws IOException {
		return openDocument(file.getAbsolutePath(), waitForTermination);
	}
355486
private void checkFile() throws IORuntimeException {
		Assert.notNull(file, "File to write content is null !");
		if(this.file.exists() && false == file.isFile()){
			throw new IORuntimeException("File [{}] is not a file !", this.file.getAbsoluteFile());
		}
	}
351324
private void waitForAllPartsUpload() throws IOException {
    int beforeSize = mTags.size();
    try {
      for (ListenableFuture<PartETag> future : mTagFutures) {
        mTags.add(future.get());
      }
    } catch (ExecutionException e) {
      // No recover ways so that we need to cancel all the upload tasks
      // and abort the multipart upload
      Futures.allAsList(mTagFutures).cancel(true);
      abortMultiPartUpload();
      throw new IOException("Part upload failed in multipart upload with "
          + "id '" + mUploadId + "' to " + mKey, e);
    } catch (InterruptedException e) {
      LOG.warn("Interrupted object upload.", e);
      Futures.allAsList(mTagFutures).cancel(true);
      abortMultiPartUpload();
      Thread.currentThread().interrupt();
    }
    mTagFutures = new ArrayList<>();
    if (mTags.size() != beforeSize) {
      LOG.debug("Uploaded {} partitions of id '{}' to {}.", mTags.size(), mUploadId, mKey);
    }
  }
164986
@Deprecated
    public WaitHttpConditionBuilder http(String url) {
        HttpCondition condition = new HttpCondition();
        condition.setUrl(url);
        container.setCondition(condition);
        this.buildAndRun();
        return new WaitHttpConditionBuilder(condition, this);
    }
304851
public static final void useFileLocking(boolean useFileLocking)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "useFileLocking", new Boolean(useFileLocking));

        _useFileLocking = useFileLocking;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "useFileLocking");
    }