-
Notifications
You must be signed in to change notification settings - Fork 0
Added ThreadPool #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ThreadPool/.idea/compiler.xml
Outdated
| @@ -0,0 +1,9 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В чем смысл хранения .idea в репозитории для гредл проекта? Пока -2
| private void compute() { | ||
| try { | ||
| result = supplier.get(); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему именно Exception, а не Throwable?
| */ | ||
| @Override | ||
| public <U> LightFuture<U> thenApply(Function<T, U> function) { | ||
| return addTask(() -> function.apply(get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" Метод thenApply не должен блокировать работу потока, если результат задачи X ещё не вычислен", -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно добавить тест, который это проверяет
| workers = new Thread[poolSize]; | ||
|
|
||
| Runnable workerRunnable = () -> { | ||
| LightFutureImpl<?> future; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы вынес тело Runnable в отдельный метод для улучшения читаемости
| * Shuts down all of its current workers. | ||
| */ | ||
| @Override | ||
| public void shutdown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мне кажется, метод shutdown должен завершаться только после завершения всех потоков. -1
| } | ||
| } | ||
|
|
||
| public ThreadPoolImpl(int poolSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Обычно поля и конструктор класса размещают в начале
|
Ок, 10/10 |
No description provided.