org.apache.ivy.plugins.lock

## Class ArtifactLockStrategy

- java.lang.Object
- - org.apache.ivy.plugins.lock.AbstractLockStrategy
  - - org.apache.ivy.plugins.lock.FileBasedLockStrategy
    - - org.apache.ivy.plugins.lock.ArtifactLockStrategy

- All Implemented Interfaces:
    LockStrategy
  Direct Known Subclasses:
    CreateFileLockStrategy, NIOFileLockStrategy

      public abstract class ArtifactLockStrategy
      extends FileBasedLockStrategy

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.ivy.plugins.lock.FileBasedLockStrategy

      `FileBasedLockStrategy.CreateFileLocker, FileBasedLockStrategy.FileLocker, FileBasedLockStrategy.NIOFileLocker`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ArtifactLockStrategy(FileBasedLockStrategy.FileLocker locker, boolean debugLocking)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `lockArtifact(Artifact artifact, java.io.File artifactFileToDownload)` Performs a lock before downloading the given `Artifact` to the given file.
    `void` | `unlockArtifact(Artifact artifact, java.io.File artifactFileToDownload)` Release the lock acquired for an artifact download.

    - ### Methods inherited from class org.apache.ivy.plugins.lock.FileBasedLockStrategy

      `acquireLock, getCurrentLockHolderNames, releaseLock`

    - ### Methods inherited from class org.apache.ivy.plugins.lock.AbstractLockStrategy

      `getName, isDebugLocking, setName, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ArtifactLockStrategy

          protected ArtifactLockStrategy(FileBasedLockStrategy.FileLocker locker,
                              boolean debugLocking)

  - ### Method Detail

    - #### lockArtifact

          public boolean lockArtifact(Artifact artifact,
                             java.io.File artifactFileToDownload)
                               throws java.lang.InterruptedException

      Description copied from interface: `LockStrategy`
      Performs a lock before downloading the given `Artifact` to the given file.
      Parameters:
        `artifact` - the artifact about to be downloaded
        `artifactFileToDownload` - the file where the artifact will be downloaded
      Returns:
        true if the artifact is locked, false otherwise
      Throws:
        `java.lang.InterruptedException` - if the thread is interrupted while waiting to acquire the lock

    - #### unlockArtifact

          public void unlockArtifact(Artifact artifact,
                            java.io.File artifactFileToDownload)

      Description copied from interface: `LockStrategy`
      Release the lock acquired for an artifact download.
      Parameters:
        `artifact` - the artifact for which the lock was acquired
        `artifactFileToDownload` - the file where the artifact is supposed to have been downloaded