Scala Futures

A tour to the Scala Futures

Reading Time: 6 minutes While executing long computations, performance is something that’s always being the concern. Luckily, Futures come to our rescue. A Future gives you a simple way to run an algorithm concurrently. Futures are the standard mechanism for writing multithreaded code in Scala. Whenever we create a new Future operation, Scala spawns a new thread to run that Future’s code, and after completion, it executes any provided Continue Reading

map(), flatMap() on Futures & Options in scala

Reading Time: 5 minutes In this blog, we would be looking at how map() and flatMap() operations work with Option and Future of scala, literally speaking both Futures and Options are very effective features of scala, A Future lets us have a value from some task on a differnt thread and Option provides us a hand from null of java as using null in scala is seen a very bad approach in Continue Reading

Scala Future Under The Hood

Reading Time: 3 minutes In the previous post, i was discussing about Scala ExecutionContext. As we know, for multithreading we need to maintain thread pools using ExecutionContext and by default ForkJoinPool is used because for accessing “multi core” processor. There are multiple thread pools are available in our java.util.concurrent.Executors utility class and as per our requirement we can create new one also. After all, Scala have concept of Future. Continue Reading

A Non-blocking “Email sending” functionality in Scala

Reading Time: < 1 minute In our last blog “Adding an Email Sending Functionality in Play using Scala” we explained how to include an Email sending functionality in a Play Scala Application. But the way in which we implemented it, made it a Blocking one i.e., application will wait until email has been sent. In this blog we will explain, how to make the Email Sending functionality a Non-blocking one. By making Continue Reading