private void cachePeeledState(Ref oldLeaf, Ref newLeaf) { // TODO(spearce) Use an ExecutorService here try { RepositoryKey repo = repository.getRepositoryKey(); RefKey key = RefKey.create(repo, newLeaf.getName()); RefData oldData = ((DhtRef) oldLeaf).getRefData(); RefData newData = ((DhtRef) newLeaf).getRefData(); db.ref().compareAndPut(key, oldData, newData); } catch (TimeoutException e) { // Ignore a timeout here, we were only trying to update // a cached value to save peeling costs in the future. } catch (DhtException e) { // Ignore a database error, this was only an attempt to // fix a value that could be cached to save time later. } }
private void cachePeeledState(Ref oldLeaf, Ref newLeaf) { // TODO(spearce) Use an ExecutorService here try { RepositoryKey repo = repository.getRepositoryKey(); RefKey key = RefKey.create(repo, newLeaf.getName()); RefData oldData = ((DhtRef) oldLeaf).getRefData(); RefData newData = ((DhtRef) newLeaf).getRefData(); db.ref().compareAndPut(key, oldData, newData); } catch (TimeoutException e) { // Ignore a timeout here, we were only trying to update // a cached value to save peeling costs in the future. } catch (DhtException e) { // Ignore a database error, this was only an attempt to // fix a value that could be cached to save time later. } }
@Override protected boolean tryLock(boolean deref) throws IOException { dstRef = getRef(); if (deref) dstRef = dstRef.getLeaf(); refKey = RefKey.create(repo, dstRef.getName()); oldData = ((DhtRef) dstRef).getRefData(); if (dstRef.isSymbolic()) setOldObjectId(null); else setOldObjectId(dstRef.getObjectId()); return true; }
@Override protected boolean tryLock(boolean deref) throws IOException { dstRef = getRef(); if (deref) dstRef = dstRef.getLeaf(); refKey = RefKey.create(repo, dstRef.getName()); oldData = ((DhtRef) dstRef).getRefData(); if (dstRef.isSymbolic()) setOldObjectId(null); else setOldObjectId(dstRef.getObjectId()); return true; }