This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java 7 Concurrency Cookbook: Testing Concurrent Code & Avoid Deadlock

 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Javier,

I am very interested in testing concurrent code and avoid deadlock in multi-threaded environment.
I found your book has a chapter discussing on testing and wonder if it would includes integration with testing and mocking framework like JUnit, TestNG, Mockito, etc.
In addition, if your book has tips on avoiding deadlock.

Thanks
 
Javier Fernandez Gonzalez
author
Greenhorn
Posts: 20
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Raymond

The book includes a chapter about testing concurrency code that includes:

-Monitoring concurrency related classes, as Lock, Phaser, Executor or the Fork/Join pool
-How to write effective log messages in a concurrent enviroment
-How to configure Eclipse and Netbeans to debug concurrent applications
-How to analyze concurrent code with FindBugs
-How to test concurrent code with the MultithreadedTC library

We have include the frameworks you mention, but it's an interesting theme to be included in future works.

The book includes an appendix, that it's not included in the physical book, but it can be downloaded from the Packt's website, that include some tips about how to design a concurrent application and how to avoid a deadlock situation. All the examples explained in the book show how to use the different elements of the Java Concurrency API avoiding deadlocks.

If you need more info, please let me know.
 
Stuie Clarky
Ranch Hand
Posts: 98
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Javier, in your experience have you come across any sample projects/applications that really excel in helping the programmer develop understanding of the different aspects of multi-threaded programming? I developed a simple 'car park' application at university that had threads representing cars entering and leaving the car park, however this was essentially a collection of counters being incremented/decremented. If anyone has any interesting resources, I would be grateful for the share.

Cheers,

S
 
Javier Fernandez Gonzalez
author
Greenhorn
Posts: 20
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Stuie

The book has a lot of examples and each of them explain a functionality of the Java 7 Concurrency API. I think all of them are very clear and explain well the concept they want to explain. You can download the source code of the book as Eclipse projects so you can play with them.

If you want to see a bigger real application that uses concurrency classes, you can investigate the source code of an open source project that uses them.

If you need more info, please let me know.
 
Stuie Clarky
Ranch Hand
Posts: 98
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information, I look forward to getting stuck into the examples

Cheers,

S
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic