Skip to content

Commit

Permalink
ISPN-15555 Update com.github.ben-manes.caffeine:caffeine to 3.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wburns committed Jan 31, 2024
1 parent 2084278 commit 19d2e70
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<version.blockhound>1.0.8.RELEASE</version.blockhound>
<version.bouncycastle>1.70</version.bouncycastle>
<version.byteman>4.0.21</version.byteman>
<version.caffeine>3.1.1</version.caffeine>
<version.caffeine>3.1.8</version.caffeine>
<version.commons.compress>1.21</version.commons.compress>
<version.console>14.0.15.Final</version.console>
<version.fabric8.kubernetes-client>6.3.1</version.fabric8.kubernetes-client>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public class DataOperationOrderer {

private final ConcurrentMap<Object, CompletionStage<Operation>> objectStages = new ConcurrentHashMap<>();

/**
* Returns how many keys have pending operations waiting for their completion
* @return number of keys with pending operations
*/
public int pendingOperations() {
return objectStages.size();
}

public enum Operation {
READ,
REMOVE,
Expand Down
5 changes: 5 additions & 0 deletions core/src/test/java/org/infinispan/stats/SingleStatsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.infinispan.eviction.EvictionStrategy;
import org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder;
import org.infinispan.test.MultipleCacheManagersTest;
import org.infinispan.test.TestingUtil;
import org.infinispan.transaction.TransactionMode;
import org.infinispan.util.concurrent.DataOperationOrderer;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -146,6 +148,9 @@ public void testStats() {
fail("Number of failed errors was: " + insertErrors + " manually check them.");
}

DataOperationOrderer doo = TestingUtil.extractComponent(cache, DataOperationOrderer.class);
eventually(() -> doo.pendingOperations() == 0);

int expectedSize = TOTAL_ENTRIES - insertErrors;

refreshStats();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.infinispan.client.hotrod.Flag;
import org.infinispan.client.hotrod.RemoteCache;
import org.infinispan.commons.test.Eventually;
Expand Down Expand Up @@ -164,7 +168,11 @@ public void testFailoverWithPassivation(Database database) throws Exception {

assertEquals(0, getNumberOfEntriesInMemory(cache));
assertEquals(1, table.countAllRows());
assertEquals("v1", cache.get("k1"));
// Eviction may not always remove k1
List<Map.Entry<String, String>> list = new ArrayList<>(cache.entrySet());
assertEquals(1, list.size());
Map.Entry<String, String> entry = list.get(0);
assertEquals(entry.getValue().substring(1), entry.getKey().substring(1));
}
}

Expand Down

0 comments on commit 19d2e70

Please sign in to comment.