List of usage examples for org.apache.cassandra.utils ConcurrentBiMap inverse
public Map<V, K> inverse()
From source file:org.jesterj.ingest.processors.ElasticSender.java
License:Apache License
void handleRetryResult(Exception e, Map<ActionFuture, ActionRequest> futures, ActionFuture individualRetry, ConcurrentBiMap<Document, ActionRequest> oldBatch) { ActionRequest request = futures.get(individualRetry); Document document = oldBatch.inverse().get(request); String id = document.getId(); ThreadContext.put(JesterJAppender.JJ_INGEST_DOCID, id); try {// www . jav a2s . c o m ActionWriteResponse resp = (ActionWriteResponse) individualRetry.actionGet(); checkResponse(document, resp); } catch (Exception ex) { log.info(Status.ERROR.getMarker(), "{} could not be sent to elastic because of {}", id, ex.getMessage()); log.error("Error sending to elastic!", e); } }
From source file:org.jesterj.ingest.processors.SendToSolrCloudProcessor.java
License:Apache License
@Override protected void individualFallbackOperation(ConcurrentBiMap<Document, SolrInputDocument> oldBatch, Exception e) { // TODO: send in bisected batches to avoid massive traffic down due to one doc when batches are large for (Document document : oldBatch.keySet()) { ThreadContext.put(JesterJAppender.JJ_INGEST_DOCID, document.getId()); try {/*w ww. ja va 2 s . c o m*/ SolrInputDocument doc = oldBatch.get(document); if (doc instanceof Delete) { solrClient.deleteById(oldBatch.inverse().get(doc).getId()); log.info(Status.INDEXED.getMarker(), "{} deleted from solr successfully", document.getId()); } else { solrClient.add(doc); log.info(Status.INDEXED.getMarker(), "{} sent to solr successfully", document.getId()); } } catch (IOException | SolrServerException e1) { log.info(Status.ERROR.getMarker(), "{} could not be sent to solr because of {}", document.getId(), e1.getMessage()); log.error("Error sending to with solr!", e1); } } }