private SdkEventLoopGroup eventLoopGroup(DefaultBuilder builder) { Validate.isTrue(builder.eventLoopGroup == null || builder.eventLoopGroupBuilder == null, "The eventLoopGroup and the eventLoopGroupFactory can't both be configured."); return Either.fromNullable(builder.eventLoopGroup, builder.eventLoopGroupBuilder) .map(e -> e.map(this::nonManagedEventLoopGroup, SdkEventLoopGroup.Builder::build)) .orElseGet(SharedSdkEventLoopGroup::get); }
private SdkEventLoopGroup eventLoopGroup(DefaultBuilder builder) { Validate.isTrue(builder.eventLoopGroup == null || builder.eventLoopGroupBuilder == null, "The eventLoopGroup and the eventLoopGroupFactory can't both be configured."); return Either.fromNullable(builder.eventLoopGroup, builder.eventLoopGroupBuilder) .map(e -> e.map(this::nonManagedEventLoopGroup, SdkEventLoopGroup.Builder::build)) .orElseGet(SharedSdkEventLoopGroup::get); }
/** * Finalize which sync HTTP client will be used for the created client. */ private SdkHttpClient resolveSyncHttpClient(SdkClientConfiguration config) { Validate.isTrue(config.option(SdkClientOption.SYNC_HTTP_CLIENT) == null || httpClientBuilder == null, "The httpClient and the httpClientBuilder can't both be configured."); return Either.fromNullable(config.option(SdkClientOption.SYNC_HTTP_CLIENT), httpClientBuilder) .map(e -> e.map(NonManagedSdkHttpClient::new, b -> b.buildWithDefaults(childHttpConfig()))) .orElseGet(() -> defaultHttpClientBuilder.buildWithDefaults(childHttpConfig())); }
/** * Finalize which async HTTP client will be used for the created client. */ private SdkAsyncHttpClient resolveAsyncHttpClient(SdkClientConfiguration config) { Validate.isTrue(config.option(ASYNC_HTTP_CLIENT) == null || asyncHttpClientBuilder == null, "The asyncHttpClient and the asyncHttpClientBuilder can't both be configured."); return Either.fromNullable(config.option(ASYNC_HTTP_CLIENT), asyncHttpClientBuilder) .map(e -> e.map(NonManagedSdkAsyncHttpClient::new, b -> b.buildWithDefaults(childHttpConfig()))) .orElseGet(() -> defaultAsyncHttpClientBuilder.buildWithDefaults(childHttpConfig())); }