Deployment Automation of Docker WebLogic Cluster on Any Cloud

Java Lobby Announcements - Mon, 2015-11-09 22:43

Disclaimer -- This is still work in progress. This blog is meant for DEV/TEST environments.


Java developers and DevOps professionals have long struggled to automate the deployment of enterprise Java applications. The complex nature of these applications usually meant that application dependencies and external integrations had to be re-configured each time an application was deployed in DEV/TEST environments.

Categories: Java

Deployment Automation of Docker WebLogic Cluster on Any Cloud

Java Lobby Announcements - Mon, 2015-11-09 19:11

Java developers and DevOps professionals have long struggled to automate the deployment of enterprise Java applications. The complex nature of these applications usually meant that application dependencies and external integrations had to be re-configured each time an application was deployed in DEV/TEST environments.

Many solutions advertised the “model once, deploy anywhere” message for application deployments. In reality, however there were always intricacies that made it very difficult to re-use an application template across both an on-premise vSphere virtual environment and an AWS environment, for example. More recently, however, Docker containers popularized the idea of packaging application components into Linux Containers that can be deployed exactly the same on any Linux host as long as Docker Engine is installed. Unfortunately containerizing enterprise Java applications is still a challenge mostly because existing application composition frameworks do not address complex dependencies, external integrations or auto-scaling workflows post-provision.

Categories: Java

Hazelcast Uses Infinispan and Apache Ignite's Own Benchmarks and Beats Them

Java Lobby Announcements - Mon, 2015-11-09 08:23

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%.

Categories: Java

JPA in Case of Asynchronous Processing

Java Lobby Announcements - Mon, 2015-11-09 07:45

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.

Categories: Java

JavaOne the 20th Edition – Ten Takeaways

Java Lobby Announcements - Mon, 2015-11-09 07:27

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.

  1. Modularization; the effort – it has taken almost nine years from the first mention of modules at Java 2007, or rather by the time that JDK 9 is released in September 2016 as general availability. In fact, it will be 11 solid years, ever since JSR 277 the Java Module System. When we think about this effort, it will be more a decade of activity and thought (See Stanley Ho’s original announcement). Oracle’s modularization of the JDK effort requires a biography of its own. Perhaps, Mark Reinhold, will get around to writing it one day, may be as the mythical man-month of the 21st century.

    It is frightening to think rewriting, effectively, Java so that it follows HIGH COHESION and LOOSE COUPLING took almost decade. Everyone else not in the JDK engineer should be extremely scared, especially if the business that you are involved in, has it own humongous mountain of TECHNICAL DEBT. Many institution cannot afford to upgrade, rewrite and reorder legacy classes, packages, let alone modules. Indeed, the cost of maintainability is about to go astronomical for those businesses that struggle under the weight and remain entrenched with Classic Java (JDK 1.0 to 7.0) For Oracle, they had no choice to pay the entire cost of development, design and architecture for the benefit of the entire Java platform and community in order to move forward to better and greater deads in the future. Oracle ought be immensely congratulated when we do reach JDK 9 GA in 2016.
  2. Modularization, the future – the new proverbial no brainer – I do believe Java and the practicing developer, designer and architect community have a LINE-IN-THE-SAND (aka DEMARCATION POINT or DISRUPTION LAYER), which we will pass through in 2016.  A modular system can change faster than the JDK platform. If Project Jigsaw is designed correctly, then you no longer have to contend with CORBA or the old fashion IBM derived java.util.Date and java.util.Calendar. In theory, you ought to be able to replace these module services and remove them if they are unnecessary. If you do not need Swing, then that module can go, same for JavaFX and AWT for server only deployment. Whilst backwards compatibility for Java platform is guaranteed, then it means opportunity for experimentation and new ideas.

    For recruitment sector, I predict, in 2017, JDK 9 will be CAMEL’S BROKEN BACK. I believe nobody will want to touch Java SE 7 or before (Classic Java) with a barge pole when they can move ahead quicker.  The top engineers will look at your job specification and run hundred miles if there is even an hint of classic Java there. You can offer £1000 per day for 6 months, but who seriously would go through technical debt and attempt to re-modularise ancient Java code, when the next women in the business down the road, is cracking on with the modern modular Java frameworks, gaining considerable experience, moving ahead of the pack, building the next greatest thing on JDK 9. On the other hand, Modularisation does not solve the technical debt, mountains or hill of it. If your business’s mission critical software is an unassailable ball of mud, then you will continue suffer the debt unless there is Agile change of behaviour. I think this is reason why the Oracle JDK 9  team want us to be the early-access early adopters in order to test their enterprise software as much as possible.
  3. More Push Java in the Cloud – At JavaOne 2015 there were a lot ideas and conference talks on Micro services and building Cloud enterprise applications.  The exhibition had a few cloud vendors like JElastic, Red Hat, Pivotal and CloudFoundry. Oracle released its own long-awaited cloud offering called the Oracle Java Cloud.  Ironically, their PaaS solution offers server clustered with Oracle Coherence, which used to be called Tangasol. Cameron Purdy, a very recent ex-Vice President of Oracle, created this early distributed grid and caching solution and, actually, one of his advocates, Brian Oliver, came to the JAVAWUG BOF 26 back in 2007 and gave a talk on Coherence.

    Arun Gupta for Refactor your Java EE Applications with Microservices and Containers (CON1700)

