It's not a secret anymore!*
The moose likes Features new in Java 7 and the fly likes Multithreading, Concurrency package and Best Practices - Beginning Java 7 book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Features new in Java 7
Bookmark "Multithreading, Concurrency package and Best Practices - Beginning Java 7 book" Watch "Multithreading, Concurrency package and Best Practices - Beginning Java 7 book" New topic
Author

Multithreading, Concurrency package and Best Practices - Beginning Java 7 book

Teena Ashar
Greenhorn

Joined: Dec 01, 2008
Posts: 15
Hello,
In what depth are the below topics covered as part of Beginning Java 7 book:

1. MultiThreading
2. java.util.concurrent package
3. Common Best practices in Java

Will be great if comprehensive examples are covered especially in regards to Multithreading.

Regards,
Teena
Jeffrey Friesen
Author
Ranch Hand

Joined: Dec 29, 2012
Posts: 37
    
    5

Hi Teena,

Chapter 4 provides a thorough introduction to multithreading. You learn about the Runnable interface and the Thread class, thread synchronization and volatile, and thread-local variables. I discuss deadlock, the producer-consumer classic example of thread communication (which involves the use of Object's wait() and notify() methods), Thread.uncaughtExceptionHandler, and more. I pull out certain items to be careful about, such as Thread's setPriority() method impacting an application's portability across different platforms. I also point out some nice-to-know items such as Thread's holdsLock() static method being handy in assertion statements.

Chapter 6 explores the java.util.concurrent package in terms of executors (Executor, ExecutorService, Future, Callable, and more), Synchronizers (I identify this package's various synchronizer classes and show how to use a countdown latch to trigger a coordinated start), concurrency collections (I demonstrate using BlockingQueue to implement producer/consumer), locks (I expand the BlockingQueue example of producer/consumer to also work with reentrant locks), and atomic variables. Furthermore, I introduce Java 7's ThreadLocalRandom class and the fork/join framework with a matrix multiplication example.

I occasionally mention best practices such as lazy initialization.

All the best.

Jeff

Teena Ashar
Greenhorn

Joined: Dec 01, 2008
Posts: 15
Hello Jeff,
Thank you for the response and appreciate the coverage, this will indeed be an useful stuff.

Regards,
Teena
Anandnld Java
Greenhorn

Joined: Mar 12, 2013
Posts: 4
Hi Teena,
Multi Threading is one of the favorite topic and its give more performance to your code. Also when we use it wrong way it gives impact on the output. So one who uses Thread need to know about there need and implementation fully. You can get complete Thread create example here - www.javadiscover.blogspot.in/search/label/Threads

Thanks
Anand

Teena Ashar wrote:Hello Jeff,
Thank you for the response and appreciate the coverage, this will indeed be an useful stuff.

Regards,
Teena
Teena Ashar
Greenhorn

Joined: Dec 01, 2008
Posts: 15
Hi Anand,
I second you, truly an area where right balance is essential in terms of usage and hence was keen to look forward for examples.
Thank you for sharing the link.

Regards,
Teena
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multithreading, Concurrency package and Best Practices - Beginning Java 7 book
 
Similar Threads
If prior UML knowledge is expected
BJO - Concepts to Best Code
Andrew's Book
Tomcat and Best Practices
New To Java