Home » Author Archives: Biju Kunjummen (page 2)

Author Archives: Biju Kunjummen

Async abstractions using rx-java

java-logo

One of the big benefits in using Rx-java for me has been the way the code looks exactly the same whether the underlying calls are synchronous or asynchronous and hence the title of this entry. Consider a very simple use case of a client code making three slow running calls and combines the results into a list:       ...

Read More »

Netflix Governator Tests – Introducing governator-junit-runner

java-interview-questions-answers

Consider a typical Netflix Governator junit test.                     public class SampleWithGovernatorJunitSupportTest { @Rule public LifecycleTester tester = new LifecycleTester(); @Test public void testExampleBeanInjection() throws Exception { tester.start(); Injector injector = tester .builder() .withBootstrapModule(new SampleBootstrapModule()) .withModuleClass(SampleModule.class) .usingBasePackages("sample.gov") .build() .createInjector(); BlogService blogService = injector.getInstance(BlogService.class); assertThat(blogService.get(1l), is(notNullValue())); assertThat(blogService.getBlogServiceName(), equalTo("Test Blog Service")); } } This ...

Read More »

Disambiguating between instances with Google Guice

java-interview-questions-answers

Google guice provides a neat way to select a target implementation if there are multiple implementations of an interface. My samples are based on an excellent article by Josh Long(@starbuxman) on a similar mechanism that Spring provides. So, consider an interface called MarketPlace having two implementations, an AndroidMarketPlace and AppleMarketPlace:           interface MarketPlace { } class ...

Read More »

Learning Netflix Governator – Part 2

java-logo

To continue from the previous entry on some basic learnings on Netflix Governator, here I will cover one more enhancement that Netflix Governator brings to Google Guice – Lifecycle Management Lifecycle Management essentially provides hooks into the different lifecycle phases that an object is taken through, to quote the wiki article on Governator:           Allocation (via ...

Read More »

Learning Netflix Governator – Part 1

java-interview-questions-answers

I have been working with Netflix Governator for the last few days and got to try out a small sample using Governator as a way to compare it with the dependency injection feature set of Spring Framework. The following is by no means comprehensive, I will expand on this in the next series of posts. So Governator for the uninitiated ...

Read More »

Using Netflix Hystrix annotations with Spring

spring-interview-questions-answers

I can’t think of a better way to describe a specific feature of Netflix Hystrix library than by quoting from its home page: Latency and Fault Tolerance by: Stop cascading failures. Fallbacks and graceful degradation. Fail fast and rapid recovery. Thread and semaphore isolation with circuit breakers. I saw a sample demonstrated by Josh Long(@starbuxman) which makes use of Hystrix ...

Read More »

Spring retry – ways to integrate with your project

spring-interview-questions-answers

If you have a need to implement robust retry logic in your code, a proven way would be to use the spring retry library. My objective here is not to show how to use the spring retry project itself, but in demonstrating different ways that it can be integrated into your codebase. Consider a service to invoke an external system: ...

Read More »

Solving “Water buckets” problem using Scala

scala-logo

I recently came across a puzzle called the “Water Buckets” problem in this book, which totally stumped me. You have a 12-gallon bucket, an 8-gallon bucket and a 5-gallon bucket. The 12-gallon bucket is full of water and the other two are empty. Without using any additional water how can you divide the twelve gallons of water equally so that ...

Read More »

Spring RestTemplate with a linked resource

spring-interview-questions-answers

Spring Data REST is an awesome project that provides mechanisms to expose the resources underlying a Spring Data based repository as REST resources. Exposing a service with a linked resource Consider two simple JPA based entities, Course and Teacher:           @Entity @Table(name = "teachers") public class Teacher { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.