Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-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 2E495FB18 for ; Thu, 21 Mar 2013 04:48:14 +0000 (UTC) Received: (qmail 7604 invoked by uid 500); 21 Mar 2013 04:48:14 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 7574 invoked by uid 500); 21 Mar 2013 04:48:13 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 7563 invoked by uid 99); 21 Mar 2013 04:48:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 04:48:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 04:48:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 834D723888E4; Thu, 21 Mar 2013 04:47:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1459152 - /logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java Date: Thu, 21 Mar 2013 04:47:52 -0000 To: commits@logging.apache.org From: rgoers@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130321044752.834D723888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rgoers Date: Thu Mar 21 04:47:52 2013 New Revision: 1459152 URL: http://svn.apache.org/r1459152 Log: Test fails periodically Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java?rev=1459152&r1=1459151&r2=1459152&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java (original) +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java Thu Mar 21 04:47:52 2013 @@ -33,6 +33,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -71,6 +72,21 @@ public class SocketReconnectTest { assertEquals(message, reader.readLine()); closeQuietly(testServer); + executor.shutdown(); + try { + // Wait a while for existing tasks to terminate + if (!executor.awaitTermination(100, TimeUnit.MILLISECONDS)) { + executor.shutdownNow(); + if (!executor.awaitTermination(100, TimeUnit.MILLISECONDS)) { + System.err.println("Pool did not terminate"); + } + } + } catch (InterruptedException ie) { + // (Re-)Cancel if current thread also interrupted + executor.shutdownNow(); + // Preserve interrupt status + Thread.currentThread().interrupt(); + } message = "Log #2"; logger.error(message); @@ -83,6 +99,7 @@ public class SocketReconnectTest { } //System.err.println("Re-initializing server"); + executor = Executors.newSingleThreadExecutor(); testServer = new TestSocketServer(); futureIn = executor.submit(testServer); Thread.sleep(500);