This is an automated email from the ASF dual-hosted git repository.

sai_boorlagadda pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 3f2654c  GEODE-5212: increase timeouts in SockerCloserIntegrationTest 
(#2564)
3f2654c is described below

commit 3f2654cc031b2f812b394fda9e806b4b9f1e167b
Author: Sai Boorlagadda <[email protected]>
AuthorDate: Mon Oct 8 10:50:27 2018 -0700

    GEODE-5212: increase timeouts in SockerCloserIntegrationTest (#2564)
    
     * Moved SocketCloser tests to integration tests
     * Renamed SocketCloserJUnitTest to SockerCloserIntegrationTest
     * Renamed SocketCloserWithWaitJUnitTest to 
SocketCloserWithWaitIntegrationTest
     * Removed an unused private deprecated method from SocketCloser
---
 .../geode/internal/net/SocketCloserIntegrationTest.java}    | 13 +++++++------
 .../internal/net/SocketCloserWithWaitIntegrationTest.java}  |  4 ++--
 .../java/org/apache/geode/internal/net/SocketCloser.java    |  8 +-------
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserJUnitTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserIntegrationTest.java
similarity index 92%
rename from 
geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserJUnitTest.java
rename to 
geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserIntegrationTest.java
index 5c0398c..0688555 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserJUnitTest.java
+++ 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserIntegrationTest.java
@@ -34,8 +34,8 @@ import org.apache.geode.test.junit.categories.MembershipTest;
 /**
  * Tests the default SocketCloser.
  */
-@Category({MembershipTest.class})
-public class SocketCloserJUnitTest {
+@Category(MembershipTest.class)
+public class SocketCloserIntegrationTest {
 
   private SocketCloser socketCloser;
 
@@ -80,8 +80,9 @@ public class SocketCloserJUnitTest {
         this.socketCloser.asyncClose(aSockets[j], address, () -> {
           try {
             waitingToClose.incrementAndGet();
-            countDownLatch.await();
+            countDownLatch.await(5, TimeUnit.MINUTES);
           } catch (InterruptedException e) {
+            throw new RuntimeException(e);
           }
         });
       }
@@ -93,7 +94,7 @@ public class SocketCloserJUnitTest {
     countDownLatch.countDown();
     // now all the sockets should get closed; use a wait criteria
     // since a thread pool is doing to closes
-    Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+    Awaitility.await().atMost(5, TimeUnit.MINUTES).until(() -> {
       boolean areAllClosed = true;
       for (Iterator<Socket> iterator = trackedSockets.iterator(); 
iterator.hasNext();) {
         Socket socket = iterator.next();
@@ -117,7 +118,7 @@ public class SocketCloserJUnitTest {
     Socket s = createClosableSocket();
     s.close();
     this.socketCloser.asyncClose(s, "A", () -> runnableCalled.set(true));
-    Awaitility.await().atMost(1, TimeUnit.SECONDS).until(() -> 
!runnableCalled.get());
+    Awaitility.await().atMost(5, TimeUnit.MINUTES).until(() -> 
!runnableCalled.get());
   }
 
   /**
@@ -130,7 +131,7 @@ public class SocketCloserJUnitTest {
     final Socket closableSocket = createClosableSocket();
     this.socketCloser.close();
     this.socketCloser.asyncClose(closableSocket, "A", () -> 
runnableCalled.set(true));
-    Awaitility.await().atMost(5, TimeUnit.SECONDS)
+    Awaitility.await().atMost(5, TimeUnit.MINUTES)
         .until(() -> runnableCalled.get() && closableSocket.isClosed());
   }
 }
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserWithWaitJUnitTest.java
 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserWithWaitIntegrationTest.java
similarity index 91%
rename from 
geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserWithWaitJUnitTest.java
rename to 
geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserWithWaitIntegrationTest.java
index 7776003..0802248 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/net/SocketCloserWithWaitJUnitTest.java
+++ 
b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SocketCloserWithWaitIntegrationTest.java
@@ -24,8 +24,8 @@ import org.apache.geode.test.junit.categories.MembershipTest;
  * Tests SocketCloser with a wait time. The default SocketCloser does not 
wait. This test configures
  * a closer much like the one used by CacheClientNotifier.
  */
-@Category({MembershipTest.class})
-public class SocketCloserWithWaitJUnitTest extends SocketCloserJUnitTest {
+@Category(MembershipTest.class)
+public class SocketCloserWithWaitIntegrationTest extends 
SocketCloserIntegrationTest {
 
   @Override
   protected SocketCloser createSocketCloser() {
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java 
b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java
index 2aeca71..c4cbde9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java
@@ -23,10 +23,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import org.apache.logging.log4j.Logger;
-
 import org.apache.geode.SystemFailure;
-import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.LoggingExecutors;
 
 /**
@@ -42,7 +39,7 @@ import org.apache.geode.internal.logging.LoggingExecutors;
  * This max threads can be configured using the 
"p2p.ASYNC_CLOSE_POOL_MAX_THREADS" system property.
  */
 public class SocketCloser {
-  private static final Logger logger = LogService.getLogger();
+
   /**
    * Number of seconds to wait before timing out an unused async close thread. 
Default is 120 (2
    * minutes).
@@ -62,7 +59,6 @@ public class SocketCloser {
   static final long ASYNC_CLOSE_WAIT_MILLISECONDS =
       Long.getLong("p2p.ASYNC_CLOSE_WAIT_MILLISECONDS", 0).longValue();
 
-
   /**
    * map of thread pools of async close threads
    */
@@ -124,7 +120,6 @@ public class SocketCloser {
    * longer needed. Currently a thread pool is kept for each address and if 
you know that an address
    * no longer needs its pool then you should call this method.
    */
-
   public void releaseResourcesForAddress(String address) {
     ExecutorService executorService = asyncCloseExecutors.remove(address);
     if (executorService != null) {
@@ -225,7 +220,6 @@ public class SocketCloser {
    *
    * @param sock the socket to close
    */
-
   private static void inlineClose(final Socket sock) {
     // the next two statements are a mad attempt to fix bug
     // 36041 - segv in jrockit in pthread signaling code. This

Reply via email to