Skip to content

Conversation

@XRater
Copy link
Owner

@XRater XRater commented May 28, 2018

No description provided.

@XRater XRater mentioned this pull request May 28, 2018
Copy link

@dzharkov dzharkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока 5/10

os.flush();

final int number = is.readInt();
System.out.println("Total number of files: " + number);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А можно сделать интерфейс клиента таким, чтобы его можно было безболезненно переиспользовать для GUI?
Пока -1

throw new FileAlreadyExistsException();
}
final byte[] buf = new byte[BUF_SIZE];
try (final FileOutputStream os = new FileOutputStream(file)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давайте попытаемся избежать ручного манипулирования байтовыми буферами и воспользуемся IOUtils из внешней библиотеки?
Пока -1

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправил. Для отправки файла тоже можно было бы использовать такой способ, но, к сожалению, описанный интерфейс абстрактной сессии не позваляет. Менять же его ради одноразовай задачи не считаю логичным.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне скорее реализация нетривиальной логики руками кажется не очень логичной.
Пока по-прежнему -1

// all docs inherited from Session interface
@Override
public void run() {
new Thread(this::processRead).start();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По-хорошему нужно избешать создания потоков для каждой сессии. Иначе рост их количества быстро приводит к деградации JVM. Пока -1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, лечится это общим тред-пулом

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сноска из написанного нами конспекта (то, что было расказано на лекции).

Соглашусь с тем, что тред пула не хватает, добавил. Категорически не согласен с тем, что я не дожен создавать много потоков. Как я понимаю, в блокирующей реализации количество потоков равно 2n + |pool|.

image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аппеляция к конспекту засчитана, хоть мне все еще не кажется это правильным.
Баллы вернул

this.socket = socket;
this.id = id;
this.server = server;
executor = Executors.newSingleThreadExecutor();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В чем смысл отдельного потока для подкоманд?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

См. комментарий выше.

@dzharkov
Copy link

Извиняюсь, 4/9

@XRater
Copy link
Owner Author

XRater commented May 30, 2018 via email

Copy link

@dzharkov dzharkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока текущая оценка 8
Макс. оценка 9

@XRater
Copy link
Owner Author

XRater commented Jun 4, 2018 via email

@dzharkov
Copy link

dzharkov commented Jun 4, 2018

У меня нет к ней доступа. Обратитесь, пожалуйста, к Тимофею или Юрию

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants