protected void writeFailure(AerospikeException ae) { if (ae.getResultCode() == ResultCode.TIMEOUT) { counters.write.timeouts.getAndIncrement(); } else { counters.write.errors.getAndIncrement(); if (args.debug) { ae.printStackTrace(); } } }
@Override protected void handleNotFound(int resultCode) { // Only throw not found exception for command with write operations. // Read-only command operations return a null record. if (args.hasWrite) { throw new AerospikeException(resultCode); } }
/** * Size of list, i.e. a number of elements in the list * * @return Number of elements in the list */ public int size() { try { return isEmpty ? 0 : inner.size(); } catch (AerospikeException ae) { if (ae.getResultCode() == 1417) { return 0; } throw ae; } }
ae.setIteration(iteration); ae.setInDoubt(isRead, commandSentCounter); throw ae; if (ae.keepConnection()) { if (ae.getResultCode() == ResultCode.TIMEOUT) { exception = new AerospikeException(ioe); isClientTimeout = false; super.sequence++; ae.setNode(node); ae.setIteration(iteration); ae.setInDoubt(isRead, commandSentCounter); exception.setNode(node); exception.setIteration(iteration); exception.setInDoubt(isRead, commandSentCounter);
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (cause instanceof AerospikeException.Connection) { command.onNetworkError((AerospikeException.Connection)cause); } else if (cause instanceof AerospikeException) { AerospikeException ae = (AerospikeException)cause; if (ae.getResultCode() == ResultCode.TIMEOUT) { // Go through retry logic on server timeout command.onServerTimeout(); } else { command.onApplicationError(ae); } } else if (cause instanceof IOException) { command.onNetworkError(new AerospikeException(cause)); } else { command.onApplicationError(new AerospikeException(cause)); } } }
if (ex.getResultCode() == ResultCode.GENERATION_ERROR) { if (retries++ < limitTries) { if (log.isLoggable(Level.FINEST) && retries >= (limitTries - 3)) { throw new AerospikeException(ex.getResultCode(), ex.getMessage());
public void onFailure(AerospikeException e) { // Retry up to 2 more times. if (++failCount <= 2) { Throwable t = e.getCause(); // Check for common socket errors. if (t != null && (t instanceof ConnectException || t instanceof IOException)) { console.info("Retrying get: " + key.userKey); try { client.get(eventLoop, this, policy, key); return; } catch (Exception ex) { // Fall through to error case. } } } console.error("Get failed: namespace=%s set=%s key=%s exception=%s", key.namespace, key.setName, key.userKey, e.getMessage()); } }
public void onFailure(AerospikeException e) { console.error("Failed to put: namespace=%s set=%s key=%s exception=%s", key.namespace, key.setName, key.userKey, e.getMessage()); } }, writePolicy, key, bin);
protected final void onApplicationError(AerospikeException ae) { if (ae.keepConnection()) { // Put connection back in pool. complete(); } else { // Close socket to flush out possible garbage. fail(); } notifyFailure(ae); eventLoop.tryDelayQueue(); }
/** * Is list empty? * * @return True if list is empty */ public boolean isEmpty() { try { return isEmpty || inner.size() == 0; } catch (AerospikeException ae) { if (ae.getResultCode() == 1417) { return true; } throw ae; } }
ae.setIteration(iteration); ae.setInDoubt(isRead, commandSentCounter); throw ae; if (ae.keepConnection()) { if (ae.getResultCode() == ResultCode.TIMEOUT) { exception = new AerospikeException(ioe); isClientTimeout = false; super.sequence++; ae.setNode(node); ae.setIteration(iteration); ae.setInDoubt(isRead, commandSentCounter); exception.setNode(node); exception.setIteration(iteration); exception.setInDoubt(isRead, commandSentCounter);
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (cause instanceof AerospikeException.Connection) { command.onNetworkError((AerospikeException.Connection)cause); } else if (cause instanceof AerospikeException) { AerospikeException ae = (AerospikeException)cause; if (ae.getResultCode() == ResultCode.TIMEOUT) { // Go through retry logic on server timeout command.onServerTimeout(); } else { command.onApplicationError(ae); } } else if (cause instanceof IOException) { command.onNetworkError(new AerospikeException(cause)); } else { command.onApplicationError(new AerospikeException(cause)); } } }
public void onFailure(AerospikeException e) { // Retry up to 2 more times. if (++failCount <= 2) { Throwable t = e.getCause(); // Check for common socket errors. if (t != null && (t instanceof ConnectException || t instanceof IOException)) { console.info("Retrying put: " + key.userKey); try { client.put(eventLoop, this, writePolicy, key, bin); return; } catch (Exception ex) { // Fall through to error case. } } } console.error("Put failed: namespace=%s set=%s key=%s exception=%s", key.namespace, key.setName, key.userKey, e.getMessage()); } }
public void onFailure(AerospikeException e) { console.error("Put failed: " + e.getMessage()); } }
protected final void onApplicationError(AerospikeException ae) { if (ae.keepConnection()) { // Put connection back in pool. complete(); } else { // Close socket to flush out possible garbage. fail(); } notifyFailure(ae); eventLoop.tryDelayQueue(); }
protected void addTransactionally(List<Value> values) { int retries = 10; // retry loop in case of clashing indexes while (retries > 0) { try { inner.update(values); isEmpty = false; return; } catch (AerospikeException ae) { if (ae.getResultCode() == 1402) { retries--; } else { throw ae; } } } }
protected void writeFailure(AerospikeException ae) { if (ae.getResultCode() == ResultCode.TIMEOUT) { counters.write.timeouts.getAndIncrement(); } else { counters.write.errors.getAndIncrement(); if (args.debug) { ae.printStackTrace(); } } }
if (ae.getResultCode() == ResultCode.TIMEOUT) { onNetworkError(new AerospikeException(ioe), false); onApplicationError(new AerospikeException(e));
@Override protected void handleNotFound(int resultCode) { throw new AerospikeException(resultCode); } }
public void onFailure(AerospikeException e) { console.error("Failed to write: namespace=%s set=%s key=%s exception=%s", key.namespace, key.setName, key.userKey, e.getMessage()); }