| By Parameswaran Seshan | Article Rating: |
|
| October 16, 2008 08:00 PM EDT | Reads: |
5,057 |
Applications that have high performance as a quality goal would motivate a programmer to design and build them as multithreaded apps. The Java programming environment provides for parallel execution of logic by using threads. However, this is at a lower level and provides limited capability.
To make multithreading work successfully in an application, programmers have to handle higher-level concerns like
synchronizing the execution of multiple threads, handling exceptions in threads executing in parallel, limiting the number of threads in the runtime environment, and thread pooling. Java programmers need an easy-to-use, standardized, trusted, and efficient library to take care of concurrent programming. The concurrent utility developed by Doug Lea is a very popular and useful library for this purpose. By taking the example of a BPMS process execution platform's implementation, we'll look at how we could use the concurrent utility's classes to build a multi-threaded application. This is based on my experience designing and building a BPMS server in Java.
One scenario where concurrent programming is very important is in a business process management system (BPMS). The runtime part of a BPMS, generally referred to as the BPMS server, handles the execution or automation of business processes. In this article, let's look at how we could use the concurrent utility's classes to build a multithreaded application by using a BPMS process execution platform based on my experience in designing and building the same in Java as an example.
Concurrent Utility
Doug Lea, a professor at the State University of New York (SUNY) at Oswego, created a concurrent library (util.concurrent package) in the late '90s that could help handle multithreaded scenarios in Java applications and he made the library openly available. It became so popular with Java programmers that it was included in Java 5.0 (JDK 1.5) as the Java.util.concurrent package. For concurrent programming, it defines a few interfaces and provides their implementations, which are efficient, well-tested, and standardized. The last version prior to its inclusion in JDK 1.5 was util.concurrent 1.3.4. This was the version that we originally used while building our BPMS, since BPMS was based on JDK1.4. To make the future migration to JDK1.5 easier, we subsequently replaced the 1.3.4 release of the concurrent library with the backport of the main java.util.concurrent Java 5.0 classes made available by Dawid Kurzyniec. The package name for the backport is edu.emory.mathcs.backport.Java.util.concurrent.
At a broad level, the library provides the following components: an executor for thread-based execution, synchronizers that aid in synchronizing thread executions, queues that are thread-safe and scalable, concurrent collections, and timing for time handling. From these, we used wxecutor and synchronizers heavily in the BPMS runtime platform and I will explain the usage details in subsequent sections. Executor is used to execute tasks in threads; we could run the task in a separate thread (new) or run the task in the same thread as the current one. ThreadPoolExecutor is an executor implementation that executes the task by utilizing a thread from the managed thread pool. This gives better performance due to the reduced overhead; it also manages the resources (threads) better including bounding them.
Published October 16, 2008 Reads 5,057
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Parameswaran Seshan
Parameswaran Seshan is a Senior architect with E-Comm Research Lab, Infosys Technologies Limited, Bangalore, India. He has around 14 years of work experience in the IT industry, involving research, teaching, architecture, and programming. His areas of interest include Process-centric architecture, Intelligent software systems, software architecture, Business Process Management systems, Web services and Java.
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Names The World's 30 Most Influential Virtualization Bloggers
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects
































