diff --git a/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/MockTracingTelemetry.java b/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/MockTracingTelemetry.java index 66c71dba4e909..7f22757eecd29 100644 --- a/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/MockTracingTelemetry.java +++ b/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/MockTracingTelemetry.java @@ -13,14 +13,13 @@ import org.opensearch.telemetry.tracing.TracingTelemetry; import org.opensearch.telemetry.tracing.attributes.Attributes; -import java.util.concurrent.atomic.AtomicBoolean; - /** * Mock {@link TracingTelemetry} implementation for testing. */ public class MockTracingTelemetry implements TracingTelemetry { private final SpanProcessor spanProcessor = new StrictCheckSpanProcessor(); + /** * Base constructor. */ diff --git a/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/StrictCheckSpanProcessor.java b/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/StrictCheckSpanProcessor.java index 46b7503a0b8d1..ac26336de6f08 100644 --- a/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/StrictCheckSpanProcessor.java +++ b/test/telemetry/src/main/java/org/opensearch/test/telemetry/tracing/StrictCheckSpanProcessor.java @@ -8,7 +8,6 @@ package org.opensearch.test.telemetry.tracing; -import java.util.concurrent.atomic.AtomicBoolean; import org.opensearch.telemetry.tracing.Span; import org.opensearch.test.telemetry.tracing.validators.AllSpansAreEndedProperly; import org.opensearch.test.telemetry.tracing.validators.AllSpansHaveUniqueId; @@ -18,6 +17,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; /** * Strict check span processor to validate the spans. @@ -37,10 +37,9 @@ private void initProcessor() { private static Map spanMap = new ConcurrentHashMap<>(); private static final AtomicBoolean shutdown = new AtomicBoolean(false); - @Override public void onStart(Span span) { - if(shutdown.get() == false) { + if (shutdown.get() == false) { spanMap.put(span.getSpanId(), toMockSpanData(span)); } } @@ -80,8 +79,8 @@ private MockSpanData toMockSpanData(Span span) { /** * shutdown */ - public static synchronized void shutdown(){ - if(shutdown.get() == false){ + public static synchronized void shutdown() { + if (shutdown.get() == false) { shutdown.set(true); } } @@ -89,8 +88,8 @@ public static synchronized void shutdown(){ /** * restartTheProcessor */ - public static synchronized void restartTheProcessor(){ - if(shutdown.get() == true){ + public static synchronized void restartTheProcessor() { + if (shutdown.get() == true) { shutdown.set(false); } }