Java Lobby Announcements

Subscribe to Java Lobby Announcements feed
Recent posts in Java on
Updated: 2 hours 31 min ago

Flowing Through the Tubes of the Stream API (Java 8)

Fri, 2016-06-17 08:01

The target of this article is to show some features of Java 8 by example. In special, the features of Stream API, Lambda Expressions, and Functional Interfaces.

Functional Interface

A Funcional Interface is an interface with a single abstract method.

Categories: Java

The Top 10 Exception Types in Production Java Applications — Based on 1b Events

Fri, 2016-06-17 06:31

The Pareto logging principle: 97% of logged error statements are caused by 3% of unique errors

cWe received a lot of feedback and questions following the latest data crunching post where we showed that 97% of logged errors are caused by 10 unique errors. By popular demand, we’ll go a step deeper into the top exceptions types in over a 1,000 applications that were included in this research.

Categories: Java

To VI Or Not To VI [comic]

Fri, 2016-06-17 06:01
Categories: Java

Java, Java EE, Jython, Oracle, and More...: Help Move Java EE Forward

Thu, 2016-06-16 17:53

If you recall my post entitled Java EE 8: What is the Current Status, it is apparent that the progression on Java EE has certainly slowed down over the past several months.  There are definitely some JSRs under the Java EE umbrella that have more activity than others, but Java EE as a whole has seen little to no movement forward since JavaOne 2015.  This is not something to be taken lightly by anyone in the IT industry.  Java EE is a critical part of the industry, as there are thousands of web applications that have been built using the Java EE stack.  There are probably even more applications that have not been built using the full Java EE stack, but still rely upon some of the Java EE technologies..such as the Java Persistence API (JPA) or Java Message Service (JMS).

Why is it so important to move things forward?  Why not just leave things how they are and let Java EE fade away?  Plainly put, these technologies need to move forward in order to remain secure and make use of the current API technologies of today.  If one wishes to simply let Java EE stagnate, that means that all of the applications and services utilizing all or part of Java EE (much of the internet as we know it) are also stagnating, and cannot be moved forward to stay current with today's technology and security concerns.

Categories: Java

Spring Data Release Train Hopper SR2 Released

Thu, 2016-06-16 12:01

On behalf of the Spring Data team I’d like to announce the availability of the second service release of the Spring Data Hopper release train. The release ships 103 issues fixed. We fixed a couple of bugs in the area of repository projections, especially for JPA users and introduce Hibernate 5.2 compatibility with this release (also already back-ported to the Gosling release train for inclusion in the upcoming service release). Hopper SR2 is a recommended upgrade for all Hopper users and also users of previous release trains.

Here are the released modules:

Categories: Java

This Week in Spring: Spring Framework 4.3, jOOQ with Spring Boot, and Yak-Shaving

Thu, 2016-06-16 11:01

Welcome to another installment of This Week in Spring! This week I’m in London and Amsterdam (for the epic GOTO Amsterdam conference as well as the JDriven meetup and the Dutch Spring User Group). We’ve got a lot to cover, as usual, so let’s get to it!

Categories: Java

Why Java Is a Purely Object-Oriented Language... Or Why Not

Thu, 2016-06-16 10:01

Some years back when I started learning Java, I got to know that Java follows the Object Oriented Programming paradigm, and that everything in Java is an object—either a String (which was a char array in C) or an array itself.

But later on I found people saying on the Internet that Java is actually not purely Object-Oriented, as everything in Java is not an object; for example:

Categories: Java

Watch for Dependency Name Typos When Creating New Spring Boot Projects

Thu, 2016-06-16 09:01

If you use the Spring Boot CLI, it’s pretty easy to get a new project created from the templates with all required dependencies in place with something like:

spring init --build=maven --dependencies=web

This generates you a zip that you can unzip and import into your IDE and off you go. The trouble with the CLI currently though is that there’s no validation on the dependency names, so if you call

Categories: Java

Notes on Reactive Programming Part II

Thu, 2016-06-16 08:01

The basic building block of Reactive is a sequence of events, and two protagonists, a publisher and a subscriber to those events. It’s also OK to call a sequence a "stream" because that’s what it is. If we need to, we will use the word "stream" with a small "s", but Java 8 has a java.util.Stream which is different, so try not to get confused. We will try to concentrate the narrative on the publisher and subscriber anyway (that’s what Reactive Streams does).

Reactor is the library we are going to use in samples, so we’ll stick to the notation there, and call the publisher a Flux (it implements the interface Publisher from Reactive Streams). The RxJava library is very similar and has a lot of parallel features, so in that case we would be talking about an Observable instead, but the code would be very similar. (Reactor 2.0 called it a Stream which is confusing if we need to talk about Java 8 Streams as well, so we’ll only use the new code in Reactor 2.5.)

Categories: Java

Java Annotated Monthly: June 2016

Thu, 2016-06-16 07:01

Java: past, present and future – we’re still counting down to the release of Java 9, there are ever more resources for getting a handle on what Java 8 can offer us, and the Oracle vs Google court case is over (for now). The language is not the only thing that continues to evolve, well-used libraries like JUnit and Log4J are making the most of modern Java. But with all this change, we need to keep an eye on performance and correctness.

Java 9

Early Access build 121 is now available for JDK 9 and JDK 9 with Jigsaw.  Check the documentation for using the early access builds. There’s also a matrix of open source projects that have been tested against JDK 9. And don’t forget, if you do run into any unexpected behaviour, you can ask for help.

Categories: Java

Java Quiz: Switch Statements and Static Variables

Thu, 2016-06-16 06:18
Last Week's Answer

TreeMaps work with unique keys, which are the names of the students in this example.

