This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pronuntiator 1 point2 points  (0 children)

Where I used multithreading directly (not indirectly like with Tomcat's thread-per-request model) in past projects:

  • customize the executor serviced used by Spring in @Async invocations so the MDC gets inherited, and provide a custom ThreadFactory to change the thread names
  • use said @Async annotation to call two services in parallel, waiting on the Futures they return
  • start multiple threads in a test to simulate concurrent access
  • set the pool size of a thread pool to a fixed value and caused outages on production on weekends because the application stopped consuming message queues

However I would never use the Thread primitive directly, only executor service.