Looking for something else? Check the categories of JVM:
Akka Class loading Garbage Collection Google Guava Hibernate Java Java 8 Java bytecode Java collections Java concurrency Java I/O Java Instrumentation Java memory model JPA JUnit Maven Monitoring Off-heap Play Framework Scala async Scala collections Scala core Scala functional Scala OOP Scala syntax Scala tests Scala types Spring Data JPA Spring framework Spring Integration Spring security Spring Web MVC Tomcat
If not, below you can find all articles belonging to JVM.
When performance matters (when it does not?), dealing with a big task can prove to be very costly. One of solutions for this kind of bottlenecks could be the using of divide and conquer algorithms. In Java it can be retrieved in fork/join framework.
Working with collections in multi-threading environment is a little bit tricky. But fortunately, Java offers some objects able to store data in thread-safe way. One of them is CopyOnWriteArrayList, introduced with Java 5.
Java 8 brings another type of ForkJoinTask, CountedCompleter. And because sometimes this class is considered little bit obscure, we'll try to understand it through this article.
Arrays and collections look similar. Both handle a group of similar type of objects. However, they have some differences, going from the simplest maintainability cases going to performance ones.
Java 7 was released in 2011 and brought to us, programmers, several interesting features as diamond operators or new I/O library. Yet another useful thing is less popular than two cited previously - Objects tool class.
Enumerations storage in Java can be achieved through classical collections, such as lists or queues. However, one specific class is adapted to manage only enums - EnumSet.
Nowadays more and more applications are composed by several different data layers, beginning from the classical RDBMS and finishing in more adapted to some situations (search or graph relationships for example) NoSQL solutions. An interesting feature of JPA allows to notify no-JPA layer about some changes made on entities, exactly as in other solutions coming from event-driven development approach.
Until now in our examples we were using object inheritance based on entity classes (@Entity). However, we can also construct classes hierarchy without that, by using another JPA's annotation: @MappedSuperclass.
One of reasons-to-be of relational databases are relations. JPA provides very flexible way of manipulating them, through cascade attribute of annotations responsible for related objects (database tables).
JPA 2.0 brought some improvements for handling object collections. Before this release, to associate two objects, we were forced to define them as entities and use one from (One|Many)To(One|Many) mapping annotations. With 2.0 version came another possibility - @ElementCollection.
One of very popular pitfalls of database object mappers is the number of executed queries before constructing final entity. In Hibernate with FetchMode enum we can control better the quantity of queries executed against the database. However, in some cases we can need some supplementary help in the form of result transformers.
Relation database management systems (RDBMS) are based on relational model. Naturally, all mapping systems must be able to represent these relationships on application layer. JPA defines several ways to do that, but all have some common points. One of them is the technique of fetching associated data.
One of big changes in Java 8 regarding to Java 7 was the replacement of permanent generation by metaspace. Even if this change dates from more than year ago, it's worth to dedicate some lines about this new element in memory.
Static methods in programming have some important roles. Mostly used as utility methods, they help to differentiate normal, business objects, from universal purely non contextual ones. They also gained a lot of recognition thanks to popular libraries, such as Google Guava. But there are another role useful in the case of static methods in Java ?
JDK 7 introduced a interesting concurrency concept of mix between CountDownLatch and CyclicBarrier mechanisms. It's name - Phaser.
In the previous article we saw how to load simple classes in Java. But loading classes one by one, and even exporting class files at the same way, is less practice that working with archives as JARs.
When you meet OutOfMemory or another error caused by the memory, you have some ways to debug. If you were persevering, you can use memory dump made with -XX:+HeapDumpOnOutOfMemoryError parameter. If you're even more persevering, you could see how Garbage Collector works thanks to two another JVM arguments: verbose and GC details printing.
Often when somebody starts to learn Java, he meets the problems associated with classes loading. These problems are mostly always caused by class loaders described more in details in this article.
Before writing production code based on Java's executors, we should learn another inseparable concept of concurrency, thread pools.
As a developer who learned Java basically on web applications, understanding of byte existence in Java may be difficult. In this article we'll try to explain the reason of being of byte in Java environment.