-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makes logging more consistent by propagating the log factory
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
- Loading branch information
Showing
16 changed files
with
167 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
backend/src/test/java/com/bakdata/conquery/util/support/ClosableSocketSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.bakdata.conquery.util.support; | ||
|
||
import java.io.IOException; | ||
import java.net.ServerSocket; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
/** | ||
* Small helper to find open ports by opening random ports together in one context. | ||
* A previous implementation opened and closed ports individually which could cause a port binding collision | ||
* much easier. | ||
*/ | ||
public class ClosableSocketSupplier implements Supplier<ServerSocket>, AutoCloseable { | ||
|
||
private final List<ServerSocket> openSockets = new ArrayList<>(); | ||
|
||
@Override | ||
public void close() { | ||
openSockets.forEach((s) -> { | ||
try { | ||
s.close(); | ||
} | ||
catch (IOException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
}); | ||
openSockets.clear(); | ||
} | ||
|
||
@Override | ||
@SneakyThrows | ||
public ServerSocket get() { | ||
final ServerSocket serverSocket = new ServerSocket(0); | ||
openSockets.add(serverSocket); | ||
return serverSocket; | ||
} | ||
} |
Oops, something went wrong.