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

The application server

Java EE defines specifications and, therefore, you can find several different implementations. Each major vendor has its own server but, of course, for us and Java EE, a lot of servers are fully open source. As Java EE 8 is very recent, we will use GlassFish, which is the reference implementation and is therefore the first one to be compliant with the specification (it must be released with the specification). However, there are a lot of alternatives (such as Apache TomEE, Wildfly, Payara, Liberty Profile, and so on), which will probably follow in the coming months.

GlassFish can be downloaded from its website (https://javaee.github.io/glassfish/download). We need the 5.x version to target Java EE 8, but due to its early release, a major part of this book will work with the previous versions.

If you want to integrate it with your development environment (and Maven), you can add the GlassFish repository to pom.xml, as follows:

<pluginRepository>
<id>maven-java-net</id>
<url>https://maven.java.net/content/groups/promoted/</url>
</pluginRepository>

Add the GlassFish plugin without forgetting to specify the version of the server in order to override the default one, which is now quite old:

<plugin> <!-- glassfish.version = 5.0 -->
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.2.2</version>
<configuration>
<app>target/${project.build.finalName}</app>
<port>9090</port>
<contextRoot>${project.artifactId}</contextRoot>
</configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>simple-glassfish-api</artifactId>
<version>${glassfish.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>${glassfish.version}</version>
</dependency>
</dependencies>
</plugin>

With this setup, you can run the following command to package the application as war and deploy it in GlassFish:

$ mvn package embedded-glassfish:run

To shut down the server, type X and ENTER.

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