Oracle, with lead engineer Brian Goetz, have launched an experimental OpenJDK project to bring long-awaited features to the Java platform.
Major enhancements to generics & new ‘value types’ are planned. Highlights include:
- Value Types; highly-efficient small ‘objects’ without inheritance.
- Reified Generics; retaining their actual type at runtime.
- Generic Specialization; List<int> would be valid & highly efficient.
- ‘volatile’ enhancements.
The effort is named Project Valhalla. Here’s a preview: Continue reading
With the move to annotations for use of Spring, many projects have become based on component-scanning, auto-wiring and property-placeholder injection — an ‘implicit’ approach to configuration.
However, it can still be very useful to specify ‘explicit’ configuration. This gives us control of top-level application config & enables extensible configuration using the Strategy pattern.
Gaining control of configuration is crucial to enable per-customer/ per-application customization. Continue reading
Java 8′s ForkJoinPool & parallel streams are receiving some serious attention now. They seem a sophisticated concept to parallelize work, but some are warning of serious limitations.
Edward Harned of CoopSoft, in particular, has analyzed the Fork/Join design implemented in Java. Continue reading
Checked exceptions have always been a controversial feature of the Java language.
Advocates claim they ensure checking & recovery from failures. Detractors say “catch” blocks can almost never recover from an exception, and are a frequent source of mistakes.
Meanwhile, Java 8 and lambdas are here. Are checked exceptions becoming obsolete in the Java world? Continue reading
Threading is easy in Java, but today I was reminded of another of its pitfalls.
In Java- or container-provided threads, unhandled exceptions from our code will be printed or logged to the console. Create your own
Thread or use
ThreadPoolExecutor, and it’s a different story..
Threaded code tends to die silently. Nothing on the console or logs. Unhandled exceptions are invisible, and leave very few clues. Let’s look at why.
Rossen Stoyanchev at Spring Framework is finally ready to tackle the thorny issue of
The new annotation-based handlers allow easy definition of simple controllers, but when combined with JDK 7′s unpredictable ordering of reflected methods, problems could occur..
While SQL & Hibernate are mostly portable, one crucial area remains subject to incompatibility. Primary keying is the foundation of our tables, but key allocation is non-standard.
Most other SQL elements are standard & compatible, especially with the help of Hibernate. Joins, columns, mappings & queries will generally port without a hitch.
But when we get to identifier generation, the picture falls apart. Some databases use auto-increment/ identity columns, others sequences. Syntaxes differ, retrieving generated keys is variable at best. With such divergence, how can we possibly allocate keys portably? Continue reading
Recently, we looked at different ways to implement a thread-safe “lazily initializing” singleton in Java.
The simplest way approach is with ‘synchronized’ — but there were several other suggestions, some right, and some not-so-right (double checked locking).
One approach however, was 25 times faster..
In a recent role, I introduced Hibernate into an existing multi-tenant application. This required integrating Hibernate with an existing (custom) multi-tenant structure.
Hibernate – as standard – knows nothing about tenancies. So how can we accomplish such a task? Continue reading
Logging frameworks have become a standard part of projects, since Servlets and Log4J first emerged. But how should we log? Are we getting the most we can from it?
Many developers see logging & debugging as separate tasks. When confronted with a problem we set breakpoints, step through, inspect variables, and trace through loops – often finishing hours later..
Finding problems this way is hard. Does it have to be so difficult? Could there be a way to get right to the problem area, in just minutes? Sometimes without even needing to step through? Continue reading