Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab2-Examples
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
Michele Fiori
Lab2-Examples
Commits
eaec7ebe
You need to sign in or sign up before continuing.
Commit
eaec7ebe
authored
Apr 11, 2024
by
Michele Fiori
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched logs to english
parent
0f6799fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
.DS_Store
src/main/.DS_Store
+0
-0
Consumer.java
src/main/java/producerConsumer/Consumer.java
+1
-1
Producer.java
src/main/java/producerConsumer/Producer.java
+2
-2
No files found.
src/main/.DS_Store
View file @
eaec7ebe
No preview for this file type
src/main/java/producerConsumer/Consumer.java
View file @
eaec7ebe
...
@@ -17,6 +17,6 @@ public class Consumer implements Runnable {
...
@@ -17,6 +17,6 @@ public class Consumer implements Runnable {
}
}
public
void
consume
(
String
message
)
{
public
void
consume
(
String
message
)
{
System
.
out
.
println
(
"Cons. "
+
id
+
":
prelevato
"
+
message
);
System
.
out
.
println
(
"Cons. "
+
id
+
": "
+
message
);
}
}
}
}
src/main/java/producerConsumer/Producer.java
View file @
eaec7ebe
...
@@ -10,7 +10,7 @@ public class Producer implements Runnable {
...
@@ -10,7 +10,7 @@ public class Producer implements Runnable {
public
void
run
()
{
public
void
run
()
{
while
(
true
)
{
while
(
true
)
{
String
message
=
produce
();
String
message
=
produce
();
System
.
out
.
println
(
"Prod. "
+
id
+
":
inserisco
"
+
message
);
System
.
out
.
println
(
"Prod. "
+
id
+
": "
+
message
);
queue
.
put
(
message
);
queue
.
put
(
message
);
try
{
try
{
...
@@ -25,7 +25,7 @@ public class Producer implements Runnable {
...
@@ -25,7 +25,7 @@ public class Producer implements Runnable {
public
String
produce
()
{
public
String
produce
()
{
counter
++;
counter
++;
return
"Messag
gio da "
+
id
+
" n. "
+
counter
;
return
"Messag
e number "
+
counter
+
" from "
+
id
;
}
}
}
}
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