TeslaCN commented on a change in pull request #1408:
URL:
https://github.com/apache/shardingsphere-elasticjob/pull/1408#discussion_r476238346
##########
File path:
elasticjob-infra/elasticjob-restful/src/test/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HttpClient.java
##########
@@ -66,8 +65,11 @@ protected void initChannel(final Channel ch) throws
Exception {
.addLast(new
SimpleChannelInboundHandler<FullHttpResponse>() {
@Override
protected void channelRead0(final
ChannelHandlerContext ctx, final FullHttpResponse httpResponse) throws
Exception {
- consumer.accept(httpResponse);
- countDownLatch.countDown();
+ try {
+ consumer.accept(httpResponse);
+ } finally {
+ countDownLatch.countDown();
Review comment:
> Why need CountDownLatch? Maybe I have to clone the branch for deeply
reviewing .
The HTTP client for unit test is implemented via Netty, which handle http
response asynchronously. So I use CountDownLatch to wait for http response
consumer finish.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]