Playing with Some Java Concurrency Classes

So I used Spring Boot to bang out a REST service which I call a “delay service” which simply sleeps for the amount of time (in seconds) given as a path parameter like this:  http://<host>/delay/{timeInSeconds}.  I created this to actually see my web services client call the service many times in parallel to see an ExecutorService work as advertised.  The ExecutorService implementation I chose was a simple fixed-size thread pool.

As expected, when I used the client to call the delay service several times in parallel with varying delay times, the entire time spent was roughly the same as the longest delay time.

Kinda neat.  Later I ran into the RxJava project which seems to allow you to do the same thing in a “reactive” manner (and much, much more) and I’ll be looking at that soon.

Leave a Reply