All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.glowroot.common.config.ImmutableAdvancedConfig Maven / Gradle / Ivy

There is a newer version: 0.9.28
Show newest version
package org.glowroot.common.config;

import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonCreator;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonIgnore;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonInclude;
import org.glowroot.agent.shaded.fasterxml.jackson.annotation.JsonProperty;
import org.glowroot.agent.shaded.google.common.base.MoreObjects;
import org.glowroot.agent.shaded.google.common.base.Preconditions;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.glowroot.agent.shaded.google.common.primitives.Booleans;
import java.util.ArrayList;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;

/**
 * Immutable implementation of {@link AdvancedConfig}.
 * 

* Use builder to create immutable instances: * {@code ImmutableAdvancedConfig.builder()}. */ @SuppressWarnings("all") @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "AdvancedConfig"}) @Immutable public final class ImmutableAdvancedConfig extends AdvancedConfig { private final boolean timerWrapperMethods; private final boolean weavingTimer; private final int immediatePartialStoreThresholdSeconds; private final int maxAggregateTransactionsPerTransactionType; private final int maxAggregateQueriesPerQueryType; private final int maxTraceEntriesPerTransaction; private final int maxStackTraceSamplesPerTransaction; private final boolean captureThreadInfo; private final boolean captureGcActivity; private final int mbeanGaugeNotFoundDelaySeconds; private final String version; private ImmutableAdvancedConfig(ImmutableAdvancedConfig.Builder builder) { if (builder.timerWrapperMethodsIsSet()) { initShim.timerWrapperMethods(builder.timerWrapperMethods); } if (builder.weavingTimerIsSet()) { initShim.weavingTimer(builder.weavingTimer); } if (builder.immediatePartialStoreThresholdSecondsIsSet()) { initShim.immediatePartialStoreThresholdSeconds(builder.immediatePartialStoreThresholdSeconds); } if (builder.maxAggregateTransactionsPerTransactionTypeIsSet()) { initShim.maxAggregateTransactionsPerTransactionType(builder.maxAggregateTransactionsPerTransactionType); } if (builder.maxAggregateQueriesPerQueryTypeIsSet()) { initShim.maxAggregateQueriesPerQueryType(builder.maxAggregateQueriesPerQueryType); } if (builder.maxTraceEntriesPerTransactionIsSet()) { initShim.maxTraceEntriesPerTransaction(builder.maxTraceEntriesPerTransaction); } if (builder.maxStackTraceSamplesPerTransactionIsSet()) { initShim.maxStackTraceSamplesPerTransaction(builder.maxStackTraceSamplesPerTransaction); } if (builder.captureThreadInfoIsSet()) { initShim.captureThreadInfo(builder.captureThreadInfo); } if (builder.captureGcActivityIsSet()) { initShim.captureGcActivity(builder.captureGcActivity); } if (builder.mbeanGaugeNotFoundDelaySecondsIsSet()) { initShim.mbeanGaugeNotFoundDelaySeconds(builder.mbeanGaugeNotFoundDelaySeconds); } this.timerWrapperMethods = initShim.timerWrapperMethods(); this.weavingTimer = initShim.weavingTimer(); this.immediatePartialStoreThresholdSeconds = initShim.immediatePartialStoreThresholdSeconds(); this.maxAggregateTransactionsPerTransactionType = initShim.maxAggregateTransactionsPerTransactionType(); this.maxAggregateQueriesPerQueryType = initShim.maxAggregateQueriesPerQueryType(); this.maxTraceEntriesPerTransaction = initShim.maxTraceEntriesPerTransaction(); this.maxStackTraceSamplesPerTransaction = initShim.maxStackTraceSamplesPerTransaction(); this.captureThreadInfo = initShim.captureThreadInfo(); this.captureGcActivity = initShim.captureGcActivity(); this.mbeanGaugeNotFoundDelaySeconds = initShim.mbeanGaugeNotFoundDelaySeconds(); this.version = Preconditions.checkNotNull(super.version()); this.initShim = null; } private static final int STAGE_INITIALIZING = -1; private static final int STAGE_UNINITIALIZED = 0; private static final int STAGE_INITIALIZED = 1; private volatile InitShim initShim = new InitShim(); private final class InitShim { private boolean timerWrapperMethods; private byte timerWrapperMethodsStage; boolean timerWrapperMethods() { if (timerWrapperMethodsStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (timerWrapperMethodsStage == STAGE_UNINITIALIZED) { timerWrapperMethodsStage = STAGE_INITIALIZING; this.timerWrapperMethods = ImmutableAdvancedConfig.super.timerWrapperMethods(); timerWrapperMethodsStage = STAGE_INITIALIZED; } return timerWrapperMethods; } boolean timerWrapperMethods(boolean value) { this.timerWrapperMethods = value; timerWrapperMethodsStage = STAGE_INITIALIZED; return value; } private boolean weavingTimer; private byte weavingTimerStage; boolean weavingTimer() { if (weavingTimerStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (weavingTimerStage == STAGE_UNINITIALIZED) { weavingTimerStage = STAGE_INITIALIZING; this.weavingTimer = ImmutableAdvancedConfig.super.weavingTimer(); weavingTimerStage = STAGE_INITIALIZED; } return weavingTimer; } boolean weavingTimer(boolean value) { this.weavingTimer = value; weavingTimerStage = STAGE_INITIALIZED; return value; } private int immediatePartialStoreThresholdSeconds; private byte immediatePartialStoreThresholdSecondsStage; int immediatePartialStoreThresholdSeconds() { if (immediatePartialStoreThresholdSecondsStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (immediatePartialStoreThresholdSecondsStage == STAGE_UNINITIALIZED) { immediatePartialStoreThresholdSecondsStage = STAGE_INITIALIZING; this.immediatePartialStoreThresholdSeconds = ImmutableAdvancedConfig.super.immediatePartialStoreThresholdSeconds(); immediatePartialStoreThresholdSecondsStage = STAGE_INITIALIZED; } return immediatePartialStoreThresholdSeconds; } int immediatePartialStoreThresholdSeconds(int value) { this.immediatePartialStoreThresholdSeconds = value; immediatePartialStoreThresholdSecondsStage = STAGE_INITIALIZED; return value; } private int maxAggregateTransactionsPerTransactionType; private byte maxAggregateTransactionsPerTransactionTypeStage; int maxAggregateTransactionsPerTransactionType() { if (maxAggregateTransactionsPerTransactionTypeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxAggregateTransactionsPerTransactionTypeStage == STAGE_UNINITIALIZED) { maxAggregateTransactionsPerTransactionTypeStage = STAGE_INITIALIZING; this.maxAggregateTransactionsPerTransactionType = ImmutableAdvancedConfig.super.maxAggregateTransactionsPerTransactionType(); maxAggregateTransactionsPerTransactionTypeStage = STAGE_INITIALIZED; } return maxAggregateTransactionsPerTransactionType; } int maxAggregateTransactionsPerTransactionType(int value) { this.maxAggregateTransactionsPerTransactionType = value; maxAggregateTransactionsPerTransactionTypeStage = STAGE_INITIALIZED; return value; } private int maxAggregateQueriesPerQueryType; private byte maxAggregateQueriesPerQueryTypeStage; int maxAggregateQueriesPerQueryType() { if (maxAggregateQueriesPerQueryTypeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxAggregateQueriesPerQueryTypeStage == STAGE_UNINITIALIZED) { maxAggregateQueriesPerQueryTypeStage = STAGE_INITIALIZING; this.maxAggregateQueriesPerQueryType = ImmutableAdvancedConfig.super.maxAggregateQueriesPerQueryType(); maxAggregateQueriesPerQueryTypeStage = STAGE_INITIALIZED; } return maxAggregateQueriesPerQueryType; } int maxAggregateQueriesPerQueryType(int value) { this.maxAggregateQueriesPerQueryType = value; maxAggregateQueriesPerQueryTypeStage = STAGE_INITIALIZED; return value; } private int maxTraceEntriesPerTransaction; private byte maxTraceEntriesPerTransactionStage; int maxTraceEntriesPerTransaction() { if (maxTraceEntriesPerTransactionStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxTraceEntriesPerTransactionStage == STAGE_UNINITIALIZED) { maxTraceEntriesPerTransactionStage = STAGE_INITIALIZING; this.maxTraceEntriesPerTransaction = ImmutableAdvancedConfig.super.maxTraceEntriesPerTransaction(); maxTraceEntriesPerTransactionStage = STAGE_INITIALIZED; } return maxTraceEntriesPerTransaction; } int maxTraceEntriesPerTransaction(int value) { this.maxTraceEntriesPerTransaction = value; maxTraceEntriesPerTransactionStage = STAGE_INITIALIZED; return value; } private int maxStackTraceSamplesPerTransaction; private byte maxStackTraceSamplesPerTransactionStage; int maxStackTraceSamplesPerTransaction() { if (maxStackTraceSamplesPerTransactionStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (maxStackTraceSamplesPerTransactionStage == STAGE_UNINITIALIZED) { maxStackTraceSamplesPerTransactionStage = STAGE_INITIALIZING; this.maxStackTraceSamplesPerTransaction = ImmutableAdvancedConfig.super.maxStackTraceSamplesPerTransaction(); maxStackTraceSamplesPerTransactionStage = STAGE_INITIALIZED; } return maxStackTraceSamplesPerTransaction; } int maxStackTraceSamplesPerTransaction(int value) { this.maxStackTraceSamplesPerTransaction = value; maxStackTraceSamplesPerTransactionStage = STAGE_INITIALIZED; return value; } private boolean captureThreadInfo; private byte captureThreadInfoStage; boolean captureThreadInfo() { if (captureThreadInfoStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (captureThreadInfoStage == STAGE_UNINITIALIZED) { captureThreadInfoStage = STAGE_INITIALIZING; this.captureThreadInfo = ImmutableAdvancedConfig.super.captureThreadInfo(); captureThreadInfoStage = STAGE_INITIALIZED; } return captureThreadInfo; } boolean captureThreadInfo(boolean value) { this.captureThreadInfo = value; captureThreadInfoStage = STAGE_INITIALIZED; return value; } private boolean captureGcActivity; private byte captureGcActivityStage; boolean captureGcActivity() { if (captureGcActivityStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (captureGcActivityStage == STAGE_UNINITIALIZED) { captureGcActivityStage = STAGE_INITIALIZING; this.captureGcActivity = ImmutableAdvancedConfig.super.captureGcActivity(); captureGcActivityStage = STAGE_INITIALIZED; } return captureGcActivity; } boolean captureGcActivity(boolean value) { this.captureGcActivity = value; captureGcActivityStage = STAGE_INITIALIZED; return value; } private int mbeanGaugeNotFoundDelaySeconds; private byte mbeanGaugeNotFoundDelaySecondsStage; int mbeanGaugeNotFoundDelaySeconds() { if (mbeanGaugeNotFoundDelaySecondsStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (mbeanGaugeNotFoundDelaySecondsStage == STAGE_UNINITIALIZED) { mbeanGaugeNotFoundDelaySecondsStage = STAGE_INITIALIZING; this.mbeanGaugeNotFoundDelaySeconds = ImmutableAdvancedConfig.super.mbeanGaugeNotFoundDelaySeconds(); mbeanGaugeNotFoundDelaySecondsStage = STAGE_INITIALIZED; } return mbeanGaugeNotFoundDelaySeconds; } int mbeanGaugeNotFoundDelaySeconds(int value) { this.mbeanGaugeNotFoundDelaySeconds = value; mbeanGaugeNotFoundDelaySecondsStage = STAGE_INITIALIZED; return value; } private String version; private byte versionStage; String version() { if (versionStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (versionStage == STAGE_UNINITIALIZED) { versionStage = STAGE_INITIALIZING; this.version = Preconditions.checkNotNull(ImmutableAdvancedConfig.super.version()); versionStage = STAGE_INITIALIZED; } return version; } private String formatInitCycleMessage() { ArrayList attributes = Lists.newArrayList();; if (timerWrapperMethodsStage == STAGE_INITIALIZING) attributes.add("timerWrapperMethods"); if (weavingTimerStage == STAGE_INITIALIZING) attributes.add("weavingTimer"); if (immediatePartialStoreThresholdSecondsStage == STAGE_INITIALIZING) attributes.add("immediatePartialStoreThresholdSeconds"); if (maxAggregateTransactionsPerTransactionTypeStage == STAGE_INITIALIZING) attributes.add("maxAggregateTransactionsPerTransactionType"); if (maxAggregateQueriesPerQueryTypeStage == STAGE_INITIALIZING) attributes.add("maxAggregateQueriesPerQueryType"); if (maxTraceEntriesPerTransactionStage == STAGE_INITIALIZING) attributes.add("maxTraceEntriesPerTransaction"); if (maxStackTraceSamplesPerTransactionStage == STAGE_INITIALIZING) attributes.add("maxStackTraceSamplesPerTransaction"); if (captureThreadInfoStage == STAGE_INITIALIZING) attributes.add("captureThreadInfo"); if (captureGcActivityStage == STAGE_INITIALIZING) attributes.add("captureGcActivity"); if (mbeanGaugeNotFoundDelaySecondsStage == STAGE_INITIALIZING) attributes.add("mbeanGaugeNotFoundDelaySeconds"); if (versionStage == STAGE_INITIALIZING) attributes.add("version"); return "Cannot build AdvancedConfig, attribute initializers form cycle" + attributes; } } private ImmutableAdvancedConfig( boolean timerWrapperMethods, boolean weavingTimer, int immediatePartialStoreThresholdSeconds, int maxAggregateTransactionsPerTransactionType, int maxAggregateQueriesPerQueryType, int maxTraceEntriesPerTransaction, int maxStackTraceSamplesPerTransaction, boolean captureThreadInfo, boolean captureGcActivity, int mbeanGaugeNotFoundDelaySeconds) { this.timerWrapperMethods = timerWrapperMethods; this.weavingTimer = weavingTimer; this.immediatePartialStoreThresholdSeconds = immediatePartialStoreThresholdSeconds; this.maxAggregateTransactionsPerTransactionType = maxAggregateTransactionsPerTransactionType; this.maxAggregateQueriesPerQueryType = maxAggregateQueriesPerQueryType; this.maxTraceEntriesPerTransaction = maxTraceEntriesPerTransaction; this.maxStackTraceSamplesPerTransaction = maxStackTraceSamplesPerTransaction; this.captureThreadInfo = captureThreadInfo; this.captureGcActivity = captureGcActivity; this.mbeanGaugeNotFoundDelaySeconds = mbeanGaugeNotFoundDelaySeconds; this.version = Preconditions.checkNotNull(super.version()); this.initShim = null; } /** * @return value of {@code timerWrapperMethods} attribute */ @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Override public boolean timerWrapperMethods() { return initShim != null ? initShim.timerWrapperMethods() : timerWrapperMethods; } /** * @return value of {@code weavingTimer} attribute */ @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Override public boolean weavingTimer() { return initShim != null ? initShim.weavingTimer() : weavingTimer; } /** * @return value of {@code immediatePartialStoreThresholdSeconds} attribute */ @JsonProperty @Override public int immediatePartialStoreThresholdSeconds() { return initShim != null ? initShim.immediatePartialStoreThresholdSeconds() : immediatePartialStoreThresholdSeconds; } /** * @return value of {@code maxAggregateTransactionsPerTransactionType} attribute */ @JsonProperty @Override public int maxAggregateTransactionsPerTransactionType() { return initShim != null ? initShim.maxAggregateTransactionsPerTransactionType() : maxAggregateTransactionsPerTransactionType; } /** * @return value of {@code maxAggregateQueriesPerQueryType} attribute */ @JsonProperty @Override public int maxAggregateQueriesPerQueryType() { return initShim != null ? initShim.maxAggregateQueriesPerQueryType() : maxAggregateQueriesPerQueryType; } /** * @return value of {@code maxTraceEntriesPerTransaction} attribute */ @JsonProperty @Override public int maxTraceEntriesPerTransaction() { return initShim != null ? initShim.maxTraceEntriesPerTransaction() : maxTraceEntriesPerTransaction; } /** * @return value of {@code maxStackTraceSamplesPerTransaction} attribute */ @JsonProperty @Override public int maxStackTraceSamplesPerTransaction() { return initShim != null ? initShim.maxStackTraceSamplesPerTransaction() : maxStackTraceSamplesPerTransaction; } /** * @return value of {@code captureThreadInfo} attribute */ @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Override public boolean captureThreadInfo() { return initShim != null ? initShim.captureThreadInfo() : captureThreadInfo; } /** * @return value of {@code captureGcActivity} attribute */ @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Override public boolean captureGcActivity() { return initShim != null ? initShim.captureGcActivity() : captureGcActivity; } /** * @return value of {@code mbeanGaugeNotFoundDelaySeconds} attribute */ @JsonProperty @Override public int mbeanGaugeNotFoundDelaySeconds() { return initShim != null ? initShim.mbeanGaugeNotFoundDelaySeconds() : mbeanGaugeNotFoundDelaySeconds; } /** * @return computed at construction value of {@code version} attribute */ @JsonProperty @JsonIgnore @Override public String version() { return initShim != null ? initShim.version() : version; } /** * Copy current immutable object by setting value for {@link AdvancedConfig#timerWrapperMethods() timerWrapperMethods}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for timerWrapperMethods * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withTimerWrapperMethods(boolean value) { if (this.timerWrapperMethods == value) return this; boolean newValue = value; return new ImmutableAdvancedConfig( newValue, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#weavingTimer() weavingTimer}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for weavingTimer * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withWeavingTimer(boolean value) { if (this.weavingTimer == value) return this; boolean newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, newValue, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#immediatePartialStoreThresholdSeconds() immediatePartialStoreThresholdSeconds}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for immediatePartialStoreThresholdSeconds * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withImmediatePartialStoreThresholdSeconds(int value) { if (this.immediatePartialStoreThresholdSeconds == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, newValue, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#maxAggregateTransactionsPerTransactionType() maxAggregateTransactionsPerTransactionType}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for maxAggregateTransactionsPerTransactionType * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withMaxAggregateTransactionsPerTransactionType(int value) { if (this.maxAggregateTransactionsPerTransactionType == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, newValue, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#maxAggregateQueriesPerQueryType() maxAggregateQueriesPerQueryType}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for maxAggregateQueriesPerQueryType * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withMaxAggregateQueriesPerQueryType(int value) { if (this.maxAggregateQueriesPerQueryType == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, newValue, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#maxTraceEntriesPerTransaction() maxTraceEntriesPerTransaction}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for maxTraceEntriesPerTransaction * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withMaxTraceEntriesPerTransaction(int value) { if (this.maxTraceEntriesPerTransaction == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, newValue, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#maxStackTraceSamplesPerTransaction() maxStackTraceSamplesPerTransaction}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for maxStackTraceSamplesPerTransaction * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withMaxStackTraceSamplesPerTransaction(int value) { if (this.maxStackTraceSamplesPerTransaction == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, newValue, this.captureThreadInfo, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#captureThreadInfo() captureThreadInfo}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for captureThreadInfo * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withCaptureThreadInfo(boolean value) { if (this.captureThreadInfo == value) return this; boolean newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, newValue, this.captureGcActivity, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#captureGcActivity() captureGcActivity}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for captureGcActivity * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withCaptureGcActivity(boolean value) { if (this.captureGcActivity == value) return this; boolean newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, newValue, this.mbeanGaugeNotFoundDelaySeconds); } /** * Copy current immutable object by setting value for {@link AdvancedConfig#mbeanGaugeNotFoundDelaySeconds() mbeanGaugeNotFoundDelaySeconds}. * Value equality check is used to prevent copying of the same value by returning {@code this}. * @param value new value for mbeanGaugeNotFoundDelaySeconds * @return modified copy of the {@code this} object */ public final ImmutableAdvancedConfig withMbeanGaugeNotFoundDelaySeconds(int value) { if (this.mbeanGaugeNotFoundDelaySeconds == value) return this; int newValue = value; return new ImmutableAdvancedConfig( this.timerWrapperMethods, this.weavingTimer, this.immediatePartialStoreThresholdSeconds, this.maxAggregateTransactionsPerTransactionType, this.maxAggregateQueriesPerQueryType, this.maxTraceEntriesPerTransaction, this.maxStackTraceSamplesPerTransaction, this.captureThreadInfo, this.captureGcActivity, newValue); } /** * This instance is equal to instances of {@code ImmutableAdvancedConfig} with equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableAdvancedConfig && equalTo((ImmutableAdvancedConfig) another); } private boolean equalTo(ImmutableAdvancedConfig another) { return timerWrapperMethods == another.timerWrapperMethods && weavingTimer == another.weavingTimer && immediatePartialStoreThresholdSeconds == another.immediatePartialStoreThresholdSeconds && maxAggregateTransactionsPerTransactionType == another.maxAggregateTransactionsPerTransactionType && maxAggregateQueriesPerQueryType == another.maxAggregateQueriesPerQueryType && maxTraceEntriesPerTransaction == another.maxTraceEntriesPerTransaction && maxStackTraceSamplesPerTransaction == another.maxStackTraceSamplesPerTransaction && captureThreadInfo == another.captureThreadInfo && captureGcActivity == another.captureGcActivity && mbeanGaugeNotFoundDelaySeconds == another.mbeanGaugeNotFoundDelaySeconds && version.equals(another.version); } /** * Computes hash code from attributes: {@code timerWrapperMethods}, {@code weavingTimer}, {@code immediatePartialStoreThresholdSeconds}, {@code maxAggregateTransactionsPerTransactionType}, {@code maxAggregateQueriesPerQueryType}, {@code maxTraceEntriesPerTransaction}, {@code maxStackTraceSamplesPerTransaction}, {@code captureThreadInfo}, {@code captureGcActivity}, {@code mbeanGaugeNotFoundDelaySeconds}, {@code version}. * @return hashCode value */ @Override public int hashCode() { int h = 31; h = h * 17 + Booleans.hashCode(timerWrapperMethods); h = h * 17 + Booleans.hashCode(weavingTimer); h = h * 17 + immediatePartialStoreThresholdSeconds; h = h * 17 + maxAggregateTransactionsPerTransactionType; h = h * 17 + maxAggregateQueriesPerQueryType; h = h * 17 + maxTraceEntriesPerTransaction; h = h * 17 + maxStackTraceSamplesPerTransaction; h = h * 17 + Booleans.hashCode(captureThreadInfo); h = h * 17 + Booleans.hashCode(captureGcActivity); h = h * 17 + mbeanGaugeNotFoundDelaySeconds; h = h * 17 + version.hashCode(); return h; } /** * Prints immutable value {@code AdvancedConfig...} with attribute values, * excluding any non-generated and auxiliary attributes. * @return string representation of value */ @Override public String toString() { return MoreObjects.toStringHelper("AdvancedConfig") .add("timerWrapperMethods", timerWrapperMethods) .add("weavingTimer", weavingTimer) .add("immediatePartialStoreThresholdSeconds", immediatePartialStoreThresholdSeconds) .add("maxAggregateTransactionsPerTransactionType", maxAggregateTransactionsPerTransactionType) .add("maxAggregateQueriesPerQueryType", maxAggregateQueriesPerQueryType) .add("maxTraceEntriesPerTransaction", maxTraceEntriesPerTransaction) .add("maxStackTraceSamplesPerTransaction", maxStackTraceSamplesPerTransaction) .add("captureThreadInfo", captureThreadInfo) .add("captureGcActivity", captureGcActivity) .add("mbeanGaugeNotFoundDelaySeconds", mbeanGaugeNotFoundDelaySeconds) .add("version", version) .toString(); } /** * Simple representation of this value type suitable Jackson binding * @deprecated Do not use this type directly, it exists only for Jackson-binding infrastructure */ @Deprecated static final class Json { @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Nullable Boolean timerWrapperMethods; @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Nullable Boolean weavingTimer; @JsonProperty @Nullable Integer immediatePartialStoreThresholdSeconds; @JsonProperty @Nullable Integer maxAggregateTransactionsPerTransactionType; @JsonProperty @Nullable Integer maxAggregateQueriesPerQueryType; @JsonProperty @Nullable Integer maxTraceEntriesPerTransaction; @JsonProperty @Nullable Integer maxStackTraceSamplesPerTransaction; @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Nullable Boolean captureThreadInfo; @JsonProperty @JsonInclude(value = JsonInclude.Include.NON_EMPTY) @Nullable Boolean captureGcActivity; @JsonProperty @Nullable Integer mbeanGaugeNotFoundDelaySeconds; @JsonProperty @JsonIgnore @Nullable String version; } /** * @param json JSON-bindable data structure * @return immutable value type * @deprecated Do not use this method directly, it exists only for Jackson-binding infrastructure */ @Deprecated @JsonCreator static ImmutableAdvancedConfig fromJson(Json json) { ImmutableAdvancedConfig.Builder builder = ImmutableAdvancedConfig.builder(); if (json.timerWrapperMethods != null) { builder.timerWrapperMethods(json.timerWrapperMethods); } if (json.weavingTimer != null) { builder.weavingTimer(json.weavingTimer); } if (json.immediatePartialStoreThresholdSeconds != null) { builder.immediatePartialStoreThresholdSeconds(json.immediatePartialStoreThresholdSeconds); } if (json.maxAggregateTransactionsPerTransactionType != null) { builder.maxAggregateTransactionsPerTransactionType(json.maxAggregateTransactionsPerTransactionType); } if (json.maxAggregateQueriesPerQueryType != null) { builder.maxAggregateQueriesPerQueryType(json.maxAggregateQueriesPerQueryType); } if (json.maxTraceEntriesPerTransaction != null) { builder.maxTraceEntriesPerTransaction(json.maxTraceEntriesPerTransaction); } if (json.maxStackTraceSamplesPerTransaction != null) { builder.maxStackTraceSamplesPerTransaction(json.maxStackTraceSamplesPerTransaction); } if (json.captureThreadInfo != null) { builder.captureThreadInfo(json.captureThreadInfo); } if (json.captureGcActivity != null) { builder.captureGcActivity(json.captureGcActivity); } if (json.mbeanGaugeNotFoundDelaySeconds != null) { builder.mbeanGaugeNotFoundDelaySeconds(json.mbeanGaugeNotFoundDelaySeconds); } return builder.build(); } /** * Creates immutable copy of {@link AdvancedConfig}. * Uses accessors to get values to initialize immutable instance. * If an instance is already immutable, it is returned as is. * @param instance instance to copy * @return copied immutable AdvancedConfig instance */ public static ImmutableAdvancedConfig copyOf(AdvancedConfig instance) { if (instance instanceof ImmutableAdvancedConfig) { return (ImmutableAdvancedConfig) instance; } return ImmutableAdvancedConfig.builder() .copyFrom(instance) .build(); } /** * Creates builder for {@link org.glowroot.common.config.ImmutableAdvancedConfig ImmutableAdvancedConfig}. * @return new ImmutableAdvancedConfig builder */ public static ImmutableAdvancedConfig.Builder builder() { return new ImmutableAdvancedConfig.Builder(); } /** * Builds instances of {@link org.glowroot.common.config.ImmutableAdvancedConfig ImmutableAdvancedConfig}. * Initialize attributes and then invoke {@link #build()} method to create * immutable instance. *

{@code Builder} is not thread safe and generally should not be stored in field or collection, * but used immediately to create instances. */ @NotThreadSafe public static final class Builder { private static final long OPT_BIT_TIMER_WRAPPER_METHODS = 0x1L; private static final long OPT_BIT_WEAVING_TIMER = 0x2L; private static final long OPT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS = 0x4L; private static final long OPT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TRANSACTION_TYPE = 0x8L; private static final long OPT_BIT_MAX_AGGREGATE_QUERIES_PER_QUERY_TYPE = 0x10L; private static final long OPT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION = 0x20L; private static final long OPT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION = 0x40L; private static final long OPT_BIT_CAPTURE_THREAD_INFO = 0x80L; private static final long OPT_BIT_CAPTURE_GC_ACTIVITY = 0x100L; private static final long OPT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS = 0x200L; private long optBits; private boolean timerWrapperMethods; private boolean weavingTimer; private int immediatePartialStoreThresholdSeconds; private int maxAggregateTransactionsPerTransactionType; private int maxAggregateQueriesPerQueryType; private int maxTraceEntriesPerTransaction; private int maxStackTraceSamplesPerTransaction; private boolean captureThreadInfo; private boolean captureGcActivity; private int mbeanGaugeNotFoundDelaySeconds; private Builder() {} /** * Fill builder with attribute values from provided {@link AdvancedConfig} instance. * Regular attribute values will be replaced with ones of an instance. * Instance's absent optional values will not replace present values. * @param instance instance to copy values from * @return {@code this} builder for chained invocation */ public final Builder copyFrom(AdvancedConfig instance) { Preconditions.checkNotNull(instance); timerWrapperMethods(instance.timerWrapperMethods()); weavingTimer(instance.weavingTimer()); immediatePartialStoreThresholdSeconds(instance.immediatePartialStoreThresholdSeconds()); maxAggregateTransactionsPerTransactionType(instance.maxAggregateTransactionsPerTransactionType()); maxAggregateQueriesPerQueryType(instance.maxAggregateQueriesPerQueryType()); maxTraceEntriesPerTransaction(instance.maxTraceEntriesPerTransaction()); maxStackTraceSamplesPerTransaction(instance.maxStackTraceSamplesPerTransaction()); captureThreadInfo(instance.captureThreadInfo()); captureGcActivity(instance.captureGcActivity()); mbeanGaugeNotFoundDelaySeconds(instance.mbeanGaugeNotFoundDelaySeconds()); return this; } /** * Initializes value for {@link AdvancedConfig#timerWrapperMethods() timerWrapperMethods}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#timerWrapperMethods() timerWrapperMethods}. * @param timerWrapperMethods value for timerWrapperMethods * @return {@code this} builder for chained invocation */ public final Builder timerWrapperMethods(boolean timerWrapperMethods) { this.timerWrapperMethods = timerWrapperMethods; optBits |= OPT_BIT_TIMER_WRAPPER_METHODS; return this; } /** * Initializes value for {@link AdvancedConfig#weavingTimer() weavingTimer}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#weavingTimer() weavingTimer}. * @param weavingTimer value for weavingTimer * @return {@code this} builder for chained invocation */ public final Builder weavingTimer(boolean weavingTimer) { this.weavingTimer = weavingTimer; optBits |= OPT_BIT_WEAVING_TIMER; return this; } /** * Initializes value for {@link AdvancedConfig#immediatePartialStoreThresholdSeconds() immediatePartialStoreThresholdSeconds}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#immediatePartialStoreThresholdSeconds() immediatePartialStoreThresholdSeconds}. * @param immediatePartialStoreThresholdSeconds value for immediatePartialStoreThresholdSeconds * @return {@code this} builder for chained invocation */ public final Builder immediatePartialStoreThresholdSeconds(int immediatePartialStoreThresholdSeconds) { this.immediatePartialStoreThresholdSeconds = immediatePartialStoreThresholdSeconds; optBits |= OPT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS; return this; } /** * Initializes value for {@link AdvancedConfig#maxAggregateTransactionsPerTransactionType() maxAggregateTransactionsPerTransactionType}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#maxAggregateTransactionsPerTransactionType() maxAggregateTransactionsPerTransactionType}. * @param maxAggregateTransactionsPerTransactionType value for maxAggregateTransactionsPerTransactionType * @return {@code this} builder for chained invocation */ public final Builder maxAggregateTransactionsPerTransactionType(int maxAggregateTransactionsPerTransactionType) { this.maxAggregateTransactionsPerTransactionType = maxAggregateTransactionsPerTransactionType; optBits |= OPT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TRANSACTION_TYPE; return this; } /** * Initializes value for {@link AdvancedConfig#maxAggregateQueriesPerQueryType() maxAggregateQueriesPerQueryType}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#maxAggregateQueriesPerQueryType() maxAggregateQueriesPerQueryType}. * @param maxAggregateQueriesPerQueryType value for maxAggregateQueriesPerQueryType * @return {@code this} builder for chained invocation */ public final Builder maxAggregateQueriesPerQueryType(int maxAggregateQueriesPerQueryType) { this.maxAggregateQueriesPerQueryType = maxAggregateQueriesPerQueryType; optBits |= OPT_BIT_MAX_AGGREGATE_QUERIES_PER_QUERY_TYPE; return this; } /** * Initializes value for {@link AdvancedConfig#maxTraceEntriesPerTransaction() maxTraceEntriesPerTransaction}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#maxTraceEntriesPerTransaction() maxTraceEntriesPerTransaction}. * @param maxTraceEntriesPerTransaction value for maxTraceEntriesPerTransaction * @return {@code this} builder for chained invocation */ public final Builder maxTraceEntriesPerTransaction(int maxTraceEntriesPerTransaction) { this.maxTraceEntriesPerTransaction = maxTraceEntriesPerTransaction; optBits |= OPT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION; return this; } /** * Initializes value for {@link AdvancedConfig#maxStackTraceSamplesPerTransaction() maxStackTraceSamplesPerTransaction}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#maxStackTraceSamplesPerTransaction() maxStackTraceSamplesPerTransaction}. * @param maxStackTraceSamplesPerTransaction value for maxStackTraceSamplesPerTransaction * @return {@code this} builder for chained invocation */ public final Builder maxStackTraceSamplesPerTransaction(int maxStackTraceSamplesPerTransaction) { this.maxStackTraceSamplesPerTransaction = maxStackTraceSamplesPerTransaction; optBits |= OPT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION; return this; } /** * Initializes value for {@link AdvancedConfig#captureThreadInfo() captureThreadInfo}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#captureThreadInfo() captureThreadInfo}. * @param captureThreadInfo value for captureThreadInfo * @return {@code this} builder for chained invocation */ public final Builder captureThreadInfo(boolean captureThreadInfo) { this.captureThreadInfo = captureThreadInfo; optBits |= OPT_BIT_CAPTURE_THREAD_INFO; return this; } /** * Initializes value for {@link AdvancedConfig#captureGcActivity() captureGcActivity}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#captureGcActivity() captureGcActivity}. * @param captureGcActivity value for captureGcActivity * @return {@code this} builder for chained invocation */ public final Builder captureGcActivity(boolean captureGcActivity) { this.captureGcActivity = captureGcActivity; optBits |= OPT_BIT_CAPTURE_GC_ACTIVITY; return this; } /** * Initializes value for {@link AdvancedConfig#mbeanGaugeNotFoundDelaySeconds() mbeanGaugeNotFoundDelaySeconds}. *

If not set, this attribute will have default value returned by initializer of {@link AdvancedConfig#mbeanGaugeNotFoundDelaySeconds() mbeanGaugeNotFoundDelaySeconds}. * @param mbeanGaugeNotFoundDelaySeconds value for mbeanGaugeNotFoundDelaySeconds * @return {@code this} builder for chained invocation */ public final Builder mbeanGaugeNotFoundDelaySeconds(int mbeanGaugeNotFoundDelaySeconds) { this.mbeanGaugeNotFoundDelaySeconds = mbeanGaugeNotFoundDelaySeconds; optBits |= OPT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS; return this; } /** * Builds new {@link org.glowroot.common.config.ImmutableAdvancedConfig ImmutableAdvancedConfig}. * @return immutable instance of AdvancedConfig * @throws exception {@code java.lang.IllegalStateException} if any required attributes are missing */ public ImmutableAdvancedConfig build() throws IllegalStateException { return new ImmutableAdvancedConfig(this); } private boolean timerWrapperMethodsIsSet() { return (optBits & OPT_BIT_TIMER_WRAPPER_METHODS) != 0; } private boolean weavingTimerIsSet() { return (optBits & OPT_BIT_WEAVING_TIMER) != 0; } private boolean immediatePartialStoreThresholdSecondsIsSet() { return (optBits & OPT_BIT_IMMEDIATE_PARTIAL_STORE_THRESHOLD_SECONDS) != 0; } private boolean maxAggregateTransactionsPerTransactionTypeIsSet() { return (optBits & OPT_BIT_MAX_AGGREGATE_TRANSACTIONS_PER_TRANSACTION_TYPE) != 0; } private boolean maxAggregateQueriesPerQueryTypeIsSet() { return (optBits & OPT_BIT_MAX_AGGREGATE_QUERIES_PER_QUERY_TYPE) != 0; } private boolean maxTraceEntriesPerTransactionIsSet() { return (optBits & OPT_BIT_MAX_TRACE_ENTRIES_PER_TRANSACTION) != 0; } private boolean maxStackTraceSamplesPerTransactionIsSet() { return (optBits & OPT_BIT_MAX_STACK_TRACE_SAMPLES_PER_TRANSACTION) != 0; } private boolean captureThreadInfoIsSet() { return (optBits & OPT_BIT_CAPTURE_THREAD_INFO) != 0; } private boolean captureGcActivityIsSet() { return (optBits & OPT_BIT_CAPTURE_GC_ACTIVITY) != 0; } private boolean mbeanGaugeNotFoundDelaySecondsIsSet() { return (optBits & OPT_BIT_MBEAN_GAUGE_NOT_FOUND_DELAY_SECONDS) != 0; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy