rpuch commented on code in PR #7964:
URL: https://github.com/apache/ignite-3/pull/7964#discussion_r3073725150


##########
modules/network/src/main/java/org/apache/ignite/internal/network/handshake/BrokenHandshakeException.java:
##########
@@ -15,31 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.jdbc.util;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
+package org.apache.ignite.internal.network.handshake;
 
 /**
- * Functional interface for extracting a value from the current row of a 
{@link ResultSet}.
- *
- * @param <T> Type of the extracted value.
+ * Exception that notifies of handshake that failed because a channel was 
closed or some internal error happened.
  */
-@FunctionalInterface
-public interface RowColumnProjection<T> {
-    /** Extracts a value from the current row of {@code rs}. */
-    T extract(ResultSet rs) throws SQLException;
-
-    /** Drains result set to list by projecting each record with provided 
extractor. */
-    static <T> List<T> projectRowsColumn(ResultSet rs, RowColumnProjection<T> 
extractor) throws SQLException {
-        List<T> result = new ArrayList<>();
-
-        while (rs.next()) {
-            result.add(extractor.extract(rs));
-        }
+public class BrokenHandshakeException extends HandshakeException {
+    private static final long serialVersionUID = 0L;
 
-        return result;
+    public BrokenHandshakeException() {

Review Comment:
   Introduction of this exception just types a `new HandshakeException(...)` 
used to signal that 'something' happened to the channel. Its stack trace is not 
used for diagnostics, and in the place in the code where it's instantiated  
(`channelInactive()` hook) we don't have access to the cause anyway. The cause 
is communicated to another method, but when it's an I/O exception, we just 
swallow it (which seems to be correct for exceptions like 
SocketException("Connection reset by peer").
   
   In any case, what I did here is just a refactoring to make it easier to 
retry connection attempt on such exceptions. If what we had is not ok, let's 
improve it separately.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to