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 fairness option to KeyedLock. #10703

Closed

Conversation

GaelTadh
Copy link
Contributor

This change adds the ability of a KeyedLock to be fair this means that threads will aquire the lock in the order they ask for it.
Also add a test to ensure the fairness parameter is obeyed.

@GaelTadh GaelTadh added >enhancement >test Issues or PRs that are addressing/adding tests review labels Apr 21, 2015
@@ -75,6 +77,58 @@ public void checkIfMapEmptyAfterLotsOfAcquireAndReleases() throws InterruptedExc
}
}

public void checkIfFairLockingWorks() throws InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what this test tests to be honest but we only pass the param on so no need to really test it. the randomization up there is fine.

@s1monw
Copy link
Contributor

s1monw commented Apr 21, 2015

it looks ok to me but may I ask what triggered this change?

@s1monw s1monw self-assigned this Apr 21, 2015
@GaelTadh
Copy link
Contributor Author

I have a use case for guaranteed order of execution.I'm seeing this test intermittently fail on my build so I'm investigating.

@s1monw
Copy link
Contributor

s1monw commented Apr 23, 2015

ok I see - please remove this test though we are not testing JDK functionality - the randomization is fine

@GaelTadh
Copy link
Contributor Author

Can I merge this to 1.x and 1.5?

@GaelTadh GaelTadh force-pushed the enhancment/add_fair_keyedlock branch from 8045210 to 8bd1585 Compare April 23, 2015 19:41
@s1monw s1monw added v2.0.0-beta1 v1.6.0 and removed >test Issues or PRs that are addressing/adding tests labels Apr 24, 2015
@s1monw
Copy link
Contributor

s1monw commented Apr 24, 2015

please squash and push to all relevant branches. 1.5 is bugfix only so please only to 1.x and master

@s1monw
Copy link
Contributor

s1monw commented Apr 28, 2015

@GaelTadh ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants