slinkydeveloper commented on a change in pull request #110:
URL: https://github.com/apache/flink-statefun/pull/110#discussion_r426610978



##########
File path: 
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/HttpFunctionProvider.java
##########
@@ -41,12 +45,32 @@ public RequestReplyFunction functionOfType(FunctionType 
type) {
     if (spec == null) {
       throw new IllegalArgumentException("Unsupported type " + type);
     }
-    // specific client reuses the same the connection pool and thread pool
-    // as the sharedClient.
-    OkHttpClient specificClient =
-        
sharedClient.newBuilder().callTimeout(spec.maxRequestDuration()).build();
-    RequestReplyClient httpClient =
-        new HttpRequestReplyClient(HttpUrl.get(spec.endpoint()), 
specificClient);
-    return new RequestReplyFunction(spec.states(), spec.maxNumBatchRequests(), 
httpClient);
+    return new RequestReplyFunction(
+        spec.states(), spec.maxNumBatchRequests(), buildHttpClient(spec));
+  }
+
+  private RequestReplyClient buildHttpClient(HttpFunctionSpec spec) {
+    // We need to build a UDS HTTP client
+    if (spec.unixDomainSocket() != null) {
+      OkHttpClient specificClient =
+          sharedClient
+              .newBuilder()
+              .socketFactory(new 
AFUNIXSocketFactory.FactoryArg(spec.unixDomainSocket()))
+              // Enable HTTP/2 if available (uses H2 upgrade),
+              // otherwise fallback to HTTP/1.1
+              .protocols(Collections.singletonList(Protocol.HTTP_2))

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to