JavaSpecialists.EU: Java Courses & Java Specialists Newsletter

1,386 阅读1分钟
原文链接: www.javaspecialists.eu
[Issue 234] Random Code Failures - Race Conditions Between Our Code and the JVM[1] Most of the time our code fails because of bugs in our code. Rarely, however, bugs in the JVM ecosystem cause our systems to fail. These are insanely difficult to diagnose in production systems. In this newsletter we look at two different such race conditions between our code and the JVM. [Issue 233] Intersection Types to give Lambdas Multiple Personalities[2] Lambdas are often described as anonymous inner classes without the boilerplate code. However, lambdas are more powerful. Firstly, a lambda does not always result in a new object. Secondly, "this" refers to the outer object. Thirdly, a lambda object can implement multiple interfaces. In this newsletter we will look at this third feature, where cast expressions use intersection types to produce lambdas with several interfaces.
[Issue 232] ByteWatcher from JCrete[3] Even though standard Java is not real-time, we often use it in time-sensitive applications. Since GC events are often the reason for latency outliers, such code seeks to avoid allocation. In this newsletter we look at some tools to add to your unit tests to check your allocation limits. [Issue 231] Why Crete?[4] In this newsletter, Heinz answers the question that he gets asked most: "Why Crete?" "Because I can" could be one answer, but the reality is a bit deeper than that.
[Issue 230] String Substring[5] Java 7 quietly changed the structure of String. Instead of an offset and a count, the String now only contained a char[]. This had some harmful effects for those expecting substring() would always share the underlying char[]. [Issue 229] Cleaning ThreadLocals[6] ThreadLocals should in most cases be avoided. They can solve some tough problems, but can introduce some nasty memory leaks, especially if the ThreadLocal class or value refer to our own classes, not a system class. In this newsletter we show some mechanisms that help under OpenJDK.
  Newsletter Index[7]