You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2021/06/28 22:58:40 UTC

[geode] branch support/1.14 updated: GEODE-9380: Replace sleep()s from Nio.SslEngine replace with yields

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

nnag pushed a commit to branch support/1.14
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/support/1.14 by this push:
     new 9425c02  GEODE-9380: Replace sleep()s from Nio.SslEngine replace with yields
9425c02 is described below

commit 9425c02d911939dd781e5e842fb92410dff85f29
Author: Kamilla Aslami <ka...@vmware.com>
AuthorDate: Tue Jun 15 15:11:52 2021 -0700

    GEODE-9380: Replace sleep()s from Nio.SslEngine replace with yields
    
    (cherry picked from commit 1b97c7c25f1fb68a94d5c7008b98630de45d48b6)
---
 .../src/main/java/org/apache/geode/internal/net/NioSslEngine.java  | 7 +++----
 .../src/main/java/org/apache/geode/internal/net/SocketCreator.java | 5 -----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
index a74de55..7831444 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
@@ -89,8 +89,7 @@ public class NioSslEngine implements NioFilter {
    * state. It may throw other IOExceptions caused by I/O operations
    */
   public boolean handshake(SocketChannel socketChannel, int timeout,
-      ByteBuffer peerNetData)
-      throws IOException, InterruptedException {
+      ByteBuffer peerNetData) throws IOException {
 
     if (peerNetData.capacity() < engine.getSession().getPacketBufferSize()) {
       throw new IllegalArgumentException(String.format("Provided buffer is too small to perform "
@@ -152,7 +151,7 @@ public class NioSslEngine implements NioFilter {
             // if we're not finished, there's nothing to process and no data was read let's hang out
             // for a little
             if (peerAppData.remaining() == 0 && dataRead == 0 && status == NEED_UNWRAP) {
-              Thread.sleep(10);
+              Thread.yield();
             }
 
             if (engineResult.getStatus() == BUFFER_OVERFLOW) {
@@ -203,7 +202,7 @@ public class NioSslEngine implements NioFilter {
           logger.info("handshake terminated with illegal state due to {}", status);
           throw new IllegalStateException("Unknown SSL Handshake state: " + status);
       }
-      Thread.sleep(10);
+      Thread.yield();
     }
     if (status != FINISHED) {
       logger.info("handshake terminated with exception due to {}", status);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
index f4fa405..9cc32cb 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java
@@ -641,11 +641,6 @@ public class SocketCreator extends TcpSocketCreatorImpl {
       }
       logger.warn("SSL handshake exception", e);
       throw e;
-    } catch (InterruptedException e) {
-      if (!socketChannel.socket().isClosed()) {
-        socketChannel.close();
-      }
-      throw new IOException("SSL handshake interrupted");
     } finally {
       if (blocking) {
         try {