コード例 #1
0
ファイル: RefDirectory.java プロジェクト: spearce/jgit
 private void putLooseRef(LooseRef ref) {
   RefList<LooseRef> cList, nList;
   do {
     cList = looseRefs.get();
     nList = cList.put(ref);
   } while (!looseRefs.compareAndSet(cList, nList));
   modCnt.incrementAndGet();
   fireRefsChanged();
 }
コード例 #2
0
ファイル: DfsRefDatabase.java プロジェクト: rlinehan/jgit
 /**
  * Obtain a modified copy of the cache with a ref stored.
  *
  * <p>This cache instance is not modified by this method.
  *
  * @param ref reference to add or replace.
  * @return a copy of this cache, with the reference added or replaced.
  */
 public RefCache put(Ref ref) {
   RefList<Ref> newIds = this.ids.put(ref);
   RefList<Ref> newSym = this.sym;
   if (ref.isSymbolic()) {
     newSym = newSym.put(ref);
   } else {
     int p = newSym.find(ref.getName());
     if (0 <= p) newSym = newSym.remove(p);
   }
   return new RefCache(newIds, newSym);
 }
コード例 #3
0
  void stored(String refName, RefData newData) {
    DhtRef ref = fromData(refName, newData);
    RefCache oldCache, newCache;
    do {
      oldCache = cache.get();
      if (oldCache == null) return;

      RefList<DhtRef> ids = oldCache.ids.put(ref);
      RefList<DhtRef> sym = oldCache.sym;

      if (ref.isSymbolic()) {
        sym = sym.put(ref);
      } else {
        int p = sym.find(refName);
        if (0 <= p) sym = sym.remove(p);
      }

      newCache = new RefCache(ids, sym, oldCache.hints);
    } while (!cache.compareAndSet(oldCache, newCache));
  }