Home » Tag Archives: Concurrency (page 3)

Tag Archives: Concurrency

Java Concurrency Tutorial – Thread-safe designs

java-logo

After reviewing what the main risks are when dealing with concurrent programs (like atomicity or visibility), we will go through some class designs that will help us prevent the aforementioned bugs. Some of these designs result in the construction of thread-safe objects, allowing us to share them safely between threads. As an example, we will consider immutable and stateless objects. ...

Read More »

Java Concurrency Tutorial – Visibility between threads

java-logo

When sharing an object’s state between different threads, other issues besides atomicity come into play. One of them is visibility. The key fact is that without synchronization, instructions are not guaranteed to be executed in the order in which they appear in your source code. This won’t affect the result in a single-threaded program but, in a multi-threaded program, it ...

Read More »

Java Concurrency Tutorial – Atomicity and race conditions

java-logo

Atomicity is one of the key concepts in multi-threaded programs. We say a set of actions is atomic if they all execute as a single operation, in an indivisible manner. Taking for granted that a set of actions in a multi-threaded program will be executed serially may lead to incorrect results. The reason is due to thread interference, which means ...

Read More »

EJB 3.x : Lifecycle and Concurrency models (part 1)

java-interview-questions-answers

Java EE component life cycle and concurrency related details might not be new for seasoned professionals, but it is something which can take time to sink in for beginners.                 As far as EJBs are concerned, understanding their life cycle (and related concurrency scenarios) is extremely critical in order to ensure appropriate usage and solution ...

Read More »

Java’s Volatile Modifier

java-logo

A while ago I wrote a Java servlet Filter that loads configuration in its init function (based on a parameter from web.xml). The filter’s configuration is cached in a private field. I set the volatile modifier on the field. When I later checked the company Sonar to see if it found any warnings or issues in the code I was a bit ...

Read More »

Java EE Concurrency API Tutorial

jboss-wildfly-logo

This is a sample chapter taken from the Practical Java EE 7 development on WildFly book edited by Francesco Marchioni. This chapter discusses about the new Java EE Concurrency API (JSR 236) which outlines a standard way for executing tasks in parallel on a Java EE Container using a set of Managed resources. In order to describe how to use ...

Read More »

Top 50 Java Thread Interview Questions Answers for Freshers, Experienced Programmers

java-logo

You go to any Java interview, senior or junior, experience or freshers,  you are bound to see couple of questions from thread, concurrency and multi-threading. In fact this built-in concurrency support is one of the strongest point of Java programming language and helped it to gain popularity among enterprise world and programmers equally. Most of lucrative Java developer position demands ...

Read More »

Adding @atomic operations to Java

java-logo

Overview How might atomic operations work in Java, and is there a current alternative in OpenJDK/Hotspot it could translate to. Feedback In my previous article on Making operations on volatile fields atomic. it was pointed out a few times that “fixing” previous behaviour is unlikely to go ahead regardless of good intentions.   An alternative to this is to add an @atomic annotation. ...

Read More »

The data knowledge stack

java-interview-questions-answers

Concurrency is not for the faint-hearted We all know concurrency programming is difficult to get it right. That’s why threading tasks are followed by extensive design and code reviewing sessions. You never assign concurrent issues to inexperienced developers. The problem space is carefully analysed, a design emerges and the solution is both documented and reviewed. That’s how threading related tasks ...

Read More »

Playing with Java 8 – Lambdas and Concurrency

java-logo

So Java 8 was released a while back, with a ton of features and changes. All us Java zealots have been waiting for this for ages, all the way back to from when they originally announced all the great features that will be in Java 7, which ended up being pulled. I have just recently had the time to actually ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.