java-fundamentals-exercises icon indicating copy to clipboard operation
java-fundamentals-exercises copied to clipboard

Create new hello-threads exercise

Open tboychuk opened this issue 4 years ago • 4 comments

The main goal of this exercise is to introduce threads and let people get their hands dirty with concurrent code. It should be an entry-level exercise that does not require previous experience with concurrency.

Location

  • create a new high-level module 7-0-java-concurrency
  • add 7-0-0-hello-theads exercise

Task

I guess it should be something like one class with a list of very simple methods. Each of those methods should require a person to implement a simple Thread-related logic. Here's a complete example

  • accept some logic as Runnable and return a new Thread based on it
  • accept a thread and start it
  • accept a thread and return its name
  • accept a thread and return its state
  • accept some logic, create a thread, start it and return it
  • accept working thread and wait for it to complete (join)
  • accept a thread and return its state
  • accept a list of tasks (Runnable) and return a list of threads that are in progress
  • accept a thread and make it sleep

tboychuk avatar Sep 30 '21 13:09 tboychuk

Check please my demo version tasks. I need to know if I understood the problem correctly main-task https://github.com/tkuzub/java-fundamentals-course/commit/ff7238b813b9a2048e69c5c1444837de0f272e95 main-test https://github.com/tkuzub/java-fundamentals-course/commit/9f5450efe85c7123f59d8bc47b922f0250c05b88 completed-task https://github.com/tkuzub/java-fundamentals-course/commit/c21ed7064052e2907ad7a0eea2cdc100d3577730

ghost avatar Oct 03 '21 10:10 ghost

@tkuzub it looks more or less fine. But it's not convenient to review commits in your repo.

  1. Please use this repo instead of your fork.
  2. Please create a PR (pull request) instead of just showing your commits.

In your case we are not sure about the exercise, so we need to iterate and discuss it. In order to show the idea, please create one PR: task + tests. I will try to do it myself and will leave you some comments in that PR. (Creating PR with completed solution is not required at this point)

So the next step is:

  • create a new branch in this repo
  • put your code there and create a PR

tboychuk avatar Oct 05 '21 11:10 tboychuk

@tkuzub I added another set of comments to your PR. Please let me know if everything is clear.

tboychuk avatar Oct 14 '21 17:10 tboychuk

Ok, before to end the day I will make the fix

ghost avatar Oct 15 '21 10:10 ghost