-
Notifications
You must be signed in to change notification settings - Fork 47
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
Плясов Климентий, ИТМО DWS, stage 5 #196
Conversation
# Conflicts: # src/main/java/ru/vk/itmo/test/klimplyasov/PlyasovServer.java # src/main/java/ru/vk/itmo/test/klimplyasov/PlyasovService.java # src/main/java/ru/vk/itmo/test/klimplyasov/Server.java
src/main/java/ru/vk/itmo/test/klimplyasov/MergeHandleResult.java
Outdated
Show resolved
Hide resolved
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.
The PR diff size of 18173 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 18234 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 18258 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 18315 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 19809 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 15898 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 15918 lines exceeds the maximum allowed for the inline comments feature.
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.
The PR diff size of 15917 lines exceeds the maximum allowed for the inline comments feature.
import java.lang.foreign.ValueLayout; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public final class ChunkGenerator { |
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.
ага, тут сразу в перемешку с 6ым стейджом, хорошо бы конечно разделить эти два PR
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.
Извините, случайно закоммитил в старый ПР
HandleResult mergedResult = new HandleResult(HttpURLConnection.HTTP_GATEWAY_TIMEOUT, null); | ||
int localValidCount = 0; | ||
for (HandleResult handleResult : handleResults) { | ||
if (handleResult.status() == HttpURLConnection.HTTP_OK |
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.
а тут NPE потенциальный, массив может заполняться не по порядку
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.
Понял, исправлю
private void handleRemoteRequest(Request request, HttpSession session, String id) { | ||
executorLocal.execute(() -> { | ||
try { | ||
HandleResult local = local(request, id); |
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.
ох мозг взрывается, вроде метод handleRemoteRequest, а внутри local()
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.
Видимо накосячил с названиями
} | ||
} | ||
|
||
private void handleRejectedExecutionException(RejectedExecutionException executionException, HttpSession session) { | ||
private CompletableFuture<HandleResult> handleRemoteAsync(final Request request, final String executorNode) { | ||
return CompletableFuture.supplyAsync(() -> { |
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.
тут мы выполняем все в commonPool. Что плохо, лучше задать свой executor
|
||
public class MergeHandleResult { | ||
private static final Logger log = LoggerFactory.getLogger(MergeHandleResult.class); | ||
private final HandleResult[] handleResults; |
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.
здесь могут быть проблемы в многопоточной среде, чтение/запись в массив идет из разных потоков. В таком случае просто final ссылка не поможет. Нужны какие-то примитивы синхронизации.
Подойдет как какая-нибудь потокобезопасная коллекция, так и AtomicReferenceArray
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.
The PR diff size of 15917 lines exceeds the maximum allowed for the inline comments feature.
No description provided.