Posts

Showing posts from 2018

Apache Spark | Run first spark program

Image
In this post we are going to run sample spark program. If you want to setup spark locally go to this post . In the last post we created slave node with 2 cores and 2g memory. This worker node will be used by master to run your spark jobs. Spark installations provides some sample programs to run on cluster. This can be found at below location. We will be running JavaWordCount program locally in spark cluster.

Apache Spark | Setup Spark in local

Image
In this post we are going to setup Apache Spark  in Ubuntu machine. Apache Spark is high performance engine  for Big data such as batches, and streaming of data. Spark provides up-to 100x times speed than any other engines. Spark is compatible with Java, Python, R. Step 1 : Download Spark installations from website . This will download  spark-2.3.1-bin-hadoop2.7.tgz in your local. Extract files from zip as below.

Java | Builder Design Pattern

Java POJO classes can be created using different design patterns. Below is example how Builder pattern works. Normally, Simple java POJO class setter-call has void return type. Builder pattern replace void return type and returns current object of class(ie. return this). Builder pattern can be used to replace parameterised constructor. Also when we create object the code is more readable. Example :

Spring | Autowiring Qualifier

Spring provides @Qualifier annotation to refer correct bean while doing autowiring. Suppose we have interface IService which has two concrete implementation. When we try to Autowire IService object in any other class it will throw exception as there are two beans. Spring Qualifier is used in such situation to place object of correct implementation class to autowired object.   Now, above iservice object will hold object of IServiceImplTwo class.