Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java EE 8 High Performance

You're reading from   Java EE 8 High Performance Master techniques such as memory optimization, caching, concurrency, and multithreading to achieve maximum performance from your enterprise applications.

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788473064
Length 350 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Romain Manni-Bucau Romain Manni-Bucau
Author Profile Icon Romain Manni-Bucau
Romain Manni-Bucau
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Money – The Quote Manager Application FREE CHAPTER 2. Looking Under the Cover – What is This EE Thing? 3. Monitor Your Application 4. Application Optimization – Memory Management and Server Configuration 5. Scale Up – Threading and Implications 6. Be Lazy; Cache Your Data 7. Be Fault-Tolerant 8. Loggers and Performances – A Trade-Off 9. Benchmarking Your Application 10. Continuous Performance Evaluation 11. Another Book You May Enjoy

Setting up the environment

Before starting with writing code, make sure that you have an environment ready to work with Java EE. We need a Java Virtual Machine 8 (JVM 8) and, more particularly, the Java Development Kit 8 (JDK 8). As a quick reminder, Java EE version V is based on Java Standalone Edition (Java SE) version V as well. You can download the JDK on the Oracle website (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).

Alternatively, you can download the OpenJDK version of the JDK on the OpenJDK project website (http://openjdk.java.net/install/), but I recommend that you use the Oracle version. We will discuss this later in the book.

Don't forget to accept the license agreement and select the right distribution for your operating system (Windows, Linux, or macOS).

Now that we have a JDK, we need a tool to build our application and convert it into a format that we will be able to deploy in our Java EE server. This book will use Apache Maven (https://maven.apache.org/) to build the application. It can be downloaded on the Apache Maven download page (https://maven.apache.org/download.cgi). We need the binary distribution; Linux users have to select the tar.gz format while Windows users have to select the .zip archive.

At this point, we have everything we need to create our application. You will probably want to have an Integrated Development Environment (IDE), such as NetBeans (https://netbeans.org/), Eclipse (https://eclipse.org/ide/), or Intellij Idea (https://www.jetbrains.com/idea/). Since this book is more about performance than development, we won't go into much detail about IDEs. If you need one, just select the one you are the most familiar with.

To ensure that the environment is ready, we will set variables to define where to find the software without having to use the full path to the binary or script each time. JAVA_HOME will point to the folder you extracted from the JDK, and MAVEN_HOME will point to the folder you extracted from the Apache Maven archive. Here is an example for Linux (replace export with set for a DOS shell):

$ export JAVA_HOME=/home/developer/jdk1.8.0_144
$ export MAVEN_HOME=/home/developer/apache-maven-3.5.0

Now, we need to ensure that the JDK and Maven tools are available. For this, we add them to PATH on Linux and Path on Windows:

# On Linux
$ export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH

# On Windows
$ set Path=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%Path%

You can validate your setup by executing the following command:

$ mvn -version
Maven home: /home/developer/apache-maven-3.5.0
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /home/developer/jdk1.8.0_144/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-32-generic", arch: "amd64", family: "unix"

To run a Java EE application, we also need a container, such as GlassFish, WildFly, WebSphere Liberty Profile, or Apache TomEE. The deployment being specific and Java EE 8 being very recent, we will use GlassFish in this book.

Finally, to get everything ready, we will use a database. We will use MySQL as a very common case, but any other relational database will work as well. You can download MySQL from https://dev.mysql.com/downloads/mysql/, but most Linux distributions will have a package ready to install. For instance, on Ubuntu you can just execute the following line:

sudo apt install mysql-server
You have been reading a chapter from
Java EE 8 High Performance
Published in: Jan 2018
Publisher: Packt
ISBN-13: 9781788473064
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime