Return-Path: X-Original-To: apmail-flink-commits-archive@minotaur.apache.org Delivered-To: apmail-flink-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17F14104C4 for ; Sat, 6 Jun 2015 11:58:19 +0000 (UTC) Received: (qmail 49914 invoked by uid 500); 6 Jun 2015 11:58:18 -0000 Delivered-To: apmail-flink-commits-archive@flink.apache.org Received: (qmail 49861 invoked by uid 500); 6 Jun 2015 11:58:18 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 49841 invoked by uid 99); 6 Jun 2015 11:58:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jun 2015 11:58:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ABAFDE01CA; Sat, 6 Jun 2015 11:58:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mbalassi@apache.org To: commits@flink.apache.org Date: Sat, 06 Jun 2015 11:58:21 -0000 Message-Id: <63764cbced564703950dd9554ba3e268@git.apache.org> In-Reply-To: <275e5a38bb5c40ca8485d9bdb8daadab@git.apache.org> References: <275e5a38bb5c40ca8485d9bdb8daadab@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/6] flink git commit: [streaming] Socket Client Sink propagates exceptions [streaming] Socket Client Sink propagates exceptions Closes #789 Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/e3402c0c Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/e3402c0c Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/e3402c0c Branch: refs/heads/master Commit: e3402c0caccd6cc3bb85529909e23d85946efc17 Parents: f72e5c8 Author: mbalassi Authored: Thu Jun 4 15:22:13 2015 +0200 Committer: mbalassi Committed: Sat Jun 6 13:56:54 2015 +0200 ---------------------------------------------------------------------- .../api/functions/sink/SocketClientSink.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/e3402c0c/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java ---------------------------------------------------------------------- diff --git a/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java b/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java index 3fd2678..da8fd7f 100644 --- a/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java +++ b/flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java @@ -24,8 +24,6 @@ import java.net.Socket; import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.util.serialization.SerializationSchema; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Socket client that acts as a streaming sink. The data is sent to a Socket as a byte array. @@ -35,8 +33,6 @@ import org.slf4j.LoggerFactory; public class SocketClientSink extends RichSinkFunction { private static final long serialVersionUID = 1L; - private static final Logger LOG = LoggerFactory.getLogger(SocketClientSink.class); - private final String hostName; private final int port; private final SerializationSchema schema; @@ -65,7 +61,7 @@ public class SocketClientSink extends RichSinkFunction { client = new Socket(hostName, port); outputStream = client.getOutputStream(); } catch (IOException e) { - throw new RuntimeException(e); + throw new RuntimeException("Cannot initialize connection to socket server at " + hostName + ":" + port, e); } dataOutputStream = new DataOutputStream(outputStream); } @@ -82,11 +78,8 @@ public class SocketClientSink extends RichSinkFunction { try { dataOutputStream.write(msg); } catch (IOException e) { - if(LOG.isErrorEnabled()){ - LOG.error("Cannot send message to socket server at " + hostName + ":" + port, e); - } - throw new RuntimeException("Cannot send message \"" + value.toString() + - "\" to socket server at " + hostName + ":" + port, e); + throw new RuntimeException("Cannot send message " + value.toString() + + " to socket server at " + hostName + ":" + port, e); } } @@ -105,7 +98,7 @@ public class SocketClientSink extends RichSinkFunction { try { client.close(); } catch (IOException e) { - LOG.error("Cannot close connection with socket server at " + throw new RuntimeException("Cannot close connection with socket server at " + hostName + ":" + port, e); } }