Home » Author Archives: Arun Manivannan

Author Archives: Arun Manivannan

Scala notes – Futures – 3 (Combinators and Async)

In the previous parts of this post, we discussed about Futures and Promises. In this last part, we’ll compose Futures using its powerful combinators. Composing Futures : In the first post, we saw how to extract a value from Future using onComplete, foreach and in testcases using Await.result. Extracting a value from a single Future is good but many a ...

Read More »

Scala notes – Futures – 2 (Promises)

In the last post, we saw how to extract values from the Future upon onComplete and their counterparts – onSuccess and onFailure. We also saw how to use Await.result in Testcases to block and get the value from Future. In this post, we’ll discuss briefly about the relationship between a Promise and a Future. Promise The concepts Promise and a ...

Read More »

Scala Notes – Futures – 1

Almost all modern programming languages have a Future-Promise idiom for concurrent programming. I don’t intend to bore you with why we need higher level of concurrency abstractions. Instead, in this post, we’ll cut to the chase and discuss only about Scala’s approach to Futures. A scala.concurrent.Future is a representation of a value that is yet to be realized. This value ...

Read More »

Akka Notes – Finite State Machines – 2

In the first part of notes on Akka FSM, we saw the basics of Akka FSM and the outline of the Coffee vending machine that we planned to build – the structure of the Actor and a list of messages we pass to the Actor. In this second and final part, we will go ahead and implement each of these ...

Read More »

Akka Notes – Finite State Machines – 1

I recently had the opportunity to play with Akka FSM at work for some really interesting use-case. The API (in fact, the DSL) is pretty awesome and the entire experience was amazing. Here’s my attempt to log my notes on building a Finite State Machine using Akka FSM. As an example, we’ll walk through the steps of building an (limited) ...

Read More »

Akka Notes – Actor Supervision – 8

Failures are more like a feature among distributed systems. And with Akka’s let it crash fault tolerance model, you could achieve a clear separation between your business logic and your failure handling logic (supervision logic). All with very little effort. It’s pretty amazing. This is the topic of our discussion now. Actor Supervision Imagine a method call stack and the ...

Read More »

Akka Notes – DeathWatch – 7

When we talked about Actor lifecycle, we saw that Actors could be stopped by various means (using ActorSystem.stop or ActorContext.stop or sending a PoisonPill – there’s also the Kill and the gracefulStop). Whatever reason an Actor dies, there are cases when a few other actors in the system would like to know about it. Let’s take a trivial example of ...

Read More »

Akka Notes – Child Actors and ActorPath – 6

Actors are completely hierarchical. Whatever Actors that you create HAS to be a child of some other Actor. Let’s analyze that a bit : Path Say, we create an ActorRef using ActorSystem.actorOf and try to print it’s path.       val actorSystem=ActorSystem("SupervisionActorSystem") val actorRef=actorSystem.actorOf(Props[BasicLifecycleLoggingTeacherActor]) println (actorRef.path) // (prints) akka://SupervisionActorSystem/user/$a As you see, a path looks very similar to a ...

Read More »

Akka Notes – Actor Lifecycle – Basic – 5

(Please note that this lifecycle write-up does not cover the preRestart or the postRestart methods. We’ll talk about them when we discuss supervision) The basic Actor lifecycle is very much intuitive. You could actually compare the basic Actor lifecycle with a Java servlet lifecycle with one special difference.             Just like any other regular class, ...

Read More »

Akka Notes – ActorSystem (Configuration and Scheduling) – 4

As we saw from our previous posts, we could create an Actor using the actorOf method of the ActorSystem. There’s actually much more you could do with ActorSystem. We’ll touch upon just the Configuration and the Scheduling bit in this write-up. Let’s look at the subsets of methods available in the ActorSystem.             1. Configuration ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns