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

ISPN-2164 Add test method that tests concurrent removal using cache.remo... #1220

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/src/test/java/org/infinispan/tx/DummyTxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ protected EmbeddedCacheManager createCacheManager() throws Exception {
}

public void testConcurrentRemove() throws Exception {
runConcurrentRemove(false);
}

public void testConcurrentConditionalRemove() throws Exception {
runConcurrentRemove(true);
}

private void runConcurrentRemove(final boolean useConditionalRemove) throws Exception {
cache.put("k1", "v1");

// multiple threads will try to remove "k1" and commit.
Expand All @@ -88,7 +96,7 @@ public void run() {

tm().begin();
try {
boolean success = cache.remove("k1", "v1");
boolean success = useConditionalRemove ? cache.remove("k1", "v1") : (cache.remove("k1") != null);
TestingUtil.sleepRandom(200);
tm().commit();

Expand Down