markusthoemmes commented on a change in pull request #3812: ContainerClient + 
akka http alternative to HttpUtils
URL: 
https://github.com/apache/incubator-openwhisk/pull/3812#discussion_r203407419
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala
 ##########
 @@ -80,20 +85,17 @@ protected class HttpUtils(hostname: String, timeout: 
FiniteDuration, maxResponse
    * @return Left(Error Message) or Right(Status Code, Response as UTF-8 
String)
    */
   def post(endpoint: String, body: JsValue, retry: Boolean)(
-    implicit tid: TransactionId): Either[ContainerHttpError, 
ContainerResponse] = {
+    implicit tid: TransactionId): Future[Either[ContainerHttpError, 
ContainerResponse]] = {
     val entity = new StringEntity(body.compactPrint, StandardCharsets.UTF_8)
     entity.setContentType("application/json")
 
     val request = new HttpPost(baseUri.setPath(endpoint).build)
     request.addHeader(HttpHeaders.ACCEPT, "application/json")
     request.setEntity(entity)
 
-    execute(request, timeout, maxConcurrent, retry)
+    Future { execute(request, timeout, maxConcurrent, retry) }
 
 Review comment:
   Yes, in this case you actually want another thread to take over, so you use 
`Future()`, but you also include `blocking` to denote that this is a blocking 
operation that might grab a Thread indefinitly. It gives the ExecutionContext 
the chance to adapt accordingly (create more threads)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to