Red Hat
May 4, 2015
by Thomas Qvarnström
There are many new exciting features in Java 8, but not all of them are important for Java EE servers and applications written to use them. JBoss EAP 6.4 is certified and tested using Java 8 and this previous article outlines the most important features of Java 8 when using JBoss EAP 6.4.

PermGen replaced with Metaspace

PermGen are in Java 7 used to store internal native data structures such as class information. In an application server where this information is changed when you re-deploy a class this may cause memory leaks that could eventually lead to  java.lang.OutOfMemoryError: PermGen spaceJBoss EAP 6 are designed to avoid this issue, but there where still a risk of having lingering references to native data structures that isn't used anymore, resulting in a memory leak. In Java 7 we could control the amount of memory assigned to PermGen using -XX:MaxPermSize JVM parameter. 

In Java 8 PermGen is replaced with Metaspace which means that memory used for native data structures default aren't limited. This may still have implication if a you have a memory leak. We can still control the amount of memory give to Metaspace using -XX:MetaspaceSize

What that this mean to you and your project? In most cases nothing. It's essentially a good thing that we do not need to preallocate the memory used for PermGen, however if you have memory leaks in your application today it may still lead to issues. It will just take longer to detect them since the issue will only occur when the host runs out of memory.

Lambda expressions

Being able to use Lambda expression and write functional programming style in Java is interesting and will make your code more dense, but may also improve performance.

See here for an example of using Lambda expressions in JBoss EAP.

Parallel Array Sorting

Java 8 supports Parallel sorting where an array is split up into smaller arrays which are sorted in parallel and then later merged together. This approach can be really good for large arrays, however as some people have showed it may also actually be slower for small arrays. The threshold will probably vary with your setup and sorting implementation. See for more details. Also main purpose of parallel sorting is to make use of CPU cycles of inactive cores. An application server is already built to handle multiple requests and will divid the workload in different threads making use of multiple cores. E.g. using parallel sort in an application server may lower the response time on a low utilised system, but during heavy load using parallel sort will probably not improve performance.

Original Post