Saturday, December 9, 2017

What is new with Java 9

Being a Java professional, if you were waiting for the big news then finally here it is - Java 9 has been released into the technical workspace recently and the features embedment is just amazing. In this article, we will take a quick tour of the new features introduced in Java 9 and how they can help you in getting your programming skills better.

The modularization with project Jigsaw

After the release of Java 8, Lambdas and improved APIs functionalities changed the daily life of the Java developers. However, one feature that was awaited since a long time to become the highlight of freshly released Java 9 version i.e. modularization with the project jigsaw.

Before modularization, JDK was defined as a programming environment with various undesirable dependencies between different areas of implementation. There was a quick need to eliminate all of these dependencies to get a more modular Java program.

The Jigsaw module system helped in starting compilation with base module only. The Java applications can be started by installing base modules only that are actually needed by the program, not any other undesirable module components. In this way, it will enhance overall runtime and compile-time capabilities with the reliable configuration setting enhanced encapsulation mechanism.

With Java 9, you would be able to design your own modules with the declaration of multiple packages inside. Let us see a quick example, how to create or define modules in Java 9 version.



In this example, we have been used two keywords “exports” and “requires” with significantly different purposes. The “Exports” keyword will tell you about the packages you wanted to show to the outside world. At the same time, the “requires” keyword signifies about the packages you need from the outside. The concept may be a little bit confusing at first glance, but it goes really interesting with practical implementation.

Modules can also be used as classical JAR files inside classpath. In Java 9, modularization concept has replaced the keyword “classpath” with “modulepath” where you can find all the modules declared by you.

Domain-driven design with Java 9

With the introduction of modularization in Java 9, it has become possible for the developers to make software architecture better and more expressive. Now the layers in software architecture can be defined as modules and each of the interfaces can be defined more precisely as compared to the past.

This would be easy for the compiler as well to detect or prevent the architecture violations. Let us have a quick look on domain-driven design with Java 9 –



Saturday, November 4, 2017

What is Garbage Collection log? How to enable & analyze?


Objects are created in the memory to service incoming requests. Once requests are serviced, newly created objects will become useless (i.e. garbage). This garbage must be evicted from the memory so that there is enough room created in the memory to service the new incoming requests. If there isn’t sufficient memory, the application can experience poor response times, OutOfMemoryError, and fatal crashes.
In Java, Android, C#…, garbage collection is automatic, whereas in the several predecessor programming languages (C, C++) – programmer must write code explicitly to release the objects after they are used. So, it’s a major convenience for Java, Android, and C# application developers. But this automatic garbage collection is not free, it comes with a price. Automatic Garbage Collection can have a profound impact on:
1.       Application Response Time
2.       CPU
3.       Memory

Application Response Time

To garbage collect objects automatically, entire application has to be paused intermittently to mark the objects that are in use and sweep away the objects that are not used. During this pause period, all customer transactions which are in motion in the application will be stalled (i.e. frozen). Depending on the type of GC algorithm and memory settings that you configure, pause times can run from few milliseconds to few seconds to few minutes. Thus, Garbage Collection can affect your application SLA (Service Level Agreement) significantly.

CPU

Garbage collection consumes a lot of CPU cycles. Each application will have thousands/millions of objects sitting in memory. Each object in memory should be investigated periodically to see whether they are in use? If it’s in use, who is referencing it? Whether those references are still active? If they are not in use, they should be evicted from memory. All these investigations and computation requires a considerable amount of CPU power.

Memory

Of course, poor GC configuration can lead to high memory consumption and vice versa. Most applications saturate memory first before saturating other resources (CPU, network bandwidth, storage). Most applications upgrade their EC2 instance size to get additional memory rather to get additional CPU or network bandwidth.
Thus to have top notch SLAs and reduce the bill from your cloud hosting provider, your applications Garbage collection has to be function effectively.
In order to study and optimize Garbage Collections impact on the application’s performance, one has to enable Garbage Collection Logging. Besides that, Garbage Collections logs can be used to troubleshoot memory-related problems in the application.

Saturday, July 22, 2017

JavaFx with SpringBoot

In this example we will see how to create a JavaFx project using spring boot.

Step 1 - Create a new maven project using below command. If you are new to spring boot, please check my previous article on standalone spring boot application.

mvn archetype:generate -DgroupId=com.javaxp -DartifactId=TestJavaFx -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Step 2 - Create below file -

pom.xml


