You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2025/09/14 10:58:28 UTC
[PR] don't use pekko.util.JavaDurationConverters [pekko-http]
pjfanning opened a new pull request, #776:
URL: https://github.com/apache/pekko-http/pull/776
now that we don't support Scala 2.12, we can use Scala calls directly
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] don't use pekko.util.JavaDurationConverters [pekko-http]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #776:
URL: https://github.com/apache/pekko-http/pull/776#discussion_r2347278777
##########
http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ConnectionPoolSettings.scala:
##########
@@ -37,7 +36,7 @@ abstract class ConnectionPoolSettings private[pekko] () { self: ConnectionPoolSe
def getMaxRetries: Int = maxRetries
def getMaxOpenRequests: Int = maxOpenRequests
def getPipeliningLimit: Int = pipeliningLimit
- def getMaxConnectionLifetime: JDuration = maxConnectionLifetime.asJava
+ def getMaxConnectionLifetime: JDuration = JDuration.ofNanos(maxConnectionLifetime.toNanos)
Review Comment:
Basically we have a bug in pekko.util.JavaDurationConverters.
It allows you to compile:
```
import pekko.util.JavaDurationConverters._
scala.concurrent.duration.Duration.Inf.asJava
```
But this will fail at runtime because pekko.util.JavaDurationConverters calls toNanos on the scala duration and this fails with
```
java.lang.IllegalArgumentException: toNanos not allowed on infinite Durations
at scala.concurrent.duration.Duration$Infinite.fail(Duration.scala:219)
```
I'm going to park this PR for a while - and concentrate on fixing the bug.
I think pekko.util.JavaDurationConverters should return the max possible Java Duration because Java Duration does not support infinite.
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] don't use pekko.util.JavaDurationConverters [pekko-http]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #776:
URL: https://github.com/apache/pekko-http/pull/776#discussion_r2347268480
##########
http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ConnectionPoolSettings.scala:
##########
@@ -37,7 +36,7 @@ abstract class ConnectionPoolSettings private[pekko] () { self: ConnectionPoolSe
def getMaxRetries: Int = maxRetries
def getMaxOpenRequests: Int = maxOpenRequests
def getPipeliningLimit: Int = pipeliningLimit
- def getMaxConnectionLifetime: JDuration = maxConnectionLifetime.asJava
+ def getMaxConnectionLifetime: JDuration = JDuration.ofNanos(maxConnectionLifetime.toNanos)
Review Comment:
scala.jdk.DurationConverters only works with FiniteDuration - maxConnectionLifetime is not FiniteDuration
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] don't use pekko.util.JavaDurationConverters [pekko-http]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #776:
URL: https://github.com/apache/pekko-http/pull/776#discussion_r2347267799
##########
http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ConnectionPoolSettings.scala:
##########
@@ -37,7 +36,7 @@ abstract class ConnectionPoolSettings private[pekko] () { self: ConnectionPoolSe
def getMaxRetries: Int = maxRetries
def getMaxOpenRequests: Int = maxOpenRequests
def getPipeliningLimit: Int = pipeliningLimit
- def getMaxConnectionLifetime: JDuration = maxConnectionLifetime.asJava
+ def getMaxConnectionLifetime: JDuration = JDuration.ofNanos(maxConnectionLifetime.toNanos)
Review Comment:
can be toJava
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] don't use pekko.util.JavaDurationConverters [pekko-http]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #776:
URL: https://github.com/apache/pekko-http/pull/776#discussion_r2347275007
##########
http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ConnectionPoolSettings.scala:
##########
@@ -37,7 +36,7 @@ abstract class ConnectionPoolSettings private[pekko] () { self: ConnectionPoolSe
def getMaxRetries: Int = maxRetries
def getMaxOpenRequests: Int = maxOpenRequests
def getPipeliningLimit: Int = pipeliningLimit
- def getMaxConnectionLifetime: JDuration = maxConnectionLifetime.asJava
+ def getMaxConnectionLifetime: JDuration = JDuration.ofNanos(maxConnectionLifetime.toNanos)
Review Comment:
if maxConnectionLifetime.isFinate maxConnectionLifetime.toJava else JDuration.Zero
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] don't use pekko.util.JavaDurationConverters [pekko-http]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #776:
URL: https://github.com/apache/pekko-http/pull/776
--
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@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org