When you enter the same name several times, the old one will be overwritten.

Categories: Java

Code Mistakes: Python's for Loop

Wed, 2016-06-15 10:01

I'm learning Python right now after years of using Java. It has actually helped a lot that I have been doing some work with Lisp and functional programming, as I think that has helped me bridge the gap between Python and Java. Still, there are some Java practices that I cling onto that cause me some trouble in a new language. Python's for loop was one of those trouble-makers for me recently.

I actually really like the way Python handles for loops, but years of Java conditioning had me a bit mixed up. I've gotten so used to defining an iterator, creating the end condition based on the iterator, and then defining how to iterate. For many applications in Python, there's no need to have all that detail. But it was the simplicity of the for loop that ended up causing me problems.

Categories: Java

Lambda Expressions in Java 8

Wed, 2016-06-15 09:01

Let's start with lambda expressions. What are they? And how do they work?

I Googled lots of posts and YouTube videos before now to understand lambda expressions, but I found it difficult to understand because I haven't used any functional language before. So I decided to write a blog post to help people like me.

Categories: Java

The Name Should Express the Intention

Wed, 2016-06-15 08:01

Here I will start with a code sample. Take a look at this:

if (code.isComplexOrUnreadable()) { refactor(code); }

Can you tell me what is wrong with this code? No?

Categories: Java

Scala Notes - Futures - 3 (Combinators and Async)

Wed, 2016-06-15 07:01

In the previous parts of this post, we discussed Futures and Promises. In this last part, we'll compose Futures using its powerful combinators.

Composing Futures

In the first post, we saw how to extract a value from Future using onComplete, foreach and in test cases using Await.result. Extracting a value from a single Future is good but many times we spawn more than one asynchronous operation and wait on multiple Futures to arrive at the final result. Even better, sometimes the result of one Future is fed into another or a chain of Futures.

Categories: Java

We Just Made Hazelcast 3.7 30% Faster

Wed, 2016-06-15 06:01

3.7 EA just got released. And I am happy to say our Performance Team led by Peter Veentjer found another amazing optimization. The main change this time was to remove notifyAll and synchronized blocks in the networking layer and replace them with LockSupport.park/unpark. The code change was done on the Member to Member code and the Client to Member code. So the change lifts performance for most operations by 30% across both topologies.

Hazelcast 3.6, based on the extensive benchmarks we do and publish, was already the fastest In-Memory Data Grid and Distributed Cache, including Redis. With this change we will open up a larger air gap between us and the rest. Look for our benchmarks against each to get updated over the next few months.

Categories: Java

Functional Programming: The Good and the Bad

Tue, 2016-06-14 10:01

Functional programming is becoming more popular today. We have more and more languages that support functional programming styles, and people are learning how to use them. It's no longer as esoteric as it once was—Ruby, Java, and JavaScript all use functional programming concepts today.

These languages have functional features, but are not functional languages. In my experience, functional languages like Erlang or ML have other features that lend a certain safety to programming that mainstream languages don't. One of these is the use of recursion and argument pattern matching to control program looping. You can use these kinds of constructs for flow control as well. Another is taking constant assignment seriously. I say constant assignment here because in these languages once you've bound a value to a variable, that variable is permanently bound to that value until it falls out of scope. The downside to these kinds of features is the difficulty in learning how to develop software using them. For those of us who have grown up using imperative languages, it's a hard transition.

Categories: Java

Folding the Universe Part I: Functional Java

Tue, 2016-06-14 09:01

Folding the Universe is actually the title of a book by Peter Engel, which is subtitled "Origami From Angelfish to Zen", suggesting that anything in the universe may be modeled out of folded paper. The analogy with computer programming is interesting since, in functional programming, nearly every problem can be solved with folds.

Computer programming is primarily about abstraction. Instead of doing the same basic tasks again and again, we once write programs to performs these tasks, and we can then build larger programs by composing these basic tasks. Probably one difference between functional and imperative programmers is the way they handle task abstractions. Most often, imperative programmers start thinking about abstracting subtasks when they realize that they are repeatedly writing the same code. But the depth of abstraction is often kept quite minimal. The main reason is that higher-level abstractions are generally provided by the language. Arithmetic operations on integers, for example, is provided by nearly all programming languages, so there is no need to write specific code to abstract them (although it is possible, and an interesting challenge!).

Categories: Java

Everyone Should Learn to Code?

Tue, 2016-06-14 08:01

Politicians, programmers, and celebrities have said it. Are they right?

It irritates me. It annoys me. It outrages me. People with very little understanding of schools try to dictate what we do. This is a good example. ‘Everyone’ doesn’t mean eighty-four-year-olds in dementia clinics. It doesn’t mean successful sole-traders. It means children. It means students. It means schools finding time in their curriculums.

Categories: Java

My Journey to Face the Lambda Expressions in Java

Tue, 2016-06-14 07:01

It’s not a great surprise that even when I am using many different programming techniques, programming languages, and libraries, I barely know five percent of them in a deep way. The fact is, it’s not a major problem, the real problem is that I only know the bare minimum about half of Java's core libraries and am only using them as APIs—Lambda expressions fall into this category. On top of which, whenever there is a talk about Lambda expressions, I get the feeling that everyone knows more about them than me. This is something I intend to change.

Lambda expressions are great in my eyes, but recently I discovered my inability to apply or write them without the help of an intelligent IDE (Intellij IDEA in my case). They have become only syntactic sugar for me (for more than two years, huh), and I wasn’t diligent enough to find out how they actually might work. So I have begun to study them and here in this post I have collected some of my reflections. I’ll not include any of code examples as you can find plenty of them following the links throughout the article.

Categories: Java