public void deleteAll(String collectionName) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("execute deleteCollection in database {} collection {} with id {}", this.databaseName, collectionName); } try { documentDbFactory.getDocumentClient() .deleteCollection(getCollectionLink(this.databaseName, collectionName), null); if (this.collectionCache.contains(collectionName)) { this.collectionCache.remove(collectionName); } } catch (DocumentClientException ex) { if (ex.getStatusCode() == 404) { LOGGER.warn("deleteAll in database {} collection {} met NOTFOUND error {}", this.databaseName, collectionName, ex.getMessage()); } else { throw new RuntimeException("deleteAll exception", ex); } } }
public void deleteAll(String collectionName) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("execute deleteCollection in database {} collection {}", this.databaseName, collectionName); } try { documentDbFactory.getDocumentClient() .deleteCollection(getCollectionLink(this.databaseName, collectionName), null); if (this.collectionCache.contains(collectionName)) { this.collectionCache.remove(collectionName); } } catch (DocumentClientException ex) { if (ex.getStatusCode() == 404) { LOGGER.warn("deleteAll in database {} collection {} met NOTFOUND error {}", this.databaseName, collectionName, ex.getMessage()); } else { throw new DocumentDBAccessException("deleteAll exception", ex); } } }
private Observable<Long> handleRetryAttemptInternal(DocumentClientException e, int attemptNumber) throws DocumentClientException { RetryPolicy retryPolicy = null; if (e.getStatusCode() == HttpConstants.StatusCodes.BADREQUEST && e.getSubStatusCode() != null && e.getSubStatusCode() == HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH) { // If HttpStatusCode is 404 (NotFound) and SubStatusCode is // 1001 (PartitionKeyMismatch), invoke the partition key mismatch retry policy retryPolicy = keyMismatchRetryPolicy; } if (retryPolicy == null || !retryPolicy.shouldRetry(e)) { LOGGER.trace("Execution encontured exception: {}, status code {} sub status code {}. Won't retry!", e.getMessage(), e.getStatusCode(), e.getSubStatusCode()); return Observable.error(e); } LOGGER.trace("Execution encontured exception: {}, status code {} sub status code {}. Will retry in {}ms", e.getMessage(), e.getStatusCode(), e.getSubStatusCode(), retryPolicy.getRetryAfterInMilliseconds()); long waitTime = retryPolicy.getRetryAfterInMilliseconds(); return Observable.just(waitTime); } }
e.getMessage(), e.getStatusCode(), e.getSubStatusCode()); return Observable.error(e); e.getMessage(), e.getStatusCode(), e.getSubStatusCode(), retryPolicy.getRetryAfterInMilliseconds());