[jira] [Commented] (KAFKA-6716) discardChannel should be released in MockSelector#completeSend

2018-03-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16417372#comment-16417372
 ] 

ASF GitHub Bot commented on KAFKA-6716:
---

rajinisivaram closed pull request #4783: KAFKA-6716: Should close the 
`discardChannel` in completeSend
URL: https://github.com/apache/kafka/pull/4783
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/clients/src/test/java/org/apache/kafka/test/MockSelector.java 
b/clients/src/test/java/org/apache/kafka/test/MockSelector.java
index bd27d5c6d99..200d5111517 100644
--- a/clients/src/test/java/org/apache/kafka/test/MockSelector.java
+++ b/clients/src/test/java/org/apache/kafka/test/MockSelector.java
@@ -124,11 +124,12 @@ private void completeInitiatedSends() throws IOException {
 
 private void completeSend(Send send) throws IOException {
 // Consume the send so that we will be able to send more requests to 
the destination
-ByteBufferChannel discardChannel = new ByteBufferChannel(send.size());
-while (!send.completed()) {
-send.writeTo(discardChannel);
+try (ByteBufferChannel discardChannel = new 
ByteBufferChannel(send.size())) {
+while (!send.completed()) {
+send.writeTo(discardChannel);
+}
+completedSends.add(send);
 }
-completedSends.add(send);
 }
 
 private void completeDelayedReceives() {


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> discardChannel should be released in MockSelector#completeSend
> --
>
> Key: KAFKA-6716
> URL: https://issues.apache.org/jira/browse/KAFKA-6716
> Project: Kafka
>  Issue Type: Test
>Reporter: Ted Yu
>Assignee: huxihx
>Priority: Minor
>
> {code}
> private void completeSend(Send send) throws IOException {
> // Consume the send so that we will be able to send more requests to 
> the destination
> ByteBufferChannel discardChannel = new ByteBufferChannel(send.size());
> while (!send.completed()) {
> send.writeTo(discardChannel);
> }
> completedSends.add(send);
> }
> {code}
> The {{discardChannel}} should be closed before returning from the method



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KAFKA-6716) discardChannel should be released in MockSelector#completeSend

2018-03-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KAFKA-6716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16416428#comment-16416428
 ] 

ASF GitHub Bot commented on KAFKA-6716:
---

huxihx opened a new pull request #4783: KAFKA-6716: Should close the 
`discardChannel` in completeSend
URL: https://github.com/apache/kafka/pull/4783
 
 
   KAFKA-6716: Should close the `discardChannel` in completeSend
   https://issues.apache.org/jira/browse/KAFKA-6716
   
   Should close the `discardChannel` in MockSelector#completeSend
   
   *More detailed description of your change,
   if necessary. The PR title and PR message become
   the squashed commit message, so use a separate
   comment to ping reviewers.*
   
   *Summary of testing strategy (including rationale)
   for the feature or bug fix. Unit and/or integration
   tests are expected for any behaviour change and
   system tests should be considered for larger changes.*
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> discardChannel should be released in MockSelector#completeSend
> --
>
> Key: KAFKA-6716
> URL: https://issues.apache.org/jira/browse/KAFKA-6716
> Project: Kafka
>  Issue Type: Test
>Reporter: Ted Yu
>Priority: Minor
>
> {code}
> private void completeSend(Send send) throws IOException {
> // Consume the send so that we will be able to send more requests to 
> the destination
> ByteBufferChannel discardChannel = new ByteBufferChannel(send.size());
> while (!send.completed()) {
> send.writeTo(discardChannel);
> }
> completedSends.add(send);
> }
> {code}
> The {{discardChannel}} should be closed before returning from the method



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)