We should start calling Hazelcast, Hazelfast. Hazelcast 3.6 EA shipped last week, and it is very fast. Compared to what, you ask? Well, compared to everything. How do we know this? Well, our competitors made their own comparative benchmarking tools, YardStick and RadarGun. And we ran them against Hazelcast as we were developing 3.6. We were getting faster anyway thanks to our dedicated performance team, but there is nothing like competition to spur improvement.Hazelcast Versus Infinispan/JBoss Data Grid
On RadarGun, the Infinispan tool, we are faster in all tests with the biggest margin begin 80%.
A few years ago in the Java world it was almost obvious that every "enterprise" class project needed JPA to communicate with a database. JPA is a perfect example of "leaky abstraction" described by Joel Spolsky. Great and easy at the beginning but hard to tune and limiting at the end. Hacking and working directly with caches, flushes, and native queries is a daily routine for many backend developers involved in the data access layer. There are enough problems and workarounds to write a dedicated book "JPA for hackers", but in this article I'll focus only on concurrent entity processing.
Let's assume this situation: we have Person entity in which some business process is updated by some service.
We have just had the twentieth edition of JavaOne in San Francisco. This would be my twelfth attendance in unbroken series since 2004. What are the biggest lessons that potentially shed a light on Java’s future.
Arun Gupta for Refactor your Java EE Applications with Microservices and Containers (CON1700)
Using java.util.HashMap from many threads without any synchronization leads to race conditions. So we need some kind of synchronization. The easiest way is to synchronize the complete class. Another way is to use a java.util.concurrent.ConcurrentHashMap. But what does this mean to the performance of the application?
As an example we use a HashMap to count the occurrence of a String:
As expected if we run the method “testMethod()” with two threads we see a race condition. Output from vmlens, a tool to detect race conditions:
Working with JSON is a very common task. In Scala, you can do it in many ways, either with the help of Java popular libraries such as Jackson or using Scala specific libraries. How do you choose from Spray JSON, Play JSON, Argonaut, Jackson, Rapture and others?
One day I received a test task on an interview. I had to implement a JSON serialization and deserialization of a Checkout object in the context of e-commerce.
Debating and discussing Go package management has become a popular topic. Most people agree that the out of the box package management is insufficient. But, what should be used to complement the Go toolchain and what changes, if any, should the Go toolchain make?
Package management for programming languages is nothing new. It’s worth learning and discussing how package management is handled by other languages. This can fuel our discussions and decision making. I’ve personally been studying this as part of my work on Glide.
The introduction of annotations with J2SE 5 has changed how we write and process Java. Besides Java SE's predefined annotations, frameworks, IDEs, and toolkits have introduced their own custom annotations. The Checker Framework has provided examples of how custom annotations can be used to add greater type safety in Java. In this post, I look at the writing of a simple custom annotation and using it in NetBeans (8.0.2) and IntelliJ IDEA (14.0.3) to help developers identify issues in their code that need further attention.
In the article Making the Most of Java's Metadata, Part 2: Custom Annotations, Jason Hunter demonstrates an @Unfinished annotation as an example of writing a custom Java annotation. I will demonstrate a different implementation of an @Unfinished annotation in this post. That's the beauty of custom annotations: one can write an annotation to best fit one's needs. The code for my @Unfinished annotation is shown in the next code listing.
This year at JavaOne 2015 there was a recurring theme across many of the Cloud and DevOps tech sessions that were promoting self-contained deployable JARs (not EARs or WARs) as a more efficient approach for deploying lightweight Java based services. This approach also plays well for a microservices type architecture and can also easily make use of containers, like Docker, PaaS offerings like CloudFoundry or Heroku, or even Oracle’s new Java SE Cloud Services offering.
Being able to deploy small, self-contained services (compared to large, monolithic EARs) brings a whole range of benefits, like being able to deploy more often, and deploy individual services individually without touching or impacting any of the other deployed services.
Initially, I wanted to call this blog – ‘Flexible timeouts with interceptor driven retry policies‘ – but then I thought it would be too ‘heavy’. This statement, along with the revised title should (hopefully) give you an idea of what this post might talk about ;-)The Trigger
This post is primarily driven by one of the comment/questions I received on one of my earlier posts which briefly discussed timeout mechanisms and how they can be used to define ‘concurrency policies’ for Stateful and Singleton EJBs.
From time to time it is necessary to just take the little effort to think outside the box. This is a good habit for every developer and even if you just spend 10% of your time, with new and noteworthy technology, you will gain experience and broaden your knowledge. I wanted to look into Scala and Akka since a while. Both well known old acquaintances on many conference agendas. But honestly, I've never felt the need to take a second look. This changed quite a bit when I started to look deeper into microservices and relevant concepts around it. Let's get started and see what's in there.
What Is Akka? And Why Scala?
Remember the times when we had to register dispatchers, viewResolvers, etc. to make our spring application web app? Then there was @EnableWebMvc annotation, and now even this is redundant.
These days the only thing you need to do is to add org.springframework.boot:spring-boot-starter-web dependency to your project and everything else is done automagically.
JDK Enhancement Proposal (JEP) 277 ("Enhanced Deprecation") proposes to "revamp the deprecation annotation and provide tools to strengthen the tail end of the feature life cycle." Some of the limitations of the current @java.lang.Deprecated have bothered me for some time. I particularly would like to be able to provide text with @Deprecated rather than being forced to place explanatory text in a corresponding Javadoc @deprecated comment. In this post, I look at a custom annotation that gives a feel for the type of extra metadata JEP 277 proposes be included in a new and improved @Deprecated annotation.
The code listing that follows contains the definition of dustin.examples.annotations.Deprecated, an implementation which mostly mirrors what is described in the JEP 277 proposal.
In this post we are going to cover working with the Optional class introduced in Java 8. The introduction of Optional was new only to Java. Guava has had a version of Optional and Scala has had the Option type for some time. Here’s a description of Optional from the Java API docs:
A container object which may or may not contain a non-null value.
Groovy is a scripting language, so it is possible to run Groovy code without compiling to Java byte code. The necessary condition is that Groovy is installed on your machine. Then, running a Groovy script in a shell looks like the following line:~>groovy TestScript.groovy
Now, something is wrong with the script on a special environment. You want to debug your Groovy script from the shell.
The diagram below is the Java Memory Model for the Heap as well as the PermGen for any Java Application running in the Java Virtual Machine (JVM). The ratios are also provided to get a fair understanding of how the distribution of allowed memory is done across each of the generation types. All of the info is completely applicable up to Java 1.7 (inclusive). This diagram is also known as the 'Managed Area' of the memory model.Java Memory Architecture (Java Memory Model)
This weeks challenge is a little harder and should really tax your brains. Basically I would like you to find the first instance of an arbitrary length substring within a string without using regular expressions or the find/indexOf/search functions of the String object. So writing it in a low level aproach at a character level.
So in the case of the above example I am looking for the index of the first letter of the word end in the string you see there.
As a Java based CMS, dotCMS handles a lot of different use cases for managing and delivering content. Recently, we were asked if dotCMS can deliver Github flavored markdown content. We thought that this would be a great example of how easy it is to extend dotCMS with OSGi plugins. (As a side note, this blog - as seen on dotcms.com - is actually written using the plugin).
Some background for developers stuck in 2008, Markdown is a text to html parser originally written by John Gruber. It provides a user a simple, small set of markup tags that is parsed and rendered as standard HTML for consumption by browsers or even less capable views or viewports. Github Flavored Markdown, or GFM, offers a few extensions for further formatting, including support for strikethrough, url auto-linking, syntax highlighting and tables, Because of the ubiquity of github as a coding resource, GFM has become a de facto standard for commenting, documentation and other online authoring tools that needs support for formatting, but want to limit, uh, “creativity”.
Hi all. Just published an open source library to the Maven Central Repository. As the author of this project, I am here to shout out the exciting news :)
ParallelGit is a library to help you manipulate your local Git repository. It allows you to access your repository as it were a native file system (via Java 7 nio FileSystem interface).
Today, JetBrains announced a new release of their popular IDE IntelliJ IDEA. The company promised the new release brings a new set of features and tools, UI improvements, and improved coding assistance.
In addition, JetBrains' new in-development JVM language, Kotlin, has gone into Beta. Naturally, the new language is supported in IntelliJ IDEA 15.
Recently I've taken charge on what I think is a great opportunity for writers and topic experts in the devsphere—our new Zone Leader Program. In a nutshell, the Zone Leader Program is an effort to put topic experts and practioners in the software industry at the helm of the content we publish on DZone. A sizeable portion of the content you've been reading on DZone recently has actually been written or published by Zone Leaders!
If you're interested in learning more and maybe being a Zone Leader yourself, shoot me an email.