java - Response object from async rest api in Spring -


i'm using spring-boot create async rest apis. in response, should return completablefuture object or call join() method , return string response. there difference in response time or performance?

@requestmapping public completablefuture<string> get(@requestparam string input) {     completablefuture<string> future = new completablefuture<>();     return completablefuture.supplyasync(() -> "in background"); } 

or return future result

  @requestmapping     public string get(@requestparam string input) {         completablefuture<string> future = new completablefuture<>();         return completablefuture.supplyasync(() -> "in background").join();     } 

for small functions, didn't notice change in response time.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -