Github user HuangWHWHW commented on the pull request:
https://github.com/apache/flink/pull/992#issuecomment-130206658
@mxm
@StephanEwen
Hi, I do a test for this today and I got another problem.
The SocketTextStreamFunction use BufferedReader.read() to get the buffer
which is sent by socket server.
And whether this function BufferedReader.read() will never return -1 as the
end of the sent message?
If it was there should be another bug that code following will never be
reachable:
if (data == -1) {
socket.close();
long retry = 0;
boolean success = false;
while ((retry < maxRetry ||
retryForever) && !success) {
if (!retryForever) {
retry++;
}
LOG.warn("Lost connection to
server socket. Retrying in "
+
(CONNECTION_RETRY_SLEEP / 1000) + " seconds...");
try {
socket = new Socket();
socket.connect(new
InetSocketAddress(hostname, port),
CONNECTION_TIMEOUT_TIME);
success = true;
} catch (ConnectException ce) {
Thread.sleep(CONNECTION_RETRY_SLEEP);
socket.close();
}
}
if (success) {
LOG.info("Server socket is
reconnected.");
} else {
LOG.error("Could not reconnect
to server socket.");
break;
}
reader = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
continue;
}
---
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.
---