/** * Adds a list of child nodes to this. * * @param children The children to add. * @return This, to allow chaining. */ public TraceNode addChildren(List<TraceNode> children) { for (TraceNode child : children) { addChild(child); } return this; }
/** * Convenience method to add a child node containing a note to this. * * @param note The note to assign to the child. * @return This, to allow chaining. */ public TraceNode addChild(String note) { return addChild(new TraceNode(note)); }
/** * Normalize this tree. This will transform all equivalent trees into the same form. Note that this will also * perform an implicit compaction of the tree. * * @return This, to allow chaining. */ public TraceNode normalize() { compact(); sort(); if (note != null || !strict) { TraceNode child = new TraceNode(); child.swap(this); addChild(child); strict = true; } return this; }
@Override public ContentChannel handleResponse(Response response) { synchronized (this) { if (response instanceof MbusResponse) { Reply reply = ((MbusResponse)response).getReply(); requestTrace.addChild(reply.getTrace().getRoot()); replies.add(reply); } if (--numPending != 0) { return null; } } requestMsg.getTrace().getRoot().addChild(requestTrace); Reply reply = DocumentProtocol.merge(replies); Response mbusResponse = new MbusResponse(StatusCodes.fromMbusReply(reply), reply); ResponseDispatch.newInstance(mbusResponse).dispatch(responseHandler); return null; }
/** * Sets the reply of this routing node. This method also updates the internal state of this node; it is tagged for * resending if the reply has only transient errors, and the reply's {@link Trace} is copied. This method <u>does * not</u> call the parent node's {@link #notifyMerge()}. * * @param reply The reply to set. */ public void setReply(Reply reply) { if (reply != null) { shouldRetry = resender != null && resender.shouldRetry(reply); trace.getRoot().addChild(reply.getTrace().getRoot()); reply.getTrace().clear(); } this.reply = reply; }
private void handleCreateVisitorReply(CreateVisitorReply reply) { CreateVisitorMessage msg = (CreateVisitorMessage)reply.getMessage(); BucketId superbucket = msg.getBuckets().get(0); BucketId subBucketProgress = reply.getLastBucket(); log.log(LogLevel.DEBUG, sessionName + ": received CreateVisitorReply for bucket " + superbucket + " with progress " + subBucketProgress); progress.getIterator().update(superbucket, subBucketProgress); params.getControlHandler().onProgress(progress.getToken()); statistics.add(reply.getVisitorStatistics()); params.getControlHandler().onVisitorStatistics(statistics); trace.getRoot().addChild(reply.getTrace().getRoot()); if (params.getDynamicallyIncreaseMaxBucketsPerVisitor() && (reply.getVisitorStatistics().getDocumentsReturned() < params.getMaxFirstPassHits() / 2.0)) { // Attempt to increase parallelism to reduce latency of visiting // Ensure new count is within [1, 128] int newMaxBuckets = Math.max(Math.min((int)(params.getMaxBucketsPerVisitor() * params.getDynamicMaxBucketsIncreaseFactor()), 128), 1); params.setMaxBucketsPerVisitor(newMaxBuckets); log.log(LogLevel.DEBUG, sessionName + ": increasing max buckets per visitor to " + params.getMaxBucketsPerVisitor()); } }
trace.swap(empty); } else if (trace.getLevel() > 0) { trace.getRoot().addChild(reply.getTrace().getRoot()); trace.getRoot().normalize();
@Override public void run() { Reply reply = decode(envelope.reply.getProtocol(), payload, Reply.class); reply.setRetryDelay(envelope.reply.getRetryDelay()); reply.getTrace().getRoot().addChild(TraceNode.decode(envelope.reply.getTrace().getRoot().encode())); for (int i = 0, len = envelope.reply.getNumErrors(); i < len; ++i) { Error error = envelope.reply.getError(i); reply.addError(new Error(error.getCode(), error.getMessage(), error.getService() != null ? error.getService() : envelope.sender.hostId)); } owner.deliverReply(reply, envelope.parent.recipient); } });
trace.getRoot().addChild(TraceNode.decode(replyTrace));
trace.getRoot().addChild(TraceNode.decode(root.field(TRACE_F).asString()));