[ 
https://issues.apache.org/jira/browse/CAMEL-13853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904958#comment-16904958
 ] 

Zoran Regvart commented on CAMEL-13853:
---------------------------------------

I don't think it's necessary to search for a free port, one can be assigned by 
the OS by using {{new ServerSocket(0)}} as 
[documented|https://docs.oracle.com/javase/8/docs/api/java/net/ServerSocket.html#ServerSocket-int-],
 then we can get the allocated port via {{ServerSocket::getLocalPort}} and 
close the the created {{ServerSocket}} that would make {{AvailablePortFinder}} 
much simpler and have better performance overall.

> camel-test AvailablePortFinder fails on WSL for Windows 10
> ----------------------------------------------------------
>
>                 Key: CAMEL-13853
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13853
>             Project: Camel
>          Issue Type: Improvement
>          Components: tests
>         Environment: WSL: OpenJDK 1.8.0_212 and OpenJDK 11.0.4
>            Reporter: Jan Bednar
>            Assignee: Jan Bednar
>            Priority: Minor
>         Attachments: console.log, hs_err_pid9023.log, replay_pid9023.log
>
>
> On WSL with Ubuntu 16.04.6 LTS method getNextAvailable iterates all ports and 
> then crashes JVM (logs in attachments).
> This can be reproduced by running AvailablePortFinderTest on one of these 
> platforms.
> We can take a look to other implementations, if they performs better and are 
> usable on all supported OS.
> //Edit: Removed W10 from environments, as I cannot reproduce it again. On WSL 
> it is reproducible always.
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to