code: public Addon getAddon(final AddonView view, final AddonId id)
     {
        Assert.notNull(view, "AddonView must not be null.");
        Assert.notNull(id, "AddonId must not be null.");
        return lock.performLocked(LockMode.WRITE, new Callable<Addon>()
        {
           @Override
           public Addon call() throws Exception
           {
              Addon result = null;
  
              for (Addon addon : getAddons(view))
              {
                 if (id.equals(addon.getId()))
                 {
                    result = addon;
                    break;
                 }
              }
  
              if (result == null)
              {
                 result = stateManager.getAddonForView(view, id);
                 if (result == null)
                    result = new AddonImpl(stateManager, id);
  
                 Set<Addon> addons = _getAddonsForView(view);
                 addons.add(result);
              }
  
              return result;
           }
  
        });
     }
docs: Requires a {@link LockMode#WRITE} lock.