[HN Gopher] Concurrency in Java - I came up with a design I feel...
       ___________________________________________________________________
        
       Concurrency in Java - I came up with a design I feel comfortable
       with
        
       Author : seinecle
       Score  : 5 points
       Date   : 2022-02-19 12:04 UTC (10 hours ago)
        
 (HTM) web link (nocodefunctions.com)
 (TXT) w3m dump (nocodefunctions.com)
        
       | seinecle wrote:
       | And I'd be happy to get your feedback on how to improve on it.
        
         | capableweb wrote:
         | It's a bit unclear on _why_ you 're using JSON to pass things
         | between main code and the task itself. I can imagine
         | serializing/deserializing that takes quite a bit of CPU time
         | compared to if you just passed native data structures, or at
         | least something binary instead of a format meant for human
         | introspection.
        
         | aww_dang wrote:
         | ThreadPool and Queues are my personal preference here
        
       | tlarkworthy wrote:
       | I think this is crazy, coz now you have HTTP stuff leaking into
       | your source code. It's just clearly a different abstraction, a
       | worse mess that implementing Callable .
       | 
       | You can implement Callable in a lambda now, so a wrapper can be
       | conjured up easily when you need it.
       | https://www.concretepage.com/java/jdk-8/java-8-runnable-and-...
       | (I agree implementing Callable in the business logic was naff)
        
         | javajosh wrote:
         | If I am writing an HTTP server then I do indeed expect "HTTP
         | stuff" to "leak" into my source code.
        
           | tlarkworthy wrote:
           | 1. HTTP stuff should be an adapter for transport agnostic
           | business logic. You want to be able to support gRPC or
           | whatever later without disturbing the internal domain
           | functionality. 2. this article is about using HTTP servers to
           | provide general purpose concurrency handling in Java, so your
           | point is off topic. Of course if you are writing a HTTP
           | server you need HTTP server code, thats kinda obvious but not
           | what we are talking about. We are talking about: if you need
           | concurrency, should you bring up a HTTP server?
        
       | trhway wrote:
       | Now we have N+1 problems or how to microservice at microscale.
       | The article really misses a "must have" these days piece -
       | Kubernetes service deployment yaml for the server side task.
        
       ___________________________________________________________________
       (page generated 2022-02-19 23:01 UTC)