Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D296B18621 for ; Fri, 21 Aug 2015 09:12:45 +0000 (UTC) Received: (qmail 95959 invoked by uid 500); 21 Aug 2015 09:12:45 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 95909 invoked by uid 500); 21 Aug 2015 09:12:45 -0000 Mailing-List: contact issues-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 issues@flink.apache.org Received: (qmail 95899 invoked by uid 99); 21 Aug 2015 09:12:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Aug 2015 09:12:45 +0000 Date: Fri, 21 Aug 2015 09:12:45 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-2536) Add a retry for SocketClientSink MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-2536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14706436#comment-14706436 ] ASF GitHub Bot commented on FLINK-2536: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/1030#discussion_r37618025 --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java --- @@ -125,4 +121,102 @@ public void testSocketSink() throws Exception{ assertEquals("Connected", this.access); assertEquals("testSocketSinkInvoke", value); } + + public Thread t; + + @Test + public void testSocketSinkNoRetry() throws Exception{ + ServerSocket server = new ServerSocket(0); + port = server.getLocalPort(); + + new Thread(new Runnable() { + + @Override + public void run() { + t = Thread.currentThread(); + SerializationSchema simpleSchema = new SerializationSchema() { + @Override + public byte[] serialize(String element) { + return element.getBytes(); + } + }; + + try { + SocketClientSink simpleSink = new SocketClientSink(host, port, simpleSchema, 0); + simpleSink.open(new Configuration()); + Thread.sleep(10000); --- End diff -- To be honest, I'm not a big fan of `sleep` based synchronization. Too often these kind of tests have failed on Travis. Usually if you use sleeps, the interval is either to short to allow different interleavings if you have bad luck or they are too long which makes the test slow. Therefore, I'd propose a simple wait object on which you wait from within the thread. Once you've closed the server socket, you can trigger the `notifyAll` method on this wait object to let the thread continue. > Add a retry for SocketClientSink > -------------------------------- > > Key: FLINK-2536 > URL: https://issues.apache.org/jira/browse/FLINK-2536 > Project: Flink > Issue Type: Improvement > Components: Streaming > Affects Versions: 0.10 > Reporter: Huang Wei > Fix For: 0.10 > > Original Estimate: 168h > Remaining Estimate: 168h > > I found the SocketClientSink doesn`t use a re-connect when disconnect from the socket server or get exception. > I`d like to add a re-connect like socket source for socket sink. -- This message was sent by Atlassian JIRA (v6.3.4#6332)