This repository was archived by the owner on Dec 26, 2024. It is now read-only.
Conversation
NANNDA3463
reviewed
Nov 6, 2023
| public void run() { | ||
| getBuyItem(); | ||
| mart.enterStore(buyItem); | ||
| while (!isCheck.get()) { |
Contributor
There was a problem hiding this comment.
wait으로 기다리는데
while (!isCheck.get()) {이 있어야 할까용
NANNDA3463
reviewed
Nov 6, 2023
| mart.exitStore(buyItem); | ||
| } | ||
|
|
||
| public void getBuyItem() { |
Contributor
There was a problem hiding this comment.
여기에서만 사용한다면 private 접근 제어자를 사용하거나 랜덤한 값을 리턴하는 메서드면 더 좋겠습니다
NANNDA3463
suggested changes
Nov 6, 2023
| thread.interrupt(); | ||
| } | ||
|
|
||
| public void join() throws InterruptedException { |
Contributor
There was a problem hiding this comment.
사용하지 않는 메서드들은 지워줘도 좋을 것 같습니다
Contributor
Author
There was a problem hiding this comment.
추후에 사용할 수 있기 때문에 join을 만들었습니다!
| @@ -0,0 +1,15 @@ | |||
| package com.nhnacademy.parkminsu.assignment; | |||
|
|
|||
| public enum Items { | |||
Contributor
There was a problem hiding this comment.
이 enum은 사용처가 없습니다
지우거나 활용하면 좋은 코드가 될 것 같습니다
| Thread.sleep(ThreadLocalRandom.current().nextInt(1000, 10000)); | ||
| store.sell(); | ||
| System.out.println(thread.getName() + "가 구매했습니다"); | ||
| isCheck.set(true); |
Contributor
There was a problem hiding this comment.
이런 흐름이라면 isCehck가 필요 없을 것 같습니다
hyeonjaez
reviewed
Nov 6, 2023
| * 매장에서 물건이 들어오면 소비자에게 알려줌 | ||
| */ | ||
| public class Store { | ||
| AtomicInteger consumerCount; |
|
|
||
|
|
||
| public Consumer(String name, Store store) { | ||
| thread = new Thread(this, name); |
| @@ -0,0 +1,15 @@ | |||
| package com.nhnacademy.parkminsu.assignment; | |||
|
|
|||
| public enum Items { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.