Skip to content

Conversation

@VolkodamovDaniil
Copy link
Contributor

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

/**
* @return Connection timeout in milliseconds. 0 means infinite.
*/
public int getConnTimeout() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use abbreviations for method names

@Deprecated
public int getTimeout() {
return timeout;
return Math.max(connTimeout, reqTimeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's return req timeout here

ClientConfiguration target = new ClientConfiguration()
.setAddresses("127.0.0.1:10800", "127.0.0.1:10801")
.setTimeout(123)
.setConnectionTimeout(123)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test with different timeouts for connection and requests

/** @serial Connection timeout in milliseconds. 0 means infinite. */
private int connTimeout;

/** @serial Request timeout in milliseconds. 0 means infinite. */
Copy link
Member

@timoninmaxim timoninmaxim Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that actual javadocs contains lines started with 'serial'. For which purpose this tag is used?


/**
* @deprecated Use {@link #getConnectionTimeout()} and {@link #getRequestTimeout()} instead.
* @return Timeout.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request timeout

.setConnectionTimeout(500)
.setRequestTimeout(10000);

GridTestUtils.assertThrowsWithCause(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check that a timeout exception is mentioned in this exception message


long elapsed = System.currentTimeMillis() - startTime;

assertTrue("Should fail around connection timeout (500ms), not request timeout",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks are not stable and must be avoided:

  1. System.currentTimeMillis() returns the wall-clock time, which is non-monotonic and susceptible to adjustments, such as NTP synchronization or manual system clock updates
  2. Thread might be blocked more than 2s.

Just set request timeout to Integer.MAX_VALUE. Also server handshake time must be overridden - see getConfiguration in this class.

*/
@Test
@SuppressWarnings("ThrowableNotThrown")
public void testRequestTimeoutIndependentOfConnection() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar for this test:

  1. Set server and connection timeous to Integer.MAX_VALUE
  2. Just check that exception contains timeout exception (X.hasCause(IgniteFutureTimeoutCheckedException.class))

@Deprecated
public int getTimeout() {
return timeout;
return reqTimeout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add WARN log if reqTimeout != connTimeout. The warn message should mention that deprecated API is used and request timeout is returned.


/**
* @deprecated Use {@link #getConnectionTimeout()} and {@link #getRequestTimeout()} instead.
* @return Send/receive timeout in milliseconds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants