289290291292293294295296297298
int consumed = 0; while (buffer.hasRemaining()) { byte b = buffer.get(); consumed++; if (content[index++] != b) { throw new CancelledException(); } } return consumed; }
149150151152153154155156
public void stop() { shallStop = true; } public void checkCancelled() throws CancelledException { if (shallStop) { throw new CancelledException(); } }
262263264265266267268269270271272
cmd.file(Path.create("file1")); cmd.set(new CancelSupport() { int i = 0; public void checkCancelled() throws CancelledException { if (i++ == 2) { throw new CancelledException(); } } }); try { cmd.execute(new ByteChannel() {
198199200201202203204205206207
HgCallbackTargetException ex = (HgCallbackTargetException) failure; failure = null; throw ex; } if (failure instanceof CancelledException) { CancelledException ex = (CancelledException) failure; failure = null; throw ex; } }
83848586878889909192
if (failure != null) { HgCallbackTargetException toThrow = failure; throw toThrow; } if (lifecycleBridge.isCancelled()) { CancelledException toThrow = lifecycleBridge.getCancelOrigin(); assert toThrow != null; throw toThrow; } }