1313import lombok .Builder ;
1414import lombok .Getter ;
1515
16- /** FlagdOptions is a builder to build flagd provider options. */
16+ /**
17+ * FlagdOptions is a builder to build flagd provider options.
18+ */
1719@ Builder
1820@ Getter
1921@ SuppressWarnings ("PMD.TooManyStaticImports" )
2022public class FlagdOptions {
2123
22- /** flagd resolving type. */
24+ /**
25+ * flagd resolving type.
26+ */
2327 private Config .EvaluatorType resolverType ;
2428
25- /** flagd connection host. */
29+ /**
30+ * flagd connection host.
31+ */
2632 @ Builder .Default
2733 private String host = fallBackToEnvOrDefault (Config .HOST_ENV_VAR_NAME , Config .DEFAULT_HOST );
2834
29- /** flagd connection port. */
35+ /**
36+ * flagd connection port.
37+ */
3038 private int port ;
3139
32- /** Use TLS connectivity. */
40+ /**
41+ * Use TLS connectivity.
42+ */
3343 @ Builder .Default
3444 private boolean tls = Boolean .parseBoolean (fallBackToEnvOrDefault (Config .TLS_ENV_VAR_NAME , Config .DEFAULT_TLS ));
3545
36- /** TLS certificate overriding if TLS connectivity is used. */
46+ /**
47+ * TLS certificate overriding if TLS connectivity is used.
48+ */
3749 @ Builder .Default
3850 private String certPath = fallBackToEnvOrDefault (Config .SERVER_CERT_PATH_ENV_VAR_NAME , null );
3951
40- /** Unix socket path to flagd. */
52+ /**
53+ * Unix socket path to flagd.
54+ */
4155 @ Builder .Default
4256 private String socketPath = fallBackToEnvOrDefault (Config .SOCKET_PATH_ENV_VAR_NAME , null );
4357
44- /** Cache type to use. Supports - lru, disabled. */
58+ /**
59+ * Cache type to use. Supports - lru, disabled.
60+ */
4561 @ Builder .Default
4662 private String cacheType = fallBackToEnvOrDefault (Config .CACHE_ENV_VAR_NAME , Config .DEFAULT_CACHE );
4763
48- /** Max cache size. */
64+ /**
65+ * Max cache size.
66+ */
4967 @ Builder .Default
5068 private int maxCacheSize =
5169 fallBackToEnvOrDefault (Config .MAX_CACHE_SIZE_ENV_VAR_NAME , Config .DEFAULT_MAX_CACHE_SIZE );
5270
53- /** Max event stream connection retries. */
54- @ Builder .Default
55- private int maxEventStreamRetries = fallBackToEnvOrDefault (
56- Config .MAX_EVENT_STREAM_RETRIES_ENV_VAR_NAME , Config .DEFAULT_MAX_EVENT_STREAM_RETRIES );
57-
58- /** Backoff interval in milliseconds. */
71+ /**
72+ * Backoff interval in milliseconds.
73+ */
5974 @ Builder .Default
6075 private int retryBackoffMs = fallBackToEnvOrDefault (
6176 Config .BASE_EVENT_STREAM_RETRY_BACKOFF_MS_ENV_VAR_NAME , Config .BASE_EVENT_STREAM_RETRY_BACKOFF_MS );
6277
6378 /**
64- * Connection deadline in milliseconds. For RPC resolving, this is the deadline to connect to
65- * flagd for flag evaluation. For in-process resolving, this is the deadline for sync stream
66- * termination.
79+ * Connection deadline in milliseconds.
80+ * For RPC resolving, this is the deadline to connect to flagd for flag
81+ * evaluation.
82+ * For in-process resolving, this is the deadline for sync stream termination.
6783 */
6884 @ Builder .Default
6985 private int deadline = fallBackToEnvOrDefault (Config .DEADLINE_MS_ENV_VAR_NAME , Config .DEFAULT_DEADLINE );
7086
7187 /**
72- * Streaming connection deadline in milliseconds. Set to 0 to disable the deadline. Defaults to
73- * 600000 (10 minutes); recommended to prevent infrastructure from killing idle connections.
88+ * Streaming connection deadline in milliseconds.
89+ * Set to 0 to disable the deadline.
90+ * Defaults to 600000 (10 minutes); recommended to prevent infrastructure from killing idle connections.
7491 */
7592 @ Builder .Default
7693 private int streamDeadlineMs =
7794 fallBackToEnvOrDefault (Config .STREAM_DEADLINE_MS_ENV_VAR_NAME , Config .DEFAULT_STREAM_DEADLINE_MS );
7895
79- /** Selector to be used with flag sync gRPC contract. */
96+ /**
97+ * Grace time period in seconds before provider moves from STALE to ERROR.
98+ * Defaults to 5
99+ */
100+ @ Builder .Default
101+ private int retryGracePeriod =
102+ fallBackToEnvOrDefault (Config .STREAM_RETRY_GRACE_PERIOD , Config .DEFAULT_STREAM_RETRY_GRACE_PERIOD );
103+ /**
104+ * Selector to be used with flag sync gRPC contract.
105+ **/
80106 @ Builder .Default
81107 private String selector = fallBackToEnvOrDefault (Config .SOURCE_SELECTOR_ENV_VAR_NAME , null );
82108
83- /** gRPC client KeepAlive in milliseconds. Disabled with 0. Defaults to 0 (disabled). */
109+ /**
110+ * gRPC client KeepAlive in milliseconds. Disabled with 0.
111+ * Defaults to 0 (disabled).
112+ **/
84113 @ Builder .Default
85114 private long keepAlive = fallBackToEnvOrDefault (
86115 Config .KEEP_ALIVE_MS_ENV_VAR_NAME ,
87116 fallBackToEnvOrDefault (Config .KEEP_ALIVE_MS_ENV_VAR_NAME_OLD , Config .DEFAULT_KEEP_ALIVE ));
88117
89118 /**
90- * File source of flags to be used by offline mode. Setting this enables the offline mode of the
91- * in-process provider.
119+ * File source of flags to be used by offline mode.
120+ * Setting this enables the offline mode of the in-process provider.
92121 */
93122 @ Builder .Default
94123 private String offlineFlagSourcePath = fallBackToEnvOrDefault (Config .OFFLINE_SOURCE_PATH , null );
95124
96125 /**
97126 * gRPC custom target string.
98127 *
99- * <p>Setting this will allow user to use custom gRPC name resolver at present we are supporting
100- * all core resolver along with a custom resolver for envoy proxy resolution. For more visit
101- * (https://grpc.io/docs/guides/custom-name-resolution/)
128+ * <p>Setting this will allow user to use custom gRPC name resolver at present
129+ * we are supporting all core resolver along with a custom resolver for envoy proxy
130+ * resolution. For more visit (https://grpc.io/docs/guides/custom-name-resolution/)
102131 */
103132 @ Builder .Default
104133 private String targetUri = fallBackToEnvOrDefault (Config .TARGET_URI_ENV_VAR_NAME , null );
105134
106135 /**
107- * Function providing an EvaluationContext to mix into every evaluations. The sync-metadata
108- * response
136+ * Function providing an EvaluationContext to mix into every evaluations.
137+ * The sync-metadata response
109138 * (https://buf.build/open-feature/flagd/docs/main:flagd.sync.v1#flagd.sync.v1.GetMetadataResponse),
110- * represented as a {@link dev.openfeature.sdk.Structure}, is passed as an argument. This function
111- * runs every time the provider (re)connects, and its result is cached and used in every
112- * evaluation. By default, the entire sync response (converted to a Structure) is used.
139+ * represented as a {@link dev.openfeature.sdk.Structure}, is passed as an
140+ * argument.
141+ * This function runs every time the provider (re)connects, and its result is cached and used in every evaluation.
142+ * By default, the entire sync response (converted to a Structure) is used.
113143 */
114144 @ Builder .Default
115145 private Function <Structure , EvaluationContext > contextEnricher =
116146 (syncMetadata ) -> new ImmutableContext (syncMetadata .asMap ());
117147
118- /** Inject a Custom Connector for fetching flags. */
148+ /**
149+ * Inject a Custom Connector for fetching flags.
150+ */
119151 private Connector customConnector ;
120152
121153 /**
122- * Inject OpenTelemetry for the library runtime. Providing sdk will initiate distributed tracing
123- * for flagd grpc connectivity.
154+ * Inject OpenTelemetry for the library runtime. Providing sdk will initiate
155+ * distributed tracing for flagd grpc
156+ * connectivity.
124157 */
125158 private OpenTelemetry openTelemetry ;
126159
@@ -139,11 +172,14 @@ public FlagdOptions build() {
139172 };
140173 }
141174
142- /** Overload default lombok builder. */
175+ /**
176+ * Overload default lombok builder.
177+ */
143178 public static class FlagdOptionsBuilder {
144179 /**
145- * Enable OpenTelemetry instance extraction from GlobalOpenTelemetry. Note that, this is only
146- * useful if global configurations are registered.
180+ * Enable OpenTelemetry instance extraction from GlobalOpenTelemetry. Note that,
181+ * this is only useful if global
182+ * configurations are registered.
147183 */
148184 public FlagdOptionsBuilder withGlobalTelemetry (final boolean b ) {
149185 if (b ) {
0 commit comments