[ 
https://issues.apache.org/jira/browse/FLINK-2490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14694932#comment-14694932
 ] 

ASF GitHub Bot commented on FLINK-2490:
---------------------------------------

Github user mxm commented on the pull request:

    https://github.com/apache/flink/pull/992#issuecomment-130588652
  
    Thanks for your changes. I think we should use `read()` instead of 
`readLine()` because we are using a custom delimiter and not necessarily "\n" 
(newline symbol). The danger of reading an entire line is that the newline 
symbol might never arrive. So it might continue to read forever. And even if it 
manages to find a newline symbol, you have to truncate your input to find the 
custom delimiter. That's not very efficient. Can you change the code back to 
using the `read()` method? I think we had a misunderstanding.
    
    For you test case: It's not considered good practice to mix production and 
test code. You're doing that by introducing the `isRetrying` flag and exposing 
it. Alternatively, you have two options:
    
    1. Create a `ServerSocket` and pass its address to the 
`SocketTextStreamFunction`. Then control the connection to this socket and 
count how often the function reconnects (e.g. use the `accept()` method).
    2. Create your test in the same package as the `SocketTextStreamFunction` 
function (package is `org.apache.flink.streaming.api.functions.source`). Then 
you can access all field variables which are protected. So make your `retries` 
variable a protected field variable of the `SocketTextStreamFunction` class.
    
    I hope that this helps you. If not, feel free to ask more questions.



> Remove unwanted boolean check in function 
> SocketTextStreamFunction.streamFromSocket
> -----------------------------------------------------------------------------------
>
>                 Key: FLINK-2490
>                 URL: https://issues.apache.org/jira/browse/FLINK-2490
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming
>    Affects Versions: 0.10
>            Reporter: Huang Wei
>            Priority: Minor
>             Fix For: 0.10
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to