-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Do not block by default #8580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not block by default #8580
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2002-2022 the original author or authors. | ||
* Copyright 2002-2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -782,14 +782,9 @@ private Expression extractRequestTimeoutFromAnnotationOrMetadata(@Nullable Gatew | |
Expression requestTimeout = this.defaultRequestTimeout; | ||
|
||
if (gatewayAnnotation != null) { | ||
/* | ||
* INT-2636 Unspecified annotation attributes should not | ||
* override the default values supplied by explicit configuration. | ||
* There is a small risk that someone has used Long.MIN_VALUE explicitly | ||
* to indicate an indefinite timeout on a gateway method and that will | ||
* no longer work as expected; they will need to use, say, -1 instead. | ||
*/ | ||
if (requestTimeout == null || gatewayAnnotation.requestTimeout() != Long.MIN_VALUE) { | ||
if (requestTimeout == null || | ||
gatewayAnnotation.requestTimeout() != IntegrationContextUtils.DEFAULT_TIMEOUT) { | ||
|
||
requestTimeout = new ValueExpression<>(gatewayAnnotation.requestTimeout()); | ||
} | ||
if (StringUtils.hasText(gatewayAnnotation.requestTimeoutExpression())) { | ||
|
@@ -813,14 +808,7 @@ private Expression extractReplyTimeoutFromAnnotationOrMetadata(@Nullable Gateway | |
Expression replyTimeout = this.defaultReplyTimeout; | ||
|
||
if (gatewayAnnotation != null) { | ||
/* | ||
* INT-2636 Unspecified annotation attributes should not | ||
* override the default values supplied by explicit configuration. | ||
* There is a small risk that someone has used Long.MIN_VALUE explicitly | ||
* to indicate an indefinite timeout on a gateway method and that will | ||
* no longer work as expected; they will need to use, say, -1 instead. | ||
*/ | ||
if (replyTimeout == null || gatewayAnnotation.replyTimeout() != Long.MIN_VALUE) { | ||
if (replyTimeout == null || gatewayAnnotation.replyTimeout() != IntegrationContextUtils.DEFAULT_TIMEOUT) { | ||
replyTimeout = new ValueExpression<>(gatewayAnnotation.replyTimeout()); | ||
} | ||
if (StringUtils.hasText(gatewayAnnotation.replyTimeoutExpression())) { | ||
|
@@ -968,31 +956,27 @@ private void channels(@Nullable String requestChannelName, @Nullable String repl | |
|
||
private void timeouts(@Nullable Expression requestTimeout, @Nullable Expression replyTimeout, | ||
GatewayMethodInboundMessageMapper messageMapper, MethodInvocationGateway gateway) { | ||
if (requestTimeout == null) { | ||
gateway.setRequestTimeout(-1); | ||
} | ||
else if (requestTimeout instanceof ValueExpression) { | ||
Long timeout = requestTimeout.getValue(Long.class); | ||
if (timeout != null) { | ||
gateway.setRequestTimeout(timeout); | ||
if (requestTimeout != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still need a null check here and use the default; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! See
So, if we don't call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah - ok. |
||
if (requestTimeout instanceof ValueExpression) { | ||
Long timeout = requestTimeout.getValue(Long.class); | ||
if (timeout != null) { | ||
gateway.setRequestTimeout(timeout); | ||
} | ||
} | ||
} | ||
else { | ||
messageMapper.setSendTimeoutExpression(requestTimeout); | ||
} | ||
if (replyTimeout == null) { | ||
gateway.setReplyTimeout(-1); | ||
} | ||
else if (replyTimeout instanceof ValueExpression) { | ||
Long timeout = replyTimeout.getValue(Long.class); | ||
if (timeout != null) { | ||
gateway.setReplyTimeout(timeout); | ||
else { | ||
messageMapper.setSendTimeoutExpression(requestTimeout); | ||
} | ||
} | ||
else { | ||
messageMapper.setReplyTimeoutExpression(replyTimeout); | ||
} | ||
if (replyTimeout != null) { | ||
if (replyTimeout instanceof ValueExpression) { | ||
Long timeout = replyTimeout.getValue(Long.class); | ||
if (timeout != null) { | ||
gateway.setReplyTimeout(timeout); | ||
} | ||
} | ||
else { | ||
messageMapper.setReplyTimeoutExpression(replyTimeout); | ||
} | ||
gateway.setReceiveTimeoutExpression(replyTimeout); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in
timeouts()
.