Standalone SpringBoot Helloworld example

Step 1 - Run the below maven command. If maven is not installed in your machine please click here to check how to install maven.

mvn archetype:generate -DgroupId=com.javaxp -DartifactId=TestSpringboot -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false



How to install maven and create a new blank maven project


Step 1 - Go to maven site and download maven binary zip archive as shown below
https://maven.apache.org/download.cgi



Step 2 - Once you download the file extract it to a particular location and set below Windows environment variables
 
M2_HOME - C:\TestMaven\apache-maven-3.5.0
MAVEN_HOME - C:\TestMaven\apache-maven-3.5.0

PATH - C:\TestMaven\apache-maven-3.5.0\bin

Make sure that JDK is installed and "JAVA_HOME" variable is added in your Windows environment variable

Now test maven using below command

mvn -version

 

Note - You can change the default maven localRepository as per your requirement, just go to apache-maven-3.5.0/conf/settings.xml and change the path

<localRepository>C:/TestMaven/repo</localRepository>

Friday, July 14, 2017

Poor Employers in the Age of Technology

http://www.vantigeinc.com/hs-fs/hub/168341/file-238178968-jpg/bigstock-Helpless-young-business-woman--42586567.jpg?t=1492713388190&width=1349&name=bigstock-Helpless-young-business-woman--42586567.jpg



Every entrepreneur desires to have most skilled, diligent, well-mannered and reliable professionals. This is probably because the employees are the strength of an organization having the power to make or break it. While the motivated, creative and problem-solving employees support employer to flourish the business, the lazy, fickle and unproductive workforce can cause huge loss to the company.

Mostly it is a poor recruitment process that let the losers enter into the organization but sometimes the blame of turning a skillful person into unproductive creature goes to the technology. While the technological advancement has changed the human lifestyle, it has also changed the environment of workplaces. It is hard to imagine an office without computers, the internet, air conditioners and supportive technologies. While all these pieces of machinery have become necessities to work, these are the hindrances as well. So, the chances of employer bearing huge monetary loss or, in worst cases, losing his business are more because of the facilities provided to the employees than just the lack of efforts.

We have rounded up here a few basic facilities provided by the employer to its workforce that reversely cause his own failure.         

Internet – The main distraction that kills productivity

While the internet is a compulsion for online businesses, software houses, and many other businesses, it is full of distraction. Smartphones, social media, and emails are among the major workplace productivity killers. While the employer provides its employee with the internet for work-related tasks, the mischievous guys use the service for updating their Facebook profiles, playing games, and watching YouTube videos. Resultantly, they fail to accomplish their tasks at the time and make the employer bear the loss.

Friday, April 28, 2017

Top 10 Oracle Certifications and How to Earn Them

Oracle Corporation is an international company that offers a variety of software and hardware solutions which are designed to streamline IT. Oracle offers many certifications in the area of Cloud, applications, Enterprise Management, Database, Foundations, Operating Systems, Training and Resources, Virtualization and much more. Over the years, Oracle has developed an extensive certification program. Today, it compromises 5 certification levels, covering 10 main categories and offers over 200 individual credentials.

Now the question arises why you should get Oracle Certifications. Answer is Credibility. Oracle Certifications gets you a competitive edge in comparison to other candidates with similar skills. In this competitive market adding an Oracle certification in your resume will increase the worth of your resume and will makes you more likely to win out over other candidates. Oracle Certifications are among the highest paying IT certifications. Moreover 97% of the Global Fortune 500 companies use Oracle software.  Thus, Oracle certifications make you a more desirable candidate. You can earn an Oracle Certifications by following given steps-

  • Explore the Certifications and select a certification to pursue based on that technology area in which you have interest.
  • Prepare for your certification exam by taking suitable training.
  • Register for your exam.
Given below are details of Oracle to 10 Certifications which you can pursue-

Oracle Database 11g: Administration I

By clearing this exam you gain the certification of Oracle Database 11g Administrator Certified Associate.  The duration of exam is 9o minutes and it consists of 7o multiple choice questions. The price of this exam is US$ 245 and minimum passing score is 66%.

Oracle Database 11g: Administration II

The duration of this exam is 120 minutes and it contains 78 multiple format questions. Minimum passing score in this exam is same as Oracle Database 11g: Administration I, that is, 66%.  By passing this exam you get the certification of Oracle Database 11g: Administration II. The price of this exam is US$ 245.