Home » Java » Core Java (page 262)

Core Java

The dreaded double checked locking idiom in Java

The issue discussed in this article is not new, but still tricky even for seasoned developers. The singleton pattern is a common programming idiom. Nevertheless when used with multiple threads, some type of synchronization must be done in order not to break the code. In a relevant article our JCG partner Manoj Khangaonkar from The Khangaonkar Report examines the double-checked locking idiom in ...

Read More »

Design Patterns in the JDK

Brian Du Preez, our JCG partner from Zen in the art of IT has made a very fine job of collecting the most common design patterns found in the JDK. The pattern list is indeed impressive and long, so let us babble no more and present it to you. I saw an article (well more of a rant) the other day, by ...

Read More »

Using JAXB to generate XML from XSD

This is a post originally published by Mohamed Sanaulla from Experiences Unlimited, our latest JCG partner. Mohamed explains how to use JAXB to generate XML from a given XSD. (NOTE: The original post has been slightly edited to improve readability) We can use JAXB to marshal the Java objects into XML using the given Schema and vice versa- unmarshal XML ...

Read More »

Java Fork/Join for Parallel Programming

The last few years a paradigm shift is taking place in the field of computer processors. For years, processor makers consistently delivered increases in clock rates, so developers enjoyed the fact that their single-threaded software executed faster without any effort from their part. Now, processor makers favor multi-core chip designs, and software has to be written in a multi-threaded or ...

Read More »

Java Memory Model – Quick overview and things to notice

In computing, a Memory model describes how threads interact through memory, or more generally specify what assumptions the compiler is allowed to make when generating code for segmented memory or paged memory platforms. It essentially describes, given a program and an execution trace of that program, whether the execution trace is a legal execution of the program. The Java memory ...

Read More »

Java Best Practices – Char to Byte and Byte to Char conversions

Continuing our series of articles concerning proposed practices while working with the Java programming language, we are going to talk about String performance tunning. Especially we will focus on how to handle character to byte and byte to character conversions efficiently when the default encoding is used. This article concludes with a performance comparison between two proposed custom approaches and ...

Read More »

ConcurrentLinkedHashMap v 1.0.1 released

Hello all, we released version 1.0.1 of our concurrent LinkedHashMap implementation. In the latest version several minor modifications have been made so as to improve performance when multiple threads iterate over the elements of the map. The latest version also introduces pluggable eviction policies. Of course you can implement custom eviction policies and use them with out ConcurrentLinkedHashMap as well. ...

Read More »

Java Best Practices – Queue battle and the Linked ConcurrentHashMap

Continuing our series of articles concerning proposed practices while working with the Java programming language, we are going to perform a performance comparison between four popular Queue implementation classes with relevant semantics. To make things more realistic we are going to test against a multi–threading environment so as to discuss and demonstrate how to utilize ArrayBlockingQueue, ConcurrentLinkedQueue, LinkedBlockingQueue and/or LinkedList ...

Read More »

Java Best Practices – String performance and Exact String Matching

Continuing our series of articles concerning proposed practices while working with the Java programming language, we are going to talk about String performance tuning. We will focus on how to handle String creation, String alteration and String matching operations efficiently. Furthermore we will provide our own implementations of the most commonly used algorithms for Exact String Matching. Many of these ...

Read More »