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

Add findFirstOpenPortFrom to LocalPortChecker #595

Closed
sleberknight opened this issue Aug 22, 2021 · 0 comments · Fixed by #596
Closed

Add findFirstOpenPortFrom to LocalPortChecker #595

sleberknight opened this issue Aug 22, 2021 · 0 comments · Fixed by #596
Assignees
Labels
enhancement A request for change or improvement to an existing feature
Milestone

Comments

@sleberknight
Copy link
Member

sleberknight commented Aug 22, 2021

Add findFirstOpenPortFrom to LocalPortChecker as a complement to findFirstOpenPortAbove. I recently (actually yesterday, in #594) had a need to start from a specific port, and this would have been convenient than having to subtract 1 from the argument, e.g.

// Instead of:
var portOptional = portChecker.findFirstOpenPortAbove(27016);

// New method allows doing:
var portOptional = portChecker.findFirstOpenPortFrom(27017);

In the above, 27016 might not immediately ring a bell, but (assuming you've ever touched a Mongo database), you'll probably recognize 27017 immediately as the default Mongo port.

I am actually not sure why we didn't have this method all along...looking at the existing code, it seems more natural to want to find a port starting from a specific port.

@sleberknight sleberknight added the enhancement A request for change or improvement to an existing feature label Aug 22, 2021
@sleberknight sleberknight added this to the 0.26.0 milestone Aug 22, 2021
@sleberknight sleberknight self-assigned this Aug 22, 2021
sleberknight added a commit that referenced this issue Aug 23, 2021
* Add new method LocalPortChecker#findFirstOpenPortFrom
* Add "throws" declaration to javadoc for isPortAvailable and
  findFirstOpenPortAbove
* Restructure the test to use nested classes, and add new tests for
  the new findFirstOpenPortFrom() method

Closes #595
chrisrohr pushed a commit that referenced this issue Aug 23, 2021
* Add new method LocalPortChecker#findFirstOpenPortFrom
* Add "throws" declaration to javadoc for isPortAvailable and
  findFirstOpenPortAbove
* Restructure the test to use nested classes, and add new tests for
  the new findFirstOpenPortFrom() method

Closes #595
sleberknight added a commit that referenced this issue Aug 23, 2021
* Add new method LocalPortChecker#findFirstOpenPortFrom
* Add "throws" declaration to javadoc for isPortAvailable and
  findFirstOpenPortAbove
* Restructure the test to use nested classes, and add new tests for
  the new findFirstOpenPortFrom() method

Closes #595
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A request for change or improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant