-
Notifications
You must be signed in to change notification settings - Fork 3
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
Unix sockets support #13
Open
Furrrlo
wants to merge
16
commits into
prat-man:main
Choose a base branch
from
Furrrlo:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Otherwise, if one fails, the rest will too, as the lock file is left hanging
This will make sure that the tests don't have any dependency within one another and can potentially be run in parallel.
Allows the users to modify the underlying sockets directly. This, for example, makes it possible to switch to a unix socket with the junixsocket library if one wants to.
Shared locks do not seem to behave as I expected (at least on Windows), as I cannot seem to write to the file after having just locked it from the same exact Thread and File descriptor.
This will allow to: 1. Properly cleanup additional resources such as the port file when the socket gets closed 2. Use SocketChannels instead of OIO, (which also introduced UNIX sockets in Java16 without the need of 3rd party libraries)
Fixes the Unique4jTest#testSubsequentAcquireLock() race condition, because as soon as the client received the response, it would close the socket, causing the server to not release the lock fast enough
This way it's easier to change it
This needs to make the compiler use Java 16 for compiling tests, while keeping Java 1.6 for the code itself
The file where we write the port changed
Makes it easier to target 2 different java versions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for using Unix sockets instead of the default TCP one, either via the junixsocket library (Java 1.7+) or the SocketChannel implementation introduced by Java 16.
It should completely mantain compatibility with the old API, it was mostly internal changes, with the only addition of 1 constructor to the Unique4j class. The only minor inconvenience is that I had to bump the Java version of the core module to 1.7, as the Java 16 compiler doesn't allow to go lower than that.
Example usage (p much the same):
I had to move a bunch of stuff around and add a bit of scaffolding so the PR is kinda big, but I thought I would still try to contribute it back.