Project in Java Skill Tree

Concurrent Producer-Consumer with Guava Monitor

Beginner

In this project, you will learn how to implement thread communication using Google Guava's `Monitor` class. The project demonstrates a classic producer-consumer problem, where multiple producer threads add data to a shared buffer, and multiple consumer threads consume data from the buffer.

Java

Introduction

In this project, you will learn how to implement thread communication using Google Guava's Monitor class. The project demonstrates a classic producer-consumer problem, where multiple producer threads add data to a shared buffer, and multiple consumer threads consume data from the buffer.

🎯 Tasks

In this project, you will learn:

  • How to implement the producer and consumer logic using Google Guava's Monitor class
  • How to acquire and release locks using the monitor.enterWhen() and monitor.leave() methods
  • How to create custom Guard objects to control the conditions for acquiring the lock
  • How to use a thread pool to manage the producer and consumer threads
  • How to test the producer-consumer program and observe the output

🏆 Achievements

After completing this project, you will be able to:

  • Use Google Guava's Monitor class for thread communication
  • Implement the producer-consumer problem in a concurrent environment
  • Manage shared resources and avoid race conditions
  • Work with thread pools and apply concurrent programming concepts in practical scenarios

Teacher

labby

Labby

Labby is the LabEx teacher.