Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
producerConsumerLab
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diaa.hanna
producerConsumerLab
Commits
122071d0
Commit
122071d0
authored
Nov 29, 2025
by
drnull03
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ANSWERING_AND_PROPOSING_A_SOLUTION.pdf and changed the readme
parent
c08df5be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletion
+27
-1
ANSWERING_AND_PROPOSING_A_SOLUTION.pdf
ANSWERING_AND_PROPOSING_A_SOLUTION.pdf
+0
-0
ANSWERING_THE_AI_RELATED_QUESTION.txt
ANSWERING_THE_AI_RELATED_QUESTION.txt
+0
-0
README.md
README.md
+19
-0
App.java
src/main/java/com/producerConsumerLab/App.java
+8
-1
No files found.
ANSWERING_AND_PROPOSING_A_SOLUTION.pdf
0 → 100644
View file @
122071d0
File added
ANSWERING_THE_AI_RELATED_QUESTION.txt
deleted
100644 → 0
View file @
c08df5be
README.md
0 → 100644
View file @
122071d0
To run the code provided just head to the root of the project
then type
mvn clean
mvn compile
mvn exec:java
PS: The middle layer multiple consumers just CAPTILIZE the Strings
The code is commented and easy to understand
six threads at play here:
1.
main thread.
2.
producer thread.
3.
three consumerCap threads.
4.
one ConsumerWriter thread.
\ No newline at end of file
src/main/java/com/producerConsumerLab/App.java
View file @
122071d0
...
...
@@ -4,6 +4,13 @@ import java.io.FileNotFoundException;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
//here we did offload the thread shared content to be managed by main thread
//note to the instructor having saparate maing thead in App.java in every project is always better lets keep doing this pls :)
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
...
...
@@ -14,7 +21,7 @@ public class App {
BlockingQueue
<
Message
>
fileContentQueue
=
new
LinkedBlockingQueue
<>();
BlockingQueue
<
Message
>
postProcessingQueue
=
new
LinkedBlockingQueue
<>();
//this can be changed and it will still work
int
numCapConsumers
=
3
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment