Skip to content
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

SocketUtils is internalized. The library has been changed. #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

build.gradle.kts Show resolved Hide resolved
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 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.

2 participants