Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Conversation

@fennec-fox
Copy link

@fennec-fox fennec-fox commented Mar 11, 2024

Change implementation (it.ozimov:embedded-redis > org.signal:embedded-redis)

Add Class SocketUtils.kt

  • SocketUtils was removed starting from Spring 6.
  • This is because deletion was already announced in the past. Link
  • To minimize changes to the current library, only the code that copies and uses SocketUtils was added.

Assert.isTrue(maxPort <= PORT_RANGE_MAX, "'maxPort' must be less than or equal to $PORT_RANGE_MAX")

val portRange = maxPort - minPort
var candidatePort: Int
Copy link
Owner

Choose a reason for hiding this comment

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

I need to review this more closely, but is it possible for multiple threads to enter the do-while loop?

Copy link
Author

Choose a reason for hiding this comment

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

This code is a conversion of the existing
org/springframework/util/SocketUtils.java code to Kotlin.
I have not been able to check whether it is thread safe in multithreading.

Copy link
Author

Choose a reason for hiding this comment

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

@asarkar Could you please check the PR again?

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks, but I would like to see some tests for SocketUtils. If Spring has some, feel free to use those, but otherwise, we need new tests.

Copy link
Author

Choose a reason for hiding this comment

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

@asarkar The current PR was created because SocketUtils in Spring is not available.
Starting with Spring 6, SocketUtils.java used by asarkar has been removed from the code.

I will add the test code for SocketUtils mentioned above soon.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants