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



##########
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()))

Review comment:
       I didn't used the uds library proposed by okhttp `jnr-unixsocket` 
because it doesn't look in a very good shape (last release is 0.31 
https://github.com/jnr/jnr-unixsocket/releases)
   
   I'll try to find out if we can use only `junixsocket-core`




----------------------------------------------------------------
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