public function acquire(AcquirerInterface $acquirer, ResourceInterface $resource)
    {
        if (!$this->isAccessible($acquirer, $resource)) {
            throw new ResourceLockedException(sprintf('The resource is not accessible. It is locked by "%s".', $resource->getLock()->getAcquirer()->getIdentifier()));
        }

        return $this->repository->acquire($acquirer, $resource);
    }
public function acquire(AcquirerInterface $acquirer, ResourceInterface $resource)
    {
        if (!$this->isAccessible($acquirer, $resource)) {
            throw new ResourceLockedException(sprintf('The resource is not accessible. It is locked by "%s".', $resource->getLock()->getAcquirer()->getIdentifier()));
        }

        return $this->repository->acquire($acquirer, $resource);
    }
public function acquire ( AcquirerInterface $ acquirer , ResourceInterface $ resource ) { if ( ! $ this -> isAccessible ( $ acquirer , $ resource ) ) { throw new ResourceLockedException ( sprintf ( 'The resource is not accessible. It is locked by "%s".' , $ resource -> getLock ( ) -> getAcquirer ( ) -> getIdentifier ( ) ) ) ; } return $ this -> repository -> acquire ( $ acquirer , $ resource ) ; }
Try to acquire a Lock on the given Resource.

@param AcquirerInterface $acquirer
@param ResourceInterface $resource

@return LockInterface

@throws ResourceLockedException
Try to acquire a Lock on the given Resource .