Categories: Java

Synchronized java.util.HashMap vs. java.util.concurrent.ConcurrentHashMap

Java Lobby Announcements - Mon, 2015-11-09 07:07

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:

import java.math.BigInteger; import; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; @State(Scope.Benchmark) public class MyBenchmark { private HashMapBasedCollectionmap = new HashMapBasedCollection(); private String nextSessionId(SecureRandom random) { return new BigInteger(130, random).toString(32); } public String[] buildNames(int size) { SecureRandom random = new SecureRandom(); String[] result = new String[size]; for (int i = 0; i < size; i++) { result[i] = nextSessionId(random); } return result; } @Benchmark public void testMethod() { String[] array = buildNames(40); for (int j = 0; j < 200; j++) { for (int i = 0; i < 40; i++) { map.addOne(array[i]); } } } }import java.util.HashMap; import java.util.function.BiFunction; public class HashMapBasedCollection { private HashMap<String,Integer> map = new HashMap<String,Integer>(); public static final BiFunction<String, Integer, Integer> fun = new BiFunction<String, Integer, Integer>() { @Override public Integer apply(String t, Integer u) { if( u == null ) { return new Integer(0); } return u + 1; } }; /** * * Warning: not thread safe * */ public void addOne(String key) { map.compute(key, fun); } }

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:

Categories: Java

JSON Serialization in Scala Using SBT and Play

Java Lobby Announcements - Sun, 2015-11-08 09:44

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.

Categories: Java

Seeing How The Other Side Lives, A Package Manager Overview For Go Developers

Java Lobby Announcements - Sat, 2015-11-07 14:28

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.

Categories: Java

Applying IDE Inspections to Custom Java Annotations

Java Lobby Announcements - Fri, 2015-11-06 11:51

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.

Categories: Java

Java EE App Servers: Are They Still Relevant in a World of Docker Containers?

Java Lobby Announcements - Fri, 2015-11-06 08:44

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.

Categories: Java

Implementing Auto Retry in Java EE Applications

Java Lobby Announcements - Fri, 2015-11-06 07:47

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.

Categories: Java

For Java Developers - Akka HTTP In The Cloud With Maven and Docker

Java Lobby Announcements - Fri, 2015-11-06 07:05

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?

Categories: Java

Up for Thee But Not for Me. The Struggle Is Real By @LMacVittie | @DevOpsSummit #DevOps

JDJ - Thu, 2015-11-05 23:00
It is an unwritten rule that web/app servers should never, ever pushed to 100% capacity. Never. Ignoring this unwritten rule will invariably result in the phenomenon we’ll call “up for thee but not for me”, which is simply the situation in which a web site or app responds to the guy in the next cube – but not for you.

read more

Categories: Java

Under The Boot – Spring Boot

Java Lobby Announcements - Thu, 2015-11-05 09:57

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.

Categories: Java

What Might a New @Deprecated Look Like?

Java Lobby Announcements - Thu, 2015-11-05 09:51

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.

Categories: Java

Working With Java 8 Optionals

Java Lobby Announcements - Thu, 2015-11-05 08:48

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.

Categories: Java

How to Debug a Groovy Script From Shell

Java Lobby Announcements - Thu, 2015-11-05 07:37

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.

Categories: Java

Tune into the Cloud: Simple Plan | @CloudExpo #IoT #BigData

JDJ - Thu, 2015-11-05 06:00
The phrase that whoever “Fails to Plan” actually “Plans to Fail” also applies to cloud computing. Many organisations are therefor putting together a cloud strategy. The question is whether the establishment of a company-wide cloud strategy is the right way. After all, the use of Cloud is not an end but a means, or as the IT manager of a large Dutch retail organisation recently succinctly put it: “For us cloud is not a strategy, but a useful set of tactics”.

read more

Categories: Java

Java Memory Architecture Cheat Sheet

Java Lobby Announcements - Wed, 2015-11-04 21:39

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)

Categories: Java

Code Challenge Series: Substring Search

Java Lobby Announcements - Wed, 2015-11-04 08:14
Last week we had Fizz Buzz code golf and the Winner was Mark Ogden in Perl with an amazing 63 characters. There were a couple of answers that were also very close to that as well so well done to them too.

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.

Categories: Java


Subscribe to EGJUG aggregator - Java