rename `newBuilder()` to `builder()` (#4407)
* rename `newBuilder()` to `builder()` * code format
This commit is contained in:
parent
22ea557c41
commit
6d9e3618d3
|
@ -12,7 +12,7 @@ import javax.annotation.Nullable;
|
||||||
public interface Cache<K, V> {
|
public interface Cache<K, V> {
|
||||||
|
|
||||||
/** Returns a new {@link CacheBuilder} to configure a {@link Cache}. */
|
/** Returns a new {@link CacheBuilder} to configure a {@link Cache}. */
|
||||||
static CacheBuilder newBuilder() {
|
static CacheBuilder builder() {
|
||||||
return new CacheBuilder();
|
return new CacheBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public abstract class Config {
|
||||||
@Nullable private static volatile Config instance = null;
|
@Nullable private static volatile Config instance = null;
|
||||||
|
|
||||||
/** Start building a new {@link Config} instance. */
|
/** Start building a new {@link Config} instance. */
|
||||||
public static ConfigBuilder newBuilder() {
|
public static ConfigBuilder builder() {
|
||||||
return new ConfigBuilder();
|
return new ConfigBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public abstract class Config {
|
||||||
// this should only happen in library instrumentation
|
// this should only happen in library instrumentation
|
||||||
//
|
//
|
||||||
// no need to synchronize because worst case is creating instance more than once
|
// no need to synchronize because worst case is creating instance more than once
|
||||||
instance = newBuilder().readEnvironmentVariables().readSystemProperties().build();
|
instance = builder().readEnvironmentVariables().readSystemProperties().build();
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public final class SqlStatementSanitizer {
|
||||||
private static final SupportabilityMetrics supportability = SupportabilityMetrics.instance();
|
private static final SupportabilityMetrics supportability = SupportabilityMetrics.instance();
|
||||||
|
|
||||||
private static final Cache<String, SqlStatementInfo> sqlToStatementInfoCache =
|
private static final Cache<String, SqlStatementInfo> sqlToStatementInfoCache =
|
||||||
Cache.newBuilder().setMaximumSize(1000).build();
|
Cache.builder().setMaximumSize(1000).build();
|
||||||
|
|
||||||
public static SqlStatementInfo sanitize(@Nullable String statement) {
|
public static SqlStatementInfo sanitize(@Nullable String statement) {
|
||||||
if (!isStatementSanitizationEnabled() || statement == null) {
|
if (!isStatementSanitizationEnabled() || statement == null) {
|
||||||
|
|
|
@ -12,9 +12,9 @@ import java.util.List;
|
||||||
final class HttpHeaderAttributes {
|
final class HttpHeaderAttributes {
|
||||||
|
|
||||||
private static final Cache<String, AttributeKey<List<String>>> requestKeysCache =
|
private static final Cache<String, AttributeKey<List<String>>> requestKeysCache =
|
||||||
Cache.newBuilder().setMaximumSize(32).build();
|
Cache.builder().setMaximumSize(32).build();
|
||||||
private static final Cache<String, AttributeKey<List<String>>> responseKeysCache =
|
private static final Cache<String, AttributeKey<List<String>>> responseKeysCache =
|
||||||
Cache.newBuilder().setMaximumSize(32).build();
|
Cache.builder().setMaximumSize(32).build();
|
||||||
|
|
||||||
static AttributeKey<List<String>> requestAttributeKey(String headerName) {
|
static AttributeKey<List<String>> requestAttributeKey(String headerName) {
|
||||||
return requestKeysCache.computeIfAbsent(headerName, n -> createKey("request", n));
|
return requestKeysCache.computeIfAbsent(headerName, n -> createKey("request", n));
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class RuntimeVirtualFieldSupplier {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class CacheBasedVirtualField<T, F> extends VirtualField<T, F> {
|
private static final class CacheBasedVirtualField<T, F> extends VirtualField<T, F> {
|
||||||
private final Cache<T, F> cache = Cache.newBuilder().setWeakKeys().build();
|
private final Cache<T, F> cache = Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CacheTest {
|
||||||
class StrongKeys {
|
class StrongKeys {
|
||||||
@Test
|
@Test
|
||||||
void unbounded() {
|
void unbounded() {
|
||||||
Cache<String, String> cache = Cache.newBuilder().build();
|
Cache<String, String> cache = Cache.builder().build();
|
||||||
|
|
||||||
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
||||||
cache.remove("bear");
|
cache.remove("bear");
|
||||||
|
@ -40,7 +40,7 @@ class CacheTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void bounded() {
|
void bounded() {
|
||||||
Cache<String, String> cache = Cache.newBuilder().setMaximumSize(1).build();
|
Cache<String, String> cache = Cache.builder().setMaximumSize(1).build();
|
||||||
|
|
||||||
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
||||||
cache.remove("bear");
|
cache.remove("bear");
|
||||||
|
@ -65,7 +65,7 @@ class CacheTest {
|
||||||
class WeakKeys {
|
class WeakKeys {
|
||||||
@Test
|
@Test
|
||||||
void unbounded() {
|
void unbounded() {
|
||||||
Cache<String, String> cache = Cache.newBuilder().setWeakKeys().build();
|
Cache<String, String> cache = Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
||||||
cache.remove("bear");
|
cache.remove("bear");
|
||||||
|
@ -99,7 +99,7 @@ class CacheTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void bounded() {
|
void bounded() {
|
||||||
Cache<String, String> cache = Cache.newBuilder().setWeakKeys().setMaximumSize(1).build();
|
Cache<String, String> cache = Cache.builder().setWeakKeys().setMaximumSize(1).build();
|
||||||
|
|
||||||
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
assertThat(cache.computeIfAbsent("bear", unused -> "roar")).isEqualTo("roar");
|
||||||
cache.remove("bear");
|
cache.remove("bear");
|
||||||
|
|
|
@ -17,7 +17,7 @@ class PatchCaffeineTest {
|
||||||
void cleanupNotForkJoinTask() {
|
void cleanupNotForkJoinTask() {
|
||||||
AtomicReference<AssertionError> errorRef = new AtomicReference<>();
|
AtomicReference<AssertionError> errorRef = new AtomicReference<>();
|
||||||
Cache<String, String> cache =
|
Cache<String, String> cache =
|
||||||
Cache.newBuilder()
|
Cache.builder()
|
||||||
.setExecutor(
|
.setExecutor(
|
||||||
task -> {
|
task -> {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||||
class ConfigTest {
|
class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetString() {
|
void shouldGetString() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.string", "some text").build();
|
Config config = Config.builder().addProperty("prop.string", "some text").build();
|
||||||
|
|
||||||
assertEquals("some text", config.getString("prop.string"));
|
assertEquals("some text", config.getString("prop.string"));
|
||||||
assertEquals("some text", config.getString("prop.string", "default"));
|
assertEquals("some text", config.getString("prop.string", "default"));
|
||||||
|
@ -43,7 +43,7 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldGetBoolean() {
|
void shouldGetBoolean() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.boolean", "true").build();
|
Config config = Config.builder().addProperty("prop.boolean", "true").build();
|
||||||
|
|
||||||
assertTrue(config.getBoolean("prop.boolean"));
|
assertTrue(config.getBoolean("prop.boolean"));
|
||||||
assertTrue(config.getBoolean("prop.boolean", false));
|
assertTrue(config.getBoolean("prop.boolean", false));
|
||||||
|
@ -54,10 +54,7 @@ class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetInt() {
|
void shouldGetInt() {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder().addProperty("prop.int", "12").addProperty("prop.wrong", "twelve").build();
|
||||||
.addProperty("prop.int", "12")
|
|
||||||
.addProperty("prop.wrong", "twelve")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
assertEquals(12, config.getInt("prop.int"));
|
assertEquals(12, config.getInt("prop.int"));
|
||||||
assertEquals(12, config.getInt("prop.int", 1000));
|
assertEquals(12, config.getInt("prop.int", 1000));
|
||||||
|
@ -68,7 +65,7 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFailOnInvalidInt() {
|
void shouldFailOnInvalidInt() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.wrong", "twelve").build();
|
Config config = Config.builder().addProperty("prop.wrong", "twelve").build();
|
||||||
|
|
||||||
assertThrows(ConfigParsingException.class, () -> config.getInt("prop.wrong"));
|
assertThrows(ConfigParsingException.class, () -> config.getInt("prop.wrong"));
|
||||||
}
|
}
|
||||||
|
@ -76,10 +73,7 @@ class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetLong() {
|
void shouldGetLong() {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder().addProperty("prop.long", "12").addProperty("prop.wrong", "twelve").build();
|
||||||
.addProperty("prop.long", "12")
|
|
||||||
.addProperty("prop.wrong", "twelve")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
assertEquals(12, config.getLong("prop.long"));
|
assertEquals(12, config.getLong("prop.long"));
|
||||||
assertEquals(12, config.getLong("prop.long", 1000));
|
assertEquals(12, config.getLong("prop.long", 1000));
|
||||||
|
@ -90,7 +84,7 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFailOnInvalidLong() {
|
void shouldFailOnInvalidLong() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.wrong", "twelve").build();
|
Config config = Config.builder().addProperty("prop.wrong", "twelve").build();
|
||||||
|
|
||||||
assertThrows(ConfigParsingException.class, () -> config.getLong("prop.wrong"));
|
assertThrows(ConfigParsingException.class, () -> config.getLong("prop.wrong"));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +92,7 @@ class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetDouble() {
|
void shouldGetDouble() {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder()
|
||||||
.addProperty("prop.double", "12.345")
|
.addProperty("prop.double", "12.345")
|
||||||
.addProperty("prop.wrong", "twelve point something")
|
.addProperty("prop.wrong", "twelve point something")
|
||||||
.build();
|
.build();
|
||||||
|
@ -112,7 +106,7 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFailOnInvalidDouble() {
|
void shouldFailOnInvalidDouble() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.wrong", "twelve point something").build();
|
Config config = Config.builder().addProperty("prop.wrong", "twelve point something").build();
|
||||||
|
|
||||||
assertThrows(ConfigParsingException.class, () -> config.getDouble("prop.wrong"));
|
assertThrows(ConfigParsingException.class, () -> config.getDouble("prop.wrong"));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +114,7 @@ class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetDuration_defaultUnit() {
|
void shouldGetDuration_defaultUnit() {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder()
|
||||||
.addProperty("prop.duration", "5000")
|
.addProperty("prop.duration", "5000")
|
||||||
.addProperty("prop.wrong", "hundred days")
|
.addProperty("prop.wrong", "hundred days")
|
||||||
.build();
|
.build();
|
||||||
|
@ -134,32 +128,32 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFailOnInvalidDuration() {
|
void shouldFailOnInvalidDuration() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.wrong", "hundred days").build();
|
Config config = Config.builder().addProperty("prop.wrong", "hundred days").build();
|
||||||
|
|
||||||
assertThrows(ConfigParsingException.class, () -> config.getDuration("prop.wrong"));
|
assertThrows(ConfigParsingException.class, () -> config.getDuration("prop.wrong"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldGetDuration_variousUnits() {
|
void shouldGetDuration_variousUnits() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.duration", "100ms").build();
|
Config config = Config.builder().addProperty("prop.duration", "100ms").build();
|
||||||
assertEquals(Duration.ofMillis(100), config.getDuration("prop.duration"));
|
assertEquals(Duration.ofMillis(100), config.getDuration("prop.duration"));
|
||||||
|
|
||||||
config = Config.newBuilder().addProperty("prop.duration", "100s").build();
|
config = Config.builder().addProperty("prop.duration", "100s").build();
|
||||||
assertEquals(Duration.ofSeconds(100), config.getDuration("prop.duration"));
|
assertEquals(Duration.ofSeconds(100), config.getDuration("prop.duration"));
|
||||||
|
|
||||||
config = Config.newBuilder().addProperty("prop.duration", "100m").build();
|
config = Config.builder().addProperty("prop.duration", "100m").build();
|
||||||
assertEquals(Duration.ofMinutes(100), config.getDuration("prop.duration"));
|
assertEquals(Duration.ofMinutes(100), config.getDuration("prop.duration"));
|
||||||
|
|
||||||
config = Config.newBuilder().addProperty("prop.duration", "100h").build();
|
config = Config.builder().addProperty("prop.duration", "100h").build();
|
||||||
assertEquals(Duration.ofHours(100), config.getDuration("prop.duration"));
|
assertEquals(Duration.ofHours(100), config.getDuration("prop.duration"));
|
||||||
|
|
||||||
config = Config.newBuilder().addProperty("prop.duration", "100d").build();
|
config = Config.builder().addProperty("prop.duration", "100d").build();
|
||||||
assertEquals(Duration.ofDays(100), config.getDuration("prop.duration"));
|
assertEquals(Duration.ofDays(100), config.getDuration("prop.duration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldGetList() {
|
void shouldGetList() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.list", "one, two ,three").build();
|
Config config = Config.builder().addProperty("prop.list", "one, two ,three").build();
|
||||||
|
|
||||||
assertEquals(asList("one", "two", "three"), config.getList("prop.list"));
|
assertEquals(asList("one", "two", "three"), config.getList("prop.list"));
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -172,7 +166,7 @@ class ConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldGetMap() {
|
void shouldGetMap() {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder()
|
||||||
.addProperty("prop.map", "one=1, two=2")
|
.addProperty("prop.map", "one=1, two=2")
|
||||||
.addProperty("prop.wrong", "one=1, but not two!")
|
.addProperty("prop.wrong", "one=1, but not two!")
|
||||||
.addProperty("prop.trailing", "one=1,")
|
.addProperty("prop.trailing", "one=1,")
|
||||||
|
@ -191,7 +185,7 @@ class ConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFailOnInvalidMap() {
|
void shouldFailOnInvalidMap() {
|
||||||
Config config = Config.newBuilder().addProperty("prop.wrong", "one=1, but not two!").build();
|
Config config = Config.builder().addProperty("prop.wrong", "one=1, but not two!").build();
|
||||||
|
|
||||||
assertThrows(ConfigParsingException.class, () -> config.getMap("prop.wrong"));
|
assertThrows(ConfigParsingException.class, () -> config.getMap("prop.wrong"));
|
||||||
}
|
}
|
||||||
|
@ -199,7 +193,7 @@ class ConfigTest {
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ArgumentsSource(AgentDebugParams.class)
|
@ArgumentsSource(AgentDebugParams.class)
|
||||||
void shouldCheckIfAgentDebugModeIsEnabled(String propertyValue, boolean expected) {
|
void shouldCheckIfAgentDebugModeIsEnabled(String propertyValue, boolean expected) {
|
||||||
Config config = Config.newBuilder().addProperty("otel.javaagent.debug", propertyValue).build();
|
Config config = Config.builder().addProperty("otel.javaagent.debug", propertyValue).build();
|
||||||
|
|
||||||
assertEquals(expected, config.isAgentDebugEnabled());
|
assertEquals(expected, config.isAgentDebugEnabled());
|
||||||
}
|
}
|
||||||
|
@ -217,7 +211,7 @@ class ConfigTest {
|
||||||
void shouldCheckIfInstrumentationIsEnabled(
|
void shouldCheckIfInstrumentationIsEnabled(
|
||||||
List<String> names, boolean defaultEnabled, boolean expected) {
|
List<String> names, boolean defaultEnabled, boolean expected) {
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder()
|
||||||
.addProperty("otel.instrumentation.order.enabled", "true")
|
.addProperty("otel.instrumentation.order.enabled", "true")
|
||||||
.addProperty("otel.instrumentation.test-prop.enabled", "true")
|
.addProperty("otel.instrumentation.test-prop.enabled", "true")
|
||||||
.addProperty("otel.instrumentation.disabled-prop.enabled", "false")
|
.addProperty("otel.instrumentation.disabled-prop.enabled", "false")
|
||||||
|
|
|
@ -78,7 +78,7 @@ class SupportabilityMetricsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Config configWithJavaagentDebug(boolean enabled) {
|
private static Config configWithJavaagentDebug(boolean enabled) {
|
||||||
return Config.newBuilder()
|
return Config.builder()
|
||||||
.readProperties(Collections.singletonMap("otel.javaagent.debug", Boolean.toString(enabled)))
|
.readProperties(Collections.singletonMap("otel.javaagent.debug", Boolean.toString(enabled)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.guava.GuavaAsyncOperationEndStrategy;
|
||||||
public final class InstrumentationHelper {
|
public final class InstrumentationHelper {
|
||||||
static {
|
static {
|
||||||
asyncOperationEndStrategy =
|
asyncOperationEndStrategy =
|
||||||
GuavaAsyncOperationEndStrategy.newBuilder()
|
GuavaAsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(
|
.setCaptureExperimentalSpanAttributes(
|
||||||
Config.get()
|
Config.get()
|
||||||
.getBoolean("otel.instrumentation.guava.experimental-span-attributes", false))
|
.getBoolean("otel.instrumentation.guava.experimental-span-attributes", false))
|
||||||
|
|
|
@ -20,10 +20,10 @@ public final class GuavaAsyncOperationEndStrategy implements AsyncOperationEndSt
|
||||||
AttributeKey.booleanKey("guava.canceled");
|
AttributeKey.booleanKey("guava.canceled");
|
||||||
|
|
||||||
public static GuavaAsyncOperationEndStrategy create() {
|
public static GuavaAsyncOperationEndStrategy create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GuavaAsyncOperationEndStrategyBuilder newBuilder() {
|
public static GuavaAsyncOperationEndStrategyBuilder builder() {
|
||||||
return new GuavaAsyncOperationEndStrategyBuilder();
|
return new GuavaAsyncOperationEndStrategyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class GuavaAsyncOperationEndStrategyTest extends Specification {
|
||||||
|
|
||||||
def underTest = GuavaAsyncOperationEndStrategy.create()
|
def underTest = GuavaAsyncOperationEndStrategy.create()
|
||||||
|
|
||||||
def underTestWithExperimentalAttributes = GuavaAsyncOperationEndStrategy.newBuilder()
|
def underTestWithExperimentalAttributes = GuavaAsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(true)
|
.setCaptureExperimentalSpanAttributes(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public final class FutureListenerWrappers {
|
||||||
// to the key, that means it's no longer used (referenced) by the netty future anyways.
|
// to the key, that means it's no longer used (referenced) by the netty future anyways.
|
||||||
private static final Cache<
|
private static final Cache<
|
||||||
GenericFutureListener<? extends Future<?>>, GenericFutureListener<? extends Future<?>>>
|
GenericFutureListener<? extends Future<?>>, GenericFutureListener<? extends Future<?>>>
|
||||||
wrappers = Cache.newBuilder().setWeakKeys().setWeakValues().build();
|
wrappers = Cache.builder().setWeakKeys().setWeakValues().build();
|
||||||
|
|
||||||
private static final ClassValue<Boolean> shouldWrap =
|
private static final ClassValue<Boolean> shouldWrap =
|
||||||
new ClassValue<Boolean>() {
|
new ClassValue<Boolean>() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class HooksInstrumentation implements TypeInstrumentation {
|
||||||
|
|
||||||
@Advice.OnMethodExit(suppress = Throwable.class)
|
@Advice.OnMethodExit(suppress = Throwable.class)
|
||||||
public static void postStaticInitializer() {
|
public static void postStaticInitializer() {
|
||||||
ContextPropagationOperator.newBuilder()
|
ContextPropagationOperator.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(
|
.setCaptureExperimentalSpanAttributes(
|
||||||
Config.get()
|
Config.get()
|
||||||
.getBoolean("otel.instrumentation.reactor.experimental-span-attributes", false))
|
.getBoolean("otel.instrumentation.reactor.experimental-span-attributes", false))
|
||||||
|
|
|
@ -40,10 +40,10 @@ import reactor.core.publisher.Operators;
|
||||||
public final class ContextPropagationOperator {
|
public final class ContextPropagationOperator {
|
||||||
|
|
||||||
public static ContextPropagationOperator create() {
|
public static ContextPropagationOperator create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ContextPropagationOperatorBuilder newBuilder() {
|
public static ContextPropagationOperatorBuilder builder() {
|
||||||
return new ContextPropagationOperatorBuilder();
|
return new ContextPropagationOperatorBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public final class ContextPropagationOperator {
|
||||||
|
|
||||||
ContextPropagationOperator(boolean captureExperimentalSpanAttributes) {
|
ContextPropagationOperator(boolean captureExperimentalSpanAttributes) {
|
||||||
this.asyncOperationEndStrategy =
|
this.asyncOperationEndStrategy =
|
||||||
ReactorAsyncOperationEndStrategy.newBuilder()
|
ReactorAsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ public final class ReactorAsyncOperationEndStrategy implements AsyncOperationEnd
|
||||||
AttributeKey.booleanKey("reactor.canceled");
|
AttributeKey.booleanKey("reactor.canceled");
|
||||||
|
|
||||||
public static ReactorAsyncOperationEndStrategy create() {
|
public static ReactorAsyncOperationEndStrategy create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ReactorAsyncOperationEndStrategyBuilder newBuilder() {
|
public static ReactorAsyncOperationEndStrategyBuilder builder() {
|
||||||
return new ReactorAsyncOperationEndStrategyBuilder();
|
return new ReactorAsyncOperationEndStrategyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ReactorAsyncOperationEndStrategyTest extends Specification {
|
||||||
|
|
||||||
def underTest = ReactorAsyncOperationEndStrategy.create()
|
def underTest = ReactorAsyncOperationEndStrategy.create()
|
||||||
|
|
||||||
def underTestWithExperimentalAttributes = ReactorAsyncOperationEndStrategy.newBuilder()
|
def underTestWithExperimentalAttributes = ReactorAsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(true)
|
.setCaptureExperimentalSpanAttributes(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public final class TracingAssemblyActivation {
|
||||||
|
|
||||||
public static void activate(Class<?> clz) {
|
public static void activate(Class<?> clz) {
|
||||||
if (activated.get(clz).compareAndSet(false, true)) {
|
if (activated.get(clz).compareAndSet(false, true)) {
|
||||||
TracingAssembly.newBuilder()
|
TracingAssembly.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(
|
.setCaptureExperimentalSpanAttributes(
|
||||||
Config.get()
|
Config.get()
|
||||||
.getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false))
|
.getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false))
|
||||||
|
|
|
@ -29,10 +29,10 @@ public final class RxJava2AsyncOperationEndStrategy implements AsyncOperationEnd
|
||||||
AttributeKey.booleanKey("rxjava.canceled");
|
AttributeKey.booleanKey("rxjava.canceled");
|
||||||
|
|
||||||
public static RxJava2AsyncOperationEndStrategy create() {
|
public static RxJava2AsyncOperationEndStrategy create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RxJava2AsyncOperationEndStrategyBuilder newBuilder() {
|
public static RxJava2AsyncOperationEndStrategyBuilder builder() {
|
||||||
return new RxJava2AsyncOperationEndStrategyBuilder();
|
return new RxJava2AsyncOperationEndStrategyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ public final class TracingAssembly {
|
||||||
private static boolean enabled;
|
private static boolean enabled;
|
||||||
|
|
||||||
public static TracingAssembly create() {
|
public static TracingAssembly create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TracingAssemblyBuilder newBuilder() {
|
public static TracingAssemblyBuilder builder() {
|
||||||
return new TracingAssemblyBuilder();
|
return new TracingAssemblyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public final class TracingAssembly {
|
||||||
|
|
||||||
private static void enableWithSpanStrategy(boolean captureExperimentalSpanAttributes) {
|
private static void enableWithSpanStrategy(boolean captureExperimentalSpanAttributes) {
|
||||||
asyncOperationEndStrategy =
|
asyncOperationEndStrategy =
|
||||||
RxJava2AsyncOperationEndStrategy.newBuilder()
|
RxJava2AsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class RxJava2AsyncOperationEndStrategyTest extends Specification {
|
||||||
|
|
||||||
def underTest = RxJava2AsyncOperationEndStrategy.create()
|
def underTest = RxJava2AsyncOperationEndStrategy.create()
|
||||||
|
|
||||||
def underTestWithExperimentalAttributes = RxJava2AsyncOperationEndStrategy.newBuilder()
|
def underTestWithExperimentalAttributes = RxJava2AsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(true)
|
.setCaptureExperimentalSpanAttributes(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public final class TracingAssemblyActivation {
|
||||||
|
|
||||||
public static void activate(Class<?> clz) {
|
public static void activate(Class<?> clz) {
|
||||||
if (activated.get(clz).compareAndSet(false, true)) {
|
if (activated.get(clz).compareAndSet(false, true)) {
|
||||||
TracingAssembly.newBuilder()
|
TracingAssembly.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(
|
.setCaptureExperimentalSpanAttributes(
|
||||||
Config.get()
|
Config.get()
|
||||||
.getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false))
|
.getBoolean("otel.instrumentation.rxjava.experimental-span-attributes", false))
|
||||||
|
|
|
@ -29,10 +29,10 @@ public final class RxJava3AsyncOperationEndStrategy implements AsyncOperationEnd
|
||||||
AttributeKey.booleanKey("rxjava.canceled");
|
AttributeKey.booleanKey("rxjava.canceled");
|
||||||
|
|
||||||
public static RxJava3AsyncOperationEndStrategy create() {
|
public static RxJava3AsyncOperationEndStrategy create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RxJava3AsyncOperationEndStrategyBuilder newBuilder() {
|
public static RxJava3AsyncOperationEndStrategyBuilder builder() {
|
||||||
return new RxJava3AsyncOperationEndStrategyBuilder();
|
return new RxJava3AsyncOperationEndStrategyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ public final class TracingAssembly {
|
||||||
private static boolean enabled;
|
private static boolean enabled;
|
||||||
|
|
||||||
public static TracingAssembly create() {
|
public static TracingAssembly create() {
|
||||||
return newBuilder().build();
|
return builder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TracingAssemblyBuilder newBuilder() {
|
public static TracingAssemblyBuilder builder() {
|
||||||
return new TracingAssemblyBuilder();
|
return new TracingAssemblyBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ public final class TracingAssembly {
|
||||||
|
|
||||||
private static void enableWithSpanStrategy(boolean captureExperimentalSpanAttributes) {
|
private static void enableWithSpanStrategy(boolean captureExperimentalSpanAttributes) {
|
||||||
asyncOperationEndStrategy =
|
asyncOperationEndStrategy =
|
||||||
RxJava3AsyncOperationEndStrategy.newBuilder()
|
RxJava3AsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class RxJava3AsyncOperationEndStrategyTest extends Specification {
|
||||||
|
|
||||||
def underTest = RxJava3AsyncOperationEndStrategy.create()
|
def underTest = RxJava3AsyncOperationEndStrategy.create()
|
||||||
|
|
||||||
def underTestWithExperimentalAttributes = RxJava3AsyncOperationEndStrategy.newBuilder()
|
def underTestWithExperimentalAttributes = RxJava3AsyncOperationEndStrategy.builder()
|
||||||
.setCaptureExperimentalSpanAttributes(true)
|
.setCaptureExperimentalSpanAttributes(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
public final class HelperResources {
|
public final class HelperResources {
|
||||||
|
|
||||||
private static final Cache<ClassLoader, Map<String, URL>> RESOURCES =
|
private static final Cache<ClassLoader, Map<String, URL>> RESOURCES =
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
/** Registers the {@code payload} to be available to instrumentation at {@code path}. */
|
/** Registers the {@code payload} to be available to instrumentation at {@code path}. */
|
||||||
public static void register(ClassLoader classLoader, String path, URL url) {
|
public static void register(ClassLoader classLoader, String path, URL url) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
||||||
class ClassLoaderHasClassesNamedMatcher extends ElementMatcher.Junction.AbstractBase<ClassLoader> {
|
class ClassLoaderHasClassesNamedMatcher extends ElementMatcher.Junction.AbstractBase<ClassLoader> {
|
||||||
|
|
||||||
private final Cache<ClassLoader, Boolean> cache =
|
private final Cache<ClassLoader, Boolean> cache =
|
||||||
Cache.newBuilder().setWeakKeys().setMaximumSize(25).build();
|
Cache.builder().setWeakKeys().setMaximumSize(25).build();
|
||||||
|
|
||||||
private final String[] resources;
|
private final String[] resources;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class ConfigInitializer {
|
||||||
|
|
||||||
// visible for testing
|
// visible for testing
|
||||||
static Config create(Properties spiConfiguration, Properties configurationFile) {
|
static Config create(Properties spiConfiguration, Properties configurationFile) {
|
||||||
return Config.newBuilder()
|
return Config.builder()
|
||||||
.readProperties(spiConfiguration)
|
.readProperties(spiConfiguration)
|
||||||
.readProperties(configurationFile)
|
.readProperties(configurationFile)
|
||||||
.readEnvironmentVariables()
|
.readEnvironmentVariables()
|
||||||
|
|
|
@ -264,7 +264,7 @@ final class VirtualFieldImplementationsGenerator {
|
||||||
@SuppressWarnings({"UnusedMethod", "UnusedVariable", "MethodCanBeStatic"})
|
@SuppressWarnings({"UnusedMethod", "UnusedVariable", "MethodCanBeStatic"})
|
||||||
static final class VirtualFieldImplementationTemplate extends VirtualField<Object, Object> {
|
static final class VirtualFieldImplementationTemplate extends VirtualField<Object, Object> {
|
||||||
private static final VirtualFieldImplementationTemplate INSTANCE =
|
private static final VirtualFieldImplementationTemplate INSTANCE =
|
||||||
new VirtualFieldImplementationTemplate(Cache.newBuilder().setWeakKeys().build());
|
new VirtualFieldImplementationTemplate(Cache.builder().setWeakKeys().build());
|
||||||
|
|
||||||
private final Cache<Object, Object> map;
|
private final Cache<Object, Object> map;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class IgnoredClassLoadersMatcher extends ElementMatcher.Junction.Abstract
|
||||||
|
|
||||||
/* Cache of classloader-instance -> (true|false). True = skip instrumentation. False = safe to instrument. */
|
/* Cache of classloader-instance -> (true|false). True = skip instrumentation. False = safe to instrument. */
|
||||||
private static final Cache<ClassLoader, Boolean> skipCache =
|
private static final Cache<ClassLoader, Boolean> skipCache =
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
private final Trie<IgnoreAllow> ignoredClassLoaders;
|
private final Trie<IgnoreAllow> ignoredClassLoaders;
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ import io.opentelemetry.javaagent.extension.ignore.IgnoredTypesBuilder;
|
||||||
import io.opentelemetry.javaagent.tooling.util.Trie;
|
import io.opentelemetry.javaagent.tooling.util.Trie;
|
||||||
|
|
||||||
public class IgnoredTypesBuilderImpl implements IgnoredTypesBuilder {
|
public class IgnoredTypesBuilderImpl implements IgnoredTypesBuilder {
|
||||||
private final Trie.Builder<IgnoreAllow> ignoredTypesTrie = Trie.newBuilder();
|
private final Trie.Builder<IgnoreAllow> ignoredTypesTrie = Trie.builder();
|
||||||
private final Trie.Builder<IgnoreAllow> ignoredClassLoadersTrie = Trie.newBuilder();
|
private final Trie.Builder<IgnoreAllow> ignoredClassLoadersTrie = Trie.builder();
|
||||||
private final Trie.Builder<Boolean> ignoredTasksTrie = Trie.newBuilder();
|
private final Trie.Builder<Boolean> ignoredTasksTrie = Trie.builder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IgnoredTypesBuilder ignoreClass(String classNameOrPrefix) {
|
public IgnoredTypesBuilder ignoreClass(String classNameOrPrefix) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javax.annotation.Nullable;
|
||||||
public interface Trie<V> {
|
public interface Trie<V> {
|
||||||
|
|
||||||
/** Start building a trie. */
|
/** Start building a trie. */
|
||||||
static <V> Builder<V> newBuilder() {
|
static <V> Builder<V> builder() {
|
||||||
return new TrieImpl.BuilderImpl<>();
|
return new TrieImpl.BuilderImpl<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class OpenTelemetryInstallerTest extends Specification {
|
||||||
def "should initialize noop"() {
|
def "should initialize noop"() {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
def config = Config.newBuilder()
|
def config = Config.builder()
|
||||||
.readProperties([
|
.readProperties([
|
||||||
(OpenTelemetryInstaller.JAVAAGENT_NOOP_CONFIG) : "true",
|
(OpenTelemetryInstaller.JAVAAGENT_NOOP_CONFIG) : "true",
|
||||||
(OpenTelemetryInstaller.JAVAAGENT_ENABLED_CONFIG): "true"
|
(OpenTelemetryInstaller.JAVAAGENT_ENABLED_CONFIG): "true"
|
||||||
|
@ -43,7 +43,7 @@ class OpenTelemetryInstallerTest extends Specification {
|
||||||
def "should NOT initialize noop"() {
|
def "should NOT initialize noop"() {
|
||||||
|
|
||||||
given:
|
given:
|
||||||
def config = Config.newBuilder()
|
def config = Config.builder()
|
||||||
.readProperties([
|
.readProperties([
|
||||||
(OpenTelemetryInstaller.JAVAAGENT_NOOP_CONFIG) : "true",
|
(OpenTelemetryInstaller.JAVAAGENT_NOOP_CONFIG) : "true",
|
||||||
(OpenTelemetryInstaller.JAVAAGENT_ENABLED_CONFIG): "false"
|
(OpenTelemetryInstaller.JAVAAGENT_ENABLED_CONFIG): "false"
|
||||||
|
|
|
@ -176,6 +176,6 @@ class ConfigPropertiesAdapterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConfigProperties createConfig(Map<String, String> properties) {
|
private static ConfigProperties createConfig(Map<String, String> properties) {
|
||||||
return new ConfigPropertiesAdapter(Config.newBuilder().readProperties(properties).build());
|
return new ConfigPropertiesAdapter(Config.builder().readProperties(properties).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class UserExcludedClassesConfigurerTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldAddNothingToBuilderWhenPropertyIsEmpty() {
|
void shouldAddNothingToBuilderWhenPropertyIsEmpty() {
|
||||||
// when
|
// when
|
||||||
underTest.configure(Config.newBuilder().build(), builder);
|
underTest.configure(Config.builder().build(), builder);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
verifyNoInteractions(builder);
|
verifyNoInteractions(builder);
|
||||||
|
@ -37,7 +37,7 @@ class UserExcludedClassesConfigurerTest {
|
||||||
void shouldIgnoreClassesAndPackages() {
|
void shouldIgnoreClassesAndPackages() {
|
||||||
// given
|
// given
|
||||||
Config config =
|
Config config =
|
||||||
Config.newBuilder()
|
Config.builder()
|
||||||
.readProperties(
|
.readProperties(
|
||||||
singletonMap(
|
singletonMap(
|
||||||
EXCLUDED_CLASSES_CONFIG,
|
EXCLUDED_CLASSES_CONFIG,
|
||||||
|
|
|
@ -16,7 +16,7 @@ class TrieTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldMatchExactString() {
|
void shouldMatchExactString() {
|
||||||
Trie<Integer> trie =
|
Trie<Integer> trie =
|
||||||
Trie.<Integer>newBuilder().put("abc", 0).put("abcd", 10).put("abcde", 20).build();
|
Trie.<Integer>builder().put("abc", 0).put("abcd", 10).put("abcde", 20).build();
|
||||||
|
|
||||||
assertNull(trie.getOrNull("ab"));
|
assertNull(trie.getOrNull("ab"));
|
||||||
assertFalse(trie.contains("ab"));
|
assertFalse(trie.contains("ab"));
|
||||||
|
@ -29,7 +29,7 @@ class TrieTest {
|
||||||
@Test
|
@Test
|
||||||
void shouldReturnLastMatchedValue() {
|
void shouldReturnLastMatchedValue() {
|
||||||
Trie<Integer> trie =
|
Trie<Integer> trie =
|
||||||
Trie.<Integer>newBuilder().put("abc", 0).put("abcde", 10).put("abcdfgh", 20).build();
|
Trie.<Integer>builder().put("abc", 0).put("abcde", 10).put("abcdfgh", 20).build();
|
||||||
|
|
||||||
assertNull(trie.getOrNull("ababababa"));
|
assertNull(trie.getOrNull("ababababa"));
|
||||||
assertEquals(0, trie.getOrNull("abcd"));
|
assertEquals(0, trie.getOrNull("abcd"));
|
||||||
|
@ -39,14 +39,14 @@ class TrieTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldOverwritePreviousValue() {
|
void shouldOverwritePreviousValue() {
|
||||||
Trie<Integer> trie = Trie.<Integer>newBuilder().put("abc", 0).put("abc", 12).build();
|
Trie<Integer> trie = Trie.<Integer>builder().put("abc", 0).put("abc", 12).build();
|
||||||
|
|
||||||
assertEquals(12, trie.getOrNull("abc"));
|
assertEquals(12, trie.getOrNull("abc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldReturnDefaultValueWhenNotMatched() {
|
void shouldReturnDefaultValueWhenNotMatched() {
|
||||||
Trie<Integer> trie = Trie.<Integer>newBuilder().put("abc", 42).build();
|
Trie<Integer> trie = Trie.<Integer>builder().put("abc", 42).build();
|
||||||
|
|
||||||
assertEquals(-1, trie.getOrDefault("acdc", -1));
|
assertEquals(-1, trie.getOrDefault("acdc", -1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class HelperInjector implements Transformer {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Cache<Class<?>, Boolean> injectedClasses =
|
private static final Cache<Class<?>, Boolean> injectedClasses =
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
private final String requestingName;
|
private final String requestingName;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class HelperInjector implements Transformer {
|
||||||
private final Map<String, byte[]> dynamicTypeMap = new LinkedHashMap<>();
|
private final Map<String, byte[]> dynamicTypeMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
private final Cache<ClassLoader, Boolean> injectedClassLoaders =
|
private final Cache<ClassLoader, Boolean> injectedClassLoaders =
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
private final List<WeakReference<Object>> helperModules = new CopyOnWriteArrayList<>();
|
private final List<WeakReference<Object>> helperModules = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,13 @@ public class AgentCachingPoolStrategy implements AgentBuilder.PoolStrategy {
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
final Cache<ClassLoader, WeakReference<ClassLoader>> loaderRefCache =
|
final Cache<ClassLoader, WeakReference<ClassLoader>> loaderRefCache =
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
Cache.builder().setWeakKeys().build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single shared Type.Resolution cache -- uses a composite key -- conceptually of loader & name
|
* Single shared Type.Resolution cache -- uses a composite key -- conceptually of loader & name
|
||||||
*/
|
*/
|
||||||
final Cache<TypeCacheKey, TypePool.Resolution> sharedResolutionCache =
|
final Cache<TypeCacheKey, TypePool.Resolution> sharedResolutionCache =
|
||||||
Cache.newBuilder().setMaximumSize(TYPE_CAPACITY).build();
|
Cache.builder().setMaximumSize(TYPE_CAPACITY).build();
|
||||||
|
|
||||||
// fast path for bootstrap
|
// fast path for bootstrap
|
||||||
final SharedResolutionCacheAdapter bootstrapCacheProvider =
|
final SharedResolutionCacheAdapter bootstrapCacheProvider =
|
||||||
|
|
|
@ -31,8 +31,7 @@ import net.bytebuddy.pool.TypePool;
|
||||||
/** Matches a set of references against a classloader. */
|
/** Matches a set of references against a classloader. */
|
||||||
public final class ReferenceMatcher {
|
public final class ReferenceMatcher {
|
||||||
|
|
||||||
private final Cache<ClassLoader, Boolean> mismatchCache =
|
private final Cache<ClassLoader, Boolean> mismatchCache = Cache.builder().setWeakKeys().build();
|
||||||
Cache.newBuilder().setWeakKeys().build();
|
|
||||||
private final Map<String, ClassRef> references;
|
private final Map<String, ClassRef> references;
|
||||||
private final Set<String> helperClassNames;
|
private final Set<String> helperClassNames;
|
||||||
private final HelperClassPredicate helperClassPredicate;
|
private final HelperClassPredicate helperClassPredicate;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TestAgentListener implements AgentBuilder.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Trie<IgnoreAllow> buildOtherConfiguredIgnores() {
|
private static Trie<IgnoreAllow> buildOtherConfiguredIgnores() {
|
||||||
Config config = Config.newBuilder().build();
|
Config config = Config.builder().build();
|
||||||
IgnoredTypesBuilderImpl builder = new IgnoredTypesBuilderImpl();
|
IgnoredTypesBuilderImpl builder = new IgnoredTypesBuilderImpl();
|
||||||
for (IgnoredTypesConfigurer configurer :
|
for (IgnoredTypesConfigurer configurer :
|
||||||
SafeServiceLoader.loadOrdered(IgnoredTypesConfigurer.class)) {
|
SafeServiceLoader.loadOrdered(IgnoredTypesConfigurer.class)) {
|
||||||
|
|
Loading…
Reference in New Issue