multithreading

Clojure: Challenge your Java assumptions

Clojure's immutable datatypes, lockless concurrency, and simple abstractions make parallel programming for multicore hardware simpler and more robust than in Java. Joshua Fox takes you on a tour of this exciting new language for the...

Hyper-threaded Java

Computer systems capable of true concurrency are becoming increasingly affordable. This article shows you how to make time-consuming tasks concurrent using the Java concurrency API, so your programs will run as fast as possible on...


Write thread-safe servlets

You finished your Web application, thoroughly tested it, and it's now deployed. You're feeling bullet proof and 10-feet tall, and then it happens...the customer-support calls start coming in: "We're seeing some strange things. A...

Add concurrent processing with message-driven beans

Adding concurrency to an application in the J2EE (Java 2 Platform, Enterprise Edition) framework is severely restricted because of two main reasons; first, the EJB (Enterprise JavaBeans) specification restricts spawning new user...

Simply Singleton

The Singleton pattern is deceptively simple, even and especially for Java developers. In this classic JavaWorld article, David Geary demonstrates how Java developers implement singletons, with code examples for multithreading,...

Can ThreadLocal solve the double-checked locking problem?

It has been suggested that java.lang.ThreadLocal can be used to fix the problems with the double-checked locking (DCL) idiom once and for all. ThreadLocal is indeed an underappreciated tool in the Java Class Library and does solve...

Avoid synchronization deadlocks

Though essential for ensuring the thread safety of Java classes, synchronization, if used improperly, can create the possibility for deadlocks. If you understand how your programs use synchronization, and apply consistent rules for...

Can double-checked locking be fixed?

In February, JavaWorld ran two articles on the double-checked locking idiom and its hazards, "Double-Checked Locking: Clever, but Broken and "Warning! Threading in a Multiprocessor World." In response to these articles, many JavaWorld

Double-checked locking: Clever, but broken

Many Java programmers are familiar with the double-checked locking idiom, which allows you to perform lazy initialization with reduced synchronization overhead. Though many Java books and articles recommend double-checked locking,...

Warning! Threading in a multiprocessor world

Many authors (myself included at one point) advocate the double-checked locking idiom to access a Singleton object in an intuitively thread-safe way. Unfortunately, for counterintuitive reasons, double-checked locking doesn't work....

User interfaces for object-oriented systems, Part 5: Useful stuff

This article begins putting the object-oriented principles discussed in this series to practical use. The author builds a small but nontrivial application: a Reverse Polish Notation calculator that can display a user interface either...

User interfaces for object-oriented systems, Part 4: Menu negotiation

This month's article continues the series on UI design for object-oriented systems. It starts off by clarifying a few points about the visual-proxy architecture, discussed in previous columns. The main body of the article then moves...

User interfaces for object-oriented systems, Part 3

This month's column continues the object-oriented design/GUI theme from the July and September Java Toolbox columns by looking at a widget that I use all the time: a wrapper around a Collection capable of creating a visual proxy...

Build user interfaces for object-oriented systems, Part 2: The visual-proxy architecture

This month, author Allen Holub returns to his discussion of user interfaces and explains how to implement a user interface without violating the encapsulation of an object with get/set methods. Using what he describes as a...

Building user interfaces for object-oriented systems, Part 1

This month's article, the first of a series on user-interface construction in object-oriented systems, looks at the underlying theory of object-oriented design from the perspective of the user interface. This installment in the new...

Programming Java threads in the real world, Part 9

This article finishes up the series on threads with a discussion of two more architectural solutions to threading problems: a synchronous dispatcher (or "reactor") and an asynchronous dispatcher (or "active object"). These dispatchers

Programming Java threads in the real world, Part 9

This article finishes up the series on threads with a discussion of two more architectural solutions to threading problems: a synchronous dispatcher (or "reactor") and an asynchronous dispatcher (or "active object"). These dispatchers

Programming Java threads in the real world, Part 8

The previous installment of Allen's ongoing Java threads series was devoted to low-level solutions to threading problems: locks of various sorts, timers, and so forth. This month's (penultimate) installment in the thread series moves...

Programming Java threads in the real world, Part 7

This month's column builds on the preceding installments of the Java Toolbox threads series, adding a few more tools to your multithreading arsenal. Columnist Allen Holub looks at reader/writer locks, which let multiple threads safely

Programming Java threads in the real world, Part 6

This month continues the thread theme by examining how to implement the Observer pattern (used by AWT/Swing for its event model) in a multithreaded environment. The article covers how to notify observers in an efficient, thread-safe...

Load More