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

av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new ec94d35  IGNITE-13208 : Simplify IgniteSpiOperationTimeoutHelper 
(#7988)
ec94d35 is described below

commit ec94d35c0fbdc8c261c647a97d6debd3eeb5e00d
Author: Vladsz83 <vlads...@gmail.com>
AuthorDate: Wed Aug 5 17:04:12 2020 +0300

    IGNITE-13208 : Simplify IgniteSpiOperationTimeoutHelper (#7988)
---
 .../spi/IgniteSpiOperationTimeoutHelper.java       | 23 +++++-----------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
index 20a5ebf..96fea9e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
@@ -30,18 +30,12 @@ import org.apache.ignite.internal.util.typedef.internal.U;
  *
  */
 public class IgniteSpiOperationTimeoutHelper {
-    // https://issues.apache.org/jira/browse/IGNITE-11221
-    // We need to reuse new logic ExponentialBackoffTimeout logic in 
TcpDiscovery instead of this class.
-
     /** Flag whether to use timeout. */
     private final boolean timeoutEnabled;
 
     /** Time in nanos which cannot be reached for current operation. */
     private final long timeoutThreshold;
 
-    /** Keeps {@code true} if last call to {@link #nextTimeoutChunk(long)} has 
timeouted. {@code False} otherwise. */
-    private boolean lastOperationTimeouted;
-
     /**
      * Constructor.
      *
@@ -104,26 +98,19 @@ public class IgniteSpiOperationTimeoutHelper {
                 left = timeoutThreshold - now;
         }
 
-        if (left <= 0) {
-            lastOperationTimeouted = true;
-
+        if (left <= 0)
             throw new IgniteSpiOperationTimeoutException("Network operation 
timed out.");
-        }
 
         return U.nanosToMillis(left);
     }
 
     /**
-     * Checks whether the given {@link Exception} is a timeout-exception or 
the has been reached in last call to
-     * {@code nextTimeoutChunk(long)}.
+     * Checks whether the given {@link Exception} is a timeout.
      *
-     * @param e Exception to check if is a timeout.
-     * @return {@code True} if the excaption is a timeout or failure timeout 
was reached. {@code False} otherwise.
+     * @param e Exception to check.
+     * @return {@code True} if given exception is a timeout. {@code False} 
otherwise.
      */
     public boolean checkFailureTimeoutReached(Exception e) {
-        if (X.hasCause(e, IgniteSpiOperationTimeoutException.class, 
SocketTimeoutException.class, SocketException.class))
-            return true;
-
-        return lastOperationTimeouted;
+        return X.hasCause(e, IgniteSpiOperationTimeoutException.class, 
SocketTimeoutException.class, SocketException.class);
     }
 }

Reply via email to