Package org.sonatype.nexus.proxy.item

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


  public boolean deleteAttributes(final RepositoryItemUid uid)
      throws IOException
  {
    final RepositoryItemUidLock uidLock = uid.getLock();

    uidLock.lock(Action.delete);

    try {
      if (log.isDebugEnabled()) {
        log.debug("Deleting attributes on UID=" + uid.toString());
      }
View Full Code Here


  public Attributes getAttributes(final RepositoryItemUid uid)
      throws IOException
  {
    final RepositoryItemUidLock uidLock = uid.getLock();

    uidLock.lock(Action.read);

    try {
      if (log.isDebugEnabled()) {
        log.debug("Loading attributes on UID=" + uid.toString());
      }
View Full Code Here

  public void putAttributes(final RepositoryItemUid uid, Attributes attributes)
      throws IOException
  {
    final RepositoryItemUidLock uidLock = uid.getLock();

    uidLock.lock(Action.create);

    try {
      if (log.isDebugEnabled()) {
        log.debug("Storing attributes on UID=" + uid.toString());
      }
View Full Code Here

      // Locking is needed, AbstractRepository got shared lock only for destination

      // NEXUS-4550: FSPeer is the one that handles the rename in case of FS LS,
      // so we need here to claim exclusive lock on actual UID to perform the rename
      final RepositoryItemUidLock uidLock = item.getRepositoryItemUid().getLock();
      uidLock.lock(Action.create);

      try {
        handleRenameOperation(hiddenTarget, target);
        target.setLastModified(item.getModified());
      }
View Full Code Here

        if (member.getLocalStatus().shouldServiceRequest()) {
          final FilePrefixSource memberEntrySource =
              getPrefixSourceFor(member.adaptToFacet(MavenRepository.class));
          // lock to prevent file being deleted between exists check and reading it up
          final RepositoryItemUidLock lock = memberEntrySource.getRepositoryItemUid().getLock();
          lock.lock(Action.read);
          try {
            if (!memberEntrySource.supported()) {
              allMembersHavePublished = false;
              break;
            }
View Full Code Here

      // although not 100% bulletproof, this logic reduces the risk of this happening
      return false;
    }
    final FilePrefixSource prefixSource = getPrefixSourceFor(mavenHostedRepository);
    final RepositoryItemUidLock lock = prefixSource.getRepositoryItemUid().getLock();
    lock.lock(Action.read);
    try {
      if (!prefixSource.supported()) {
        return false;
      }
      final String entry;
View Full Code Here

      final WritablePrefixSourceModifier wesm =
          new WritablePrefixSourceModifier(prefixSource, config.getLocalScrapeDepth());
      wesm.offerEntry(entry);
      if (wesm.hasChanges()) {
        boolean changed = false;
        lock.lock(Action.update);
        try {
          wesm.reset();
          wesm.offerEntry(entry);
          changed = wesm.apply();
          if (changed) {
View Full Code Here

      // although not 100% bulletproof, this logic reduces the risk of this happening
      return false;
    }
    final FilePrefixSource prefixSource = getPrefixSourceFor(mavenHostedRepository);
    final RepositoryItemUidLock lock = prefixSource.getRepositoryItemUid().getLock();
    lock.lock(Action.read);
    try {
      if (!prefixSource.supported()) {
        return false;
      }
      final WritablePrefixSourceModifier wesm =
View Full Code Here

      final WritablePrefixSourceModifier wesm =
          new WritablePrefixSourceModifier(prefixSource, config.getLocalScrapeDepth());
      wesm.revokeEntry(item.getPath());
      if (wesm.hasChanges()) {
        boolean changed = false;
        lock.lock(Action.update);
        try {
          wesm.reset();
          wesm.revokeEntry(item.getPath());
          changed = wesm.apply();
          if (changed) {
View Full Code Here

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

    final RepositoryItemUidLock uidLock = uid.getLock();

    uidLock.lock(Action.read);

    try {
      StorageItem item = doRetrieveItem(request);

      // file with generated content?
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.