List of usage examples for org.apache.cassandra.utils ConcurrentBiMap values
public Collection<V> values()
From source file:org.jesterj.ingest.processors.ElasticSender.java
License:Apache License
@Override protected void individualFallbackOperation(ConcurrentBiMap<Document, ActionRequest> oldBatch, Exception e) { Map<ActionFuture, ActionRequest> futures = new HashMap<>(); for (ActionRequest request : oldBatch.values()) { if (request instanceof UpdateRequest) { futures.put(getClient().update((UpdateRequest) request), request); } else if (request instanceof DeleteRequest) { futures.put(getClient().delete((DeleteRequest) request), request); } else if (request instanceof IndexRequest) { futures.put(getClient().index((IndexRequest) request), request); } else {/* w w w . j a v a2s.com*/ throw new IllegalStateException("Should only have generated index, update and delete " + "actions, but found" + request.getClass()); } } for (ActionFuture individualRetry : futures.keySet()) { handleRetryResult(e, futures, individualRetry, oldBatch); } }
From source file:org.jesterj.ingest.processors.ElasticSender.java
License:Apache License
@Override protected void batchOperation(ConcurrentBiMap<Document, ActionRequest> oldBatch) throws Exception { BulkRequestBuilder builder = getClient().prepareBulk(); for (ActionRequest request : oldBatch.values()) { if (request instanceof UpdateRequest) { builder.add((UpdateRequest) request); } else if (request instanceof DeleteRequest) { builder.add((DeleteRequest) request); } else if (request instanceof IndexRequest) { builder.add((IndexRequest) request); } else {/*from w ww . jav a 2s .c om*/ throw new IllegalStateException("Should only have generated index, update and delete " + "actions, but found" + request.getClass()); } } BulkResponse bulkResponse = builder.get(); if (bulkResponse.hasFailures()) { throw new ESBulkFail(); } else { for (Document doc : oldBatch.keySet()) { log.info("Successfully sent {} to elastic", doc.getId()); } } }