public String toString() { return "call to class " + processor.getClass().getName() + " (id: " + getDocumentProcessorId() + ")"; }
public Call(DocumentProcessor processor, String chainName, Statistics manager, Metric metric) { this.processor = processor; if (chainName == null) chainName = ""; chainName = chainName.replaceAll("[^\\p{Alnum}]", "_"); docCounterName = "docprocessor_" + chainName + "_" + getDocumentProcessorId().stringValue().replaceAll("[^\\p{Alnum}]", "_") + "_documents"; procTimeCounterName = "docprocessor_" + chainName + "_" + getDocumentProcessorId().stringValue().replaceAll("[^\\p{Alnum}]", "_") + "_proctime"; docCounter = new Counter(docCounterName, manager, false); procTimeCounter = new Counter(procTimeCounterName, manager, false, null, true); this.metric = metric; }
/** * Returns the next call to this processor id, or null if no such calls are * left */ public Call findCall(final ComponentId processorId) { for (final Iterator<Call> i = iterator(); i.hasNext();) { final Call call = i.next(); if (call.getDocumentProcessorId().equals(processorId)) { return call; } } return null; }
private void logProgress(Processing processing, DocumentProcessor.Progress progress, Call call) { StringBuilder message = new StringBuilder(); boolean first = true; message.append(call.getDocumentProcessorId()).append(" of class ") .append(call.getDocumentProcessor().getClass().getSimpleName()).append(" returned ").append(progress) .append(" for the documents: ["); for (DocumentOperation op : processing.getDocumentOperations()) { if (first) { first = false; } else { message.append(", "); } if (op instanceof DocumentPut) { message.append(Utf8.toString(JsonWriter.toByteArray(((DocumentPut) op).getDocument()))); } else { message.append(op.toString()); } } message.append("]"); log.log(LogLevel.SPAM, message.toString()); }