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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to