## org.apache.ivy.plugins.lock
Interface LockStrategy

All Known Implementing Classes:
  AbstractLockStrategy, ArtifactLockStrategy, FileBasedLockStrategy, NoLockStrategy

    public interface LockStrategy

A lock strategy determines when and how lock should be performed when downloading data to a cache.

Note that some implementations may actually choose to NOT perform locking, when no lock is necessary (cache not shared). Some other implementations may choose to lock the cache for the download of a whole module (not possible yet), or at the artifact level.

The lock methods should return true when the lock is either actually acquired or not performed by the strategy.

Locking used in the locking strategy must support reentrant lock. Reentrant locking should be performed for the whole strategy.

Method Summary
`java.lang.String` `getName()` Returns the name of the strategy
`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.

Method Detail

### getName

    java.lang.String getName()

  Returns the name of the strategy

  Returns:
    the name of the strategy

### lockArtifact

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

  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

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

  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