You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/03/03 14:10:27 UTC
[GitHub] [ignite] isapego commented on a change in pull request #9863: IGNITE-16530 Java thin: add heartbeats
isapego commented on a change in pull request #9863:
URL: https://github.com/apache/ignite/pull/9863#discussion_r818685051
##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java
##########
@@ -678,4 +684,68 @@ public ClientConfiguration setAsyncContinuationExecutor(Executor asyncContinuati
return this;
}
+
+ /**
+ * Gets a value indicating whether heartbeats are enabled.
+ * <p />
+ * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically
+ * to keep the connection alive and detect potential half-open state.
+ * <p />
+ * See also {@link ClientConfiguration#heartbeatInterval}.
+ *
+ * @return Whether heartbeats are enabled.
+ */
+ public boolean getHeartbeatsEnabled() {
Review comment:
```suggestion
public boolean isHeartbeatEnabled() {
```
##########
File path: modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java
##########
@@ -678,4 +684,68 @@ public ClientConfiguration setAsyncContinuationExecutor(Executor asyncContinuati
return this;
}
+
+ /**
+ * Gets a value indicating whether heartbeats are enabled.
+ * <p />
+ * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically
+ * to keep the connection alive and detect potential half-open state.
+ * <p />
+ * See also {@link ClientConfiguration#heartbeatInterval}.
+ *
+ * @return Whether heartbeats are enabled.
+ */
+ public boolean getHeartbeatsEnabled() {
+ return heartbeatsEnabled;
+ }
+
+ /**
+ * Sets a value indicating whether heartbeats are enabled.
+ * <p />
+ * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically
+ * to keep the connection alive and detect potential half-open state.
+ * <p />
+ * See also {@link ClientConfiguration#heartbeatInterval}.
+ *
+ * @param heartbeatsEnabled Whether to enable heartbeats.
+ * @return {@code this} for chaining.
+ */
+ public ClientConfiguration setHeartbeatsEnabled(boolean heartbeatsEnabled) {
Review comment:
```suggestion
public ClientConfiguration setHeartbeatEnabled(boolean heartbeatEnabled) {
```
##########
File path: modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java
##########
@@ -705,9 +724,65 @@ private ClientException handleIOError(String chInfo, @Nullable IOException ex) {
return new ClientConnectionException("Ignite cluster is unavailable [" + chInfo + ']', ex);
}
+ /**
+ * Initializes heartbeats.
+ *
+ * @param configuredInterval Configured heartbeat interval, in milliseconds.
+ * @return Heartbeat timer.
+ */
+ private Timer initHeartbeats(long configuredInterval) {
+ long heartbeatInterval = getHeartbeatInterval(configuredInterval);
Review comment:
Should not we log a warning if `heartbeatInterval != configuredInterval`?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org