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

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

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1077#discussion_r39749738
  
    --- Diff: 
flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunction.java
 ---
    @@ -70,14 +74,15 @@ public void run(SourceContext<String> ctx) throws 
Exception {
     
        private void streamFromSocket(SourceContext<String> ctx, Socket socket) 
throws Exception {
                try {
    -                   StringBuilder buffer = new StringBuilder();
    +                   StringBuffer buffer = new StringBuffer();
    +                   char[] charBuffer = new char[Math.max(8192, 2 * 
delimiter.length())];
                        BufferedReader reader = new BufferedReader(new 
InputStreamReader(
                                        socket.getInputStream()));
     
                        while (isRunning) {
    -                           int data;
    +                           int readCount;
                                try {
    -                                   data = reader.read();
    +                                   readCount = reader.read(charBuffer);
    --- End diff --
    
    Good change. It's much better to read a buffer instead of individual 
characters.


> String delimiter for SocketTextStream
> -------------------------------------
>
>                 Key: FLINK-2125
>                 URL: https://issues.apache.org/jira/browse/FLINK-2125
>             Project: Flink
>          Issue Type: Improvement
>          Components: Streaming
>    Affects Versions: 0.9
>            Reporter: Márton Balassi
>            Priority: Minor
>              Labels: starter
>
> The SocketTextStreamFunction uses a character delimiter, despite other parts 
> of the API using String delimiter.



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

Reply via email to