Tabnine Logo
UnderFileSystemUtils.deleteFileIfExists
Code IndexAdd Tabnine to your IDE (free)

How to use
deleteFileIfExists
method
in
alluxio.util.UnderFileSystemUtils

Best Java code snippets using alluxio.util.UnderFileSystemUtils.deleteFileIfExists (Showing top 7 results out of 315)

origin: Alluxio/alluxio

 /**
  * Updates the checkpoint to the specified URI.
  *
  * @param location the location of the new checkpoint
  */
 public void update(URI location) {
  try {
   if (mUfs.isFile(mCheckpoint.toString())) {
    UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempBackupCheckpoint.toString());
    UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
    // Rename in two steps so that we never have identical mCheckpointPath and
    // mBackupCheckpointPath. This is a concern since UFS may implement rename as copy + delete.
    mUfs.renameFile(mCheckpoint.toString(), mTempBackupCheckpoint.toString());
    mUfs.renameFile(mTempBackupCheckpoint.toString(), mBackupCheckpoint.toString());
    LOG.info("Backed up the checkpoint file to {}", mBackupCheckpoint.toString());
   }
   mUfs.renameFile(location.getPath(), mCheckpoint.toString());
   LOG.info("Renamed the checkpoint file from {} to {}", location,
     mCheckpoint.toString());

   // The checkpoint already reflects the information in the completed logs.
   mWriter.deleteCompletedLogs();
   UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: Alluxio/alluxio

@Override
public synchronized JournalOutputStream getCheckpointOutputStream(long latestSequenceNumber)
  throws IOException {
 if (mCheckpointOutputStream == null) {
  mCheckpointManager.recover();
  LOG.info("Creating tmp checkpoint file: {}", mTempCheckpoint);
  if (!mUfs.isDirectory(mJournal.getLocation().toString())) {
   LOG.info("Creating journal folder: {}", mJournal.getLocation());
   mUfs.mkdirs(mJournal.getLocation().toString());
  }
  mNextEntrySequenceNumber = latestSequenceNumber + 1;
  LOG.info("Latest journal sequence number: {} Next journal sequence number: {}",
    latestSequenceNumber, mNextEntrySequenceNumber);
  UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempCheckpoint.toString());
  mCheckpointOutputStream = new CheckpointOutputStream(
    new DataOutputStream(mUfs.create(mTempCheckpoint.toString())));
 }
 return mCheckpointOutputStream;
}
origin: Alluxio/alluxio

UnderFileSystemUtils.deleteFileIfExists(mUfs, mCheckpoint.toString());
mUfs.renameFile(mTempBackupCheckpoint.toString(), mCheckpoint.toString());
origin: Alluxio/alluxio

String ufsBlockPath = alluxio.worker.BlockUtils.getUfsBlockPath(ufsClient, blockId);
try (CloseableResource<UnderFileSystem> ufsResource = ufsClient.acquireUfsResource()) {
 alluxio.util.UnderFileSystemUtils.deleteFileIfExists(ufsResource.get(), ufsBlockPath);
} catch (Exception e) {
 LOG.warn("Failed to clean up staging UFS block file {}", ufsBlockPath, e.getMessage());
origin: org.alluxio/alluxio-core-server-common

 /**
  * Updates the checkpoint to the specified URI.
  *
  * @param location the location of the new checkpoint
  */
 public void update(URI location) {
  try {
   if (mUfs.isFile(mCheckpoint.toString())) {
    UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempBackupCheckpoint.toString());
    UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
    // Rename in two steps so that we never have identical mCheckpointPath and
    // mBackupCheckpointPath. This is a concern since UFS may implement rename as copy + delete.
    mUfs.renameFile(mCheckpoint.toString(), mTempBackupCheckpoint.toString());
    mUfs.renameFile(mTempBackupCheckpoint.toString(), mBackupCheckpoint.toString());
    LOG.info("Backed up the checkpoint file to {}", mBackupCheckpoint.toString());
   }
   mUfs.renameFile(location.getPath(), mCheckpoint.toString());
   LOG.info("Renamed the checkpoint file from {} to {}", location,
     mCheckpoint.toString());

   // The checkpoint already reflects the information in the completed logs.
   mWriter.deleteCompletedLogs();
   UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: org.alluxio/alluxio-core-server-common

@Override
public synchronized JournalOutputStream getCheckpointOutputStream(long latestSequenceNumber)
  throws IOException {
 if (mCheckpointOutputStream == null) {
  mCheckpointManager.recover();
  LOG.info("Creating tmp checkpoint file: {}", mTempCheckpoint);
  if (!mUfs.isDirectory(mJournal.getLocation().toString())) {
   LOG.info("Creating journal folder: {}", mJournal.getLocation());
   mUfs.mkdirs(mJournal.getLocation().toString());
  }
  mNextEntrySequenceNumber = latestSequenceNumber + 1;
  LOG.info("Latest journal sequence number: {} Next journal sequence number: {}",
    latestSequenceNumber, mNextEntrySequenceNumber);
  UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempCheckpoint.toString());
  mCheckpointOutputStream = new CheckpointOutputStream(
    new DataOutputStream(mUfs.create(mTempCheckpoint.toString())));
 }
 return mCheckpointOutputStream;
}
origin: org.alluxio/alluxio-core-server-common

UnderFileSystemUtils.deleteFileIfExists(mUfs, mCheckpoint.toString());
mUfs.renameFile(mTempBackupCheckpoint.toString(), mCheckpoint.toString());
alluxio.utilUnderFileSystemUtilsdeleteFileIfExists

Javadoc

Deletes the specified path from the specified under file system if it is a file and exists.

Popular methods of UnderFileSystemUtils

  • getBucketName
  • approximateContentHash
    Returns an approximate content hash, using the length and modification time.
  • isHdfs
  • touch
    Creates an empty file.
  • deleteDirIfExists
    Deletes the directory at the given path if it exists.
  • isLocal
  • mkdirIfNotExists
    Attempts to create the directory if it does not already exist.

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • setRequestProperty (URLConnection)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JLabel (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now