Package org.sonatype.nexus.proxy.item

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


    final RepositoryItemUidLock fromUidLock = fromUid.getLock();

    final RepositoryItemUidLock toUidLock = toUid.getLock();

    fromUidLock.lock(Action.read);
    toUidLock.lock(Action.create);

    try {
      StorageItem item = retrieveItem(fromTask, from);

      if (StorageFileItem.class.isAssignableFrom(item.getClass())) {
View Full Code Here


    final RepositoryItemUid uid = createUid(request.getRequestPath());

    final RepositoryItemUidLock uidLock = uid.getLock();

    uidLock.lock(Action.delete);

    try {
      StorageItem item = null;
      try {
        // determine is the thing to be deleted a collection or not
View Full Code Here

    // shared lock
    final RepositoryItemUid uploaderUid = createUid(item.getPath() + ".storeItem()");

    final RepositoryItemUidLock uidUploaderLock = uploaderUid.getLock();

    uidUploaderLock.lock(Action.create);

    final Action action = getResultingActionOnWrite(item.getResourceStoreRequest());

    try {
      // NEXUS-4550: we are shared-locking the actual UID (to not prevent downloaders while
View Full Code Here

      // but we exclusive lock uploaders to serialize them!
      // And the LS has to take care of whatever stricter locking it has to use or not
      // Think: RDBMS LS or some trickier LS implementations for example
      final RepositoryItemUidLock uidLock = uid.getLock();

      uidLock.lock(Action.read);

      try {
        // store it
        getLocalStorage().storeItem(this, item);
      }
View Full Code Here

  protected <R> R doReadProtected(final Callable<R> callable)
      throws IOException
  {
    final RepositoryItemUidLock lock = getRepositoryItemUid().getLock();
    lock.lock(Action.read);
    try {
      try {
        return callable.call();
      }
      catch (IOException e) {
View Full Code Here

            "Caching item " + item.getRepositoryItemUid().toString() + " in local storage of repository.");
      }

      final RepositoryItemUidLock itemLock = item.getRepositoryItemUid().getLock();

      itemLock.lock(Action.create);

      final Action action;

      try {
        action = getResultingActionOnWrite(item.getResourceStoreRequest());
View Full Code Here

    final RepositoryItemUid itemUid = createUid(request.getRequestPath());

    final RepositoryItemUidLock itemUidLock = itemUid.getLock();

    itemUidLock.lock(Action.read);

    try {
      if (!getRepositoryKind().isFacetAvailable(ProxyRepository.class)) {
        // we have no proxy facet, just get 'em!
        return super.doRetrieveItem(request);
View Full Code Here

        // we are a proxy, and we either don't have local copy or is stale, we need to
        // go remote and potentially check for new version of file, but we still don't know
        // will we actually fetch it (since aging != remote file changed!)
        // BUT, from this point on, we want to _serialize_ access, so upgrade to CREATE lock

        itemUidLock.lock(Action.create);

        try {
          // check local copy again, we were maybe blocked for a download, and we need to
          // recheck local copy after we acquired exclusive lock
          if (!request.isRequestRemoteOnly()) {
View Full Code Here

    final RepositoryItemUid itemUid = createUid(request.getRequestPath());

    final RepositoryItemUidLock itemUidLock = itemUid.getLock();

    // all this remote download happens in exclusive lock
    itemUidLock.lock(Action.create);

    try {
      List<String> remoteUrls = getRemoteUrls(request);

      List<RepositoryItemValidationEvent> events = new ArrayList<>();
View Full Code Here

  private void addItemToIndex(Repository repository, StorageItem item, IndexingContext context)
      throws LocalStorageException, IOException
  {
    final RepositoryItemUidLock uidLock = item.getRepositoryItemUid().getLock();

    uidLock.lock(Action.read);

    try {

      ArtifactContext ac = null;
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.