Package org.sonatype.nexus.proxy.item

Examples of org.sonatype.nexus.proxy.item.RepositoryItemUidLock.lock()


    // NEXUS-814: we should not delete always
    if (!item.getItemContext().containsKey(SnapshotRemover.MORE_TS_SNAPSHOTS_EXISTS_FOR_GAV)) {
      final RepositoryItemUidLock uidLock = item.getRepositoryItemUid().getLock();

      uidLock.lock(Action.read);

      try {
        getNexusIndexer().deleteArtifactFromIndex(ac, context);
      }
      finally {
View Full Code Here


    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      // Lock the metadata do be sure that the artifacts are retrieved from consistent paths.
      lock.lock(Action.read);
      try {
        // NOTE - THIS CANNOT be a write action (create/delete/update) as that will force a write lock
        // thus serializing access to this p2 repo. Using a read action here, will block the file from
        // being deleted/updated while retrieving the remote item, and that is all we need.
View Full Code Here

        // NOTE - THIS CANNOT be a write action (create/delete/update) as that will force a write lock
        // thus serializing access to this p2 repo. Using a read action here, will block the file from
        // being deleted/updated while retrieving the remote item, and that is all we need.

        // NXCM-2499 temporarily we do put access serialization back here, to avoid all the deadlocks.
        lock.lock(Action.create);
        return super.retrieveItem(fromTask, request);
      }
      finally {
        lock.unlock();
      }
View Full Code Here

    // performance, but we avoiding potential deadlocks (this method was synchronized).
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      lock.lock(Action.create);
      if (!hasArtifactMappings) {
        return null;
      }

      if (remoteArtifactMappings == null) {
View Full Code Here

  {
    StorageFileItem result = null;

    try {
      final RepositoryItemUidLock itemLock = item.getRepositoryItemUid().getLock();
      itemLock.lock(Action.create);
      try {
        repository.getLocalStorage().storeItem(repository, item);
        repository.removeFromNotFoundCache(item.getResourceStoreRequest());
        final ResourceStoreRequest request = new ResourceStoreRequest(item);
        result = (StorageFileItem) repository.getLocalStorage().retrieveItem(repository, request);
View Full Code Here

        }
        finally {
          // release repo
          repoLock.unlock();
          // get back the lock we gave in
          itemLock.lock(Action.read);
        }
      }
      else if (P2Constants.ARTIFACTS_XML.equals(request.getRequestPath())
          || P2Constants.ARTIFACTS_JAR.equals(request.getRequestPath())) {
        try {
View Full Code Here

  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();

    try {
      lock.lock(Action.read);
      return super.retrieveItem(fromTask, request);
    }
    finally {
      lock.unlock();
    }
View Full Code Here

        }
        finally {
          // release repo
          repoLock.unlock();
          // get back the lock we gave in
          itemLock.lock(Action.read);
        }
      }

      // we explicitly do not serve any other metadata files
      throw new ItemNotFoundException(request, repository);
View Full Code Here

  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();
    final boolean requestGroupLocalOnly = request.isRequestGroupLocalOnly();
    try {
      lock.lock(Action.read);
      request.setRequestGroupLocalOnly(true);
      return super.doRetrieveItem(request);
    }
    finally {
      request.setRequestGroupLocalOnly(requestGroupLocalOnly);
View Full Code Here

  {
    final RepositoryItemUid uid = createUid(P2Constants.METADATA_LOCK_PATH);
    final RepositoryItemUidLock lock = uid.getLock();
    final boolean requestGroupLocalOnly = request.isRequestGroupLocalOnly();
    try {
      lock.lock(Action.read);
      request.setRequestGroupLocalOnly(true);
      return super.doListItems(request);
    }
    finally {
      request.setRequestGroupLocalOnly(requestGroupLocalOnly);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.