public TracerPool getTracerPool() { if (tracerPool == null) { throwClientError(toString() + " is closed."); } return tracerPool; }
public TracerPool getTracerPool() { if (tracerPool == null) { throwClientError(toString() + " is closed."); } return tracerPool; }
public TracerPool getTracerPool() { if (tracerPool == null) { throwClientError(toString() + " is closed."); } return tracerPool; }
/** * Add a new Tracer. */ synchronized void addTracer(Tracer tracer) { if (curTracers.add(tracer)) { LOG.trace(toString() + ": adding tracer " + tracer.toString()); } }
/** * Remove a SpanReceiver. * * @param sampler The sampler to remove. */ public synchronized boolean removeSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; int j = 0; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { Sampler[] newSamplers = new Sampler[samplers.length - 1]; System.arraycopy(samplers, 0, newSamplers, 0, i); System.arraycopy(samplers, i + 1, newSamplers, i, samplers.length - i - 1); curSamplers = newSamplers; return true; } } return false; }
/** * Remove a Sampler. * * @param sampler The sampler to remove. * @return True only if the sampler was removed. */ public synchronized boolean removeSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { Sampler[] newSamplers = new Sampler[samplers.length - 1]; System.arraycopy(samplers, 0, newSamplers, 0, i); System.arraycopy(samplers, i + 1, newSamplers, i, samplers.length - i - 1); curSamplers = newSamplers; return true; } } return false; }
/** * Remove a Sampler. * * @param sampler The sampler to remove. * @return True only if the sampler was removed. */ public synchronized boolean removeSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { Sampler[] newSamplers = new Sampler[samplers.length - 1]; System.arraycopy(samplers, 0, newSamplers, 0, i); System.arraycopy(samplers, i + 1, newSamplers, i, samplers.length - i - 1); curSamplers = newSamplers; return true; } } return false; }
/** * Add a new Tracer. */ synchronized void addTracer(Tracer tracer) { if (curTracers.add(tracer)) { LOG.trace(toString() + ": adding tracer " + tracer.toString()); } }
/** * Add a new Tracer. */ synchronized void addTracer(Tracer tracer) { if (curTracers.add(tracer)) { LOG.trace(toString() + ": adding tracer " + tracer.toString()); } }
/** * Add a new Sampler. * * @param sampler The new sampler to add. * You cannot add a particular Sampler object more * than once. You may add multiple Sampler objects * of the same type, although this is not recommended. * * @return True if the sampler was added; false if it already had * been added earlier. */ public synchronized boolean addSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { return false; } } Sampler[] newSamplers = Arrays.copyOf(samplers, samplers.length + 1); newSamplers[samplers.length] = sampler; curSamplers = newSamplers; return true; }
/** * Add a new Sampler. * * @param sampler The new sampler to add. * You cannot add a particular Sampler object more * than once. You may add multiple Sampler objects * of the same type, although this is not recommended. * * @return True if the sampler was added; false if it already had * been added earlier. */ public synchronized boolean addSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; int j = 0; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { return false; } } Sampler[] newSamplers = Arrays.copyOf(samplers, samplers.length + 1); newSamplers[samplers.length] = sampler; curSamplers = newSamplers; return true; }
/** * Add a new Sampler. * * @param sampler The new sampler to add. * You cannot add a particular Sampler object more * than once. You may add multiple Sampler objects * of the same type, although this is not recommended. * * @return True if the sampler was added; false if it already had * been added earlier. */ public synchronized boolean addSampler(Sampler sampler) { if (tracerPool == null) { throwClientError(toString() + " is closed."); } Sampler[] samplers = curSamplers; for (int i = 0; i < samplers.length; i++) { if (samplers[i] == sampler) { return false; } } Sampler[] newSamplers = Arrays.copyOf(samplers, samplers.length + 1); newSamplers[samplers.length] = sampler; curSamplers = newSamplers; return true; }
/** * Remove a Tracer. * * If the Tracer removed was the last one, we will close all the SpanReceiver * objects that we're managing. */ synchronized void removeTracer(Tracer tracer) { if (curTracers.remove(tracer)) { LOG.trace(toString() + ": removing tracer " + tracer.toString()); if (curTracers.size() == 0) { removeAndCloseAllSpanReceivers(); } } }
/** * Remove a Tracer. * * If the Tracer removed was the last one, we will close all the SpanReceiver * objects that we're managing. */ synchronized void removeTracer(Tracer tracer) { if (curTracers.remove(tracer)) { LOG.trace(toString() + ": removing tracer " + tracer.toString()); if (curTracers.size() == 0) { removeAndCloseAllSpanReceivers(); } } }
/** * Remove a Tracer. * * If the Tracer removed was the last one, we will close all the SpanReceiver * objects that we're managing. */ synchronized void removeTracer(Tracer tracer) { if (curTracers.remove(tracer)) { LOG.trace(toString() + ": removing tracer " + tracer.toString()); if (curTracers.size() == 0) { removeAndCloseAllSpanReceivers(); } } }
void closeScope(TraceScope scope) { TraceScope curScope = threadLocalScope.get(); if (curScope != scope) { throwClientError("Can't close TraceScope for " + scope.getSpan().toJson() + " because it is not the current " + "TraceScope in thread " + Thread.currentThread().getName()); } if (tracerPool == null) { throwClientError(toString() + " is closed."); } SpanReceiver[] receivers = tracerPool.getReceivers(); if (receivers == null) { throwClientError(toString() + " is closed."); } ThreadContext context = threadContext.get(); context.popScope(); threadLocalScope.set(scope.getParent()); scope.setParent(null); Span span = scope.getSpan(); span.stop(); for (SpanReceiver receiver : receivers) { receiver.receiveSpan(span); } }
void closeScope(TraceScope scope) { TraceScope curScope = threadLocalScope.get(); if (curScope != scope) { throwClientError("Can't close TraceScope for " + scope.getSpan().toJson() + " because it is not the current " + "TraceScope in thread " + Thread.currentThread().getName()); } if (tracerPool == null) { throwClientError(toString() + " is closed."); } SpanReceiver[] receivers = tracerPool.getReceivers(); if (receivers == null) { throwClientError(toString() + " is closed."); } ThreadContext context = threadContext.get(); context.popScope(); threadLocalScope.set(scope.getParent()); scope.setParent(null); Span span = scope.getSpan(); span.stop(); for (SpanReceiver receiver : receivers) { receiver.receiveSpan(span); } }
void closeScope(TraceScope scope) { TraceScope curScope = threadLocalScope.get(); if (curScope != scope) { throwClientError("Can't close TraceScope for " + scope.getSpan().toJson() + " because it is not the current " + "TraceScope in thread " + Thread.currentThread().getName()); } if (tracerPool == null) { throwClientError(toString() + " is closed."); } SpanReceiver[] receivers = tracerPool.getReceivers(); if (receivers == null) { throwClientError(toString() + " is closed."); } ThreadContext context = threadContext.get(); context.popScope(); threadLocalScope.set(scope.getParent()); scope.setParent(null); Span span = scope.getSpan(); span.stop(); for (SpanReceiver receiver : receivers) { receiver.receiveSpan(span); } }