48
48
import static software .amazon .awssdk .core .client .config .SdkClientOption .RETRY_STRATEGY ;
49
49
import static software .amazon .awssdk .core .client .config .SdkClientOption .SCHEDULED_EXECUTOR_SERVICE ;
50
50
import static software .amazon .awssdk .core .client .config .SdkClientOption .SYNC_HTTP_CLIENT ;
51
+ import static software .amazon .awssdk .core .client .config .SdkClientOption .USER_AGENT_APP_ID ;
51
52
import static software .amazon .awssdk .core .internal .useragent .UserAgentConstant .APP_ID ;
52
53
import static software .amazon .awssdk .core .internal .useragent .UserAgentConstant .HTTP ;
53
54
import static software .amazon .awssdk .core .internal .useragent .UserAgentConstant .INTERNAL_METADATA_MARKER ;
@@ -151,7 +152,6 @@ public abstract class SdkDefaultClientBuilder<B extends SdkClientBuilder<B, C>,
151
152
private final SdkHttpClient .Builder defaultHttpClientBuilder ;
152
153
private final SdkAsyncHttpClient .Builder defaultAsyncHttpClientBuilder ;
153
154
private final List <SdkPlugin > plugins = new ArrayList <>();
154
- private String appId ;
155
155
156
156
157
157
protected SdkDefaultClientBuilder () {
@@ -415,7 +415,7 @@ private String resolveClientUserAgent(LazyValueSource config) {
415
415
SdkClientUserAgentProperties clientProperties = new SdkClientUserAgentProperties ();
416
416
417
417
ClientType clientType = config .get (CLIENT_TYPE );
418
- ClientType resolvedClientType = clientType == null ? ClientType .UNKNOWN : config . get ( CLIENT_TYPE ) ;
418
+ ClientType resolvedClientType = clientType == null ? ClientType .UNKNOWN : clientType ;
419
419
420
420
clientProperties .putProperty (RETRY_MODE , StringUtils .lowerCase (resolveRetryMode (config .get (RETRY_POLICY ),
421
421
config .get (RETRY_STRATEGY ))));
@@ -424,7 +424,9 @@ private String resolveClientUserAgent(LazyValueSource config) {
424
424
clientProperties .putProperty (HTTP , SdkHttpUtils .urlEncode (clientName (resolvedClientType ,
425
425
config .get (SYNC_HTTP_CLIENT ),
426
426
config .get (ASYNC_HTTP_CLIENT ))));
427
- clientProperties .putProperty (APP_ID , appId ().orElseGet (() -> resolveAppId (config )));
427
+ String appId = config .get (USER_AGENT_APP_ID );
428
+ String resolvedAppId = appId == null ? resolveAppId (config ) : appId ;
429
+ clientProperties .putProperty (APP_ID , resolvedAppId );
428
430
return SdkUserAgentBuilder .buildClientUserAgentString (SystemUserAgent .getOrCreate (), clientProperties );
429
431
}
430
432
@@ -457,10 +459,6 @@ private RetryStrategy resolveRetryStrategy(LazyValueSource config) {
457
459
return SdkDefaultRetryStrategy .forRetryMode (retryMode );
458
460
}
459
461
460
- public Optional <String > appId () {
461
- return Optional .ofNullable (appId );
462
- }
463
-
464
462
/**
465
463
* Finalize which sync HTTP client will be used for the created client.
466
464
*/
@@ -658,12 +656,6 @@ public final List<SdkPlugin> plugins() {
658
656
return Collections .unmodifiableList (plugins );
659
657
}
660
658
661
- @ Override
662
- public final B appId (String appId ) {
663
- this .appId = appId ;
664
- return thisBuilder ();
665
- }
666
-
667
659
/**
668
660
* Return "this" for method chaining.
669
661
*/
0 commit comments