diff --git a/src/main/java/net/spy/memcached/ArcusClient.java b/src/main/java/net/spy/memcached/ArcusClient.java index be4a89331..473db5658 100644 --- a/src/main/java/net/spy/memcached/ArcusClient.java +++ b/src/main/java/net/spy/memcached/ArcusClient.java @@ -191,6 +191,7 @@ public class ArcusClient extends FrontCacheMemcachedClient implements ArcusClien private static final Logger arcusLogger = LoggerFactory.getLogger(ArcusClient.class); private static final String ARCUS_ADMIN_ADDR = "127.0.0.1:2181"; private static final String DEFAULT_ARCUS_CLIENT_NAME = "ArcusClient"; + public static final int MAX_PIPED_ITEM_COUNT = 500; private final Transcoder collectionTranscoder; @@ -844,10 +845,10 @@ public void complete() { // got status public void gotStatus(Integer index, OperationStatus status) { if (status instanceof CollectionOperationStatus) { - rv.addEachResult(index + (idx * CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT), + rv.addEachResult(index + (idx * MAX_PIPED_ITEM_COUNT), (CollectionOperationStatus) status); } else { - rv.addEachResult(index + (idx * CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT), + rv.addEachResult(index + (idx * MAX_PIPED_ITEM_COUNT), new CollectionOperationStatus(status)); } } @@ -1774,11 +1775,10 @@ public CollectionFuture> asyncBopPip List> insertList = new ArrayList<>(); - if (elements.size() <= CollectionPipedInsert.MAX_PIPED_ITEM_COUNT) { + if (elements.size() <= MAX_PIPED_ITEM_COUNT) { insertList.add(new BTreePipedInsert<>(key, elements, attributesForCreate, tc)); } else { - PartitionedMap list = new PartitionedMap<>( - elements, CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); + PartitionedMap list = new PartitionedMap<>(elements, MAX_PIPED_ITEM_COUNT); for (Map elementMap : list) { insertList.add(new BTreePipedInsert<>(key, elementMap, attributesForCreate, tc)); } @@ -1798,11 +1798,10 @@ public CollectionFuture> asyncBopPip List> insertList = new ArrayList<>(); - if (elements.size() <= CollectionPipedInsert.MAX_PIPED_ITEM_COUNT) { + if (elements.size() <= MAX_PIPED_ITEM_COUNT) { insertList.add(new ByteArraysBTreePipedInsert<>(key, elements, attributesForCreate, tc)); } else { - PartitionedList> list = new PartitionedList<>( - elements, CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); + PartitionedList> list = new PartitionedList<>(elements, MAX_PIPED_ITEM_COUNT); for (List> elementList : list) { insertList.add(new ByteArraysBTreePipedInsert<>(key, elementList, attributesForCreate, tc)); } @@ -1826,11 +1825,10 @@ public CollectionFuture> asyncMopPip List> insertList = new ArrayList<>(); - if (elements.size() <= CollectionPipedInsert.MAX_PIPED_ITEM_COUNT) { + if (elements.size() <= MAX_PIPED_ITEM_COUNT) { insertList.add(new MapPipedInsert<>(key, elements, attributesForCreate, tc)); } else { - PartitionedMap list = new PartitionedMap<>( - elements, CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); + PartitionedMap list = new PartitionedMap<>(elements, MAX_PIPED_ITEM_COUNT); for (Map elementMap : list) { insertList.add(new MapPipedInsert<>(key, elementMap, attributesForCreate, tc)); } @@ -1850,11 +1848,10 @@ public CollectionFuture> asyncLopPip List> insertList = new ArrayList<>(); - if (valueList.size() <= CollectionPipedInsert.MAX_PIPED_ITEM_COUNT) { + if (valueList.size() <= MAX_PIPED_ITEM_COUNT) { insertList.add(new ListPipedInsert<>(key, index, valueList, attributesForCreate, tc)); } else { - PartitionedList list = new PartitionedList<>(valueList, - CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); + PartitionedList list = new PartitionedList<>(valueList, MAX_PIPED_ITEM_COUNT); for (List elementList : list) { insertList.add(new ListPipedInsert<>(key, index, elementList, attributesForCreate, tc)); } @@ -1874,11 +1871,10 @@ public CollectionFuture> asyncSopPip List> insertList = new ArrayList<>(); - if (valueList.size() <= CollectionPipedInsert.MAX_PIPED_ITEM_COUNT) { + if (valueList.size() <= MAX_PIPED_ITEM_COUNT) { insertList.add(new SetPipedInsert<>(key, valueList, attributesForCreate, tc)); } else { - PartitionedList list = new PartitionedList<>(valueList, - CollectionPipedInsert.MAX_PIPED_ITEM_COUNT); + PartitionedList list = new PartitionedList<>(valueList, MAX_PIPED_ITEM_COUNT); for (List elementList : list) { insertList.add(new SetPipedInsert<>(key, elementList, attributesForCreate, tc)); } @@ -2310,11 +2306,10 @@ public CollectionFuture> asyncBopPip List> updateList = new ArrayList<>(); - if (elements.size() <= CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT) { + if (elements.size() <= MAX_PIPED_ITEM_COUNT) { updateList.add(new BTreePipedUpdate<>(key, elements, tc)); } else { - PartitionedList> list = new PartitionedList<>( - elements, CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT); + PartitionedList> list = new PartitionedList<>(elements, MAX_PIPED_ITEM_COUNT); for (List> elementList : list) { updateList.add(new BTreePipedUpdate<>(key, elementList, tc)); } @@ -2343,12 +2338,10 @@ public CollectionFuture> asyncMopPip List> updateList = new ArrayList<>(); - if (elements.size() <= CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT) { + if (elements.size() <= MAX_PIPED_ITEM_COUNT) { updateList.add(new MapPipedUpdate<>(key, elements, tc)); } else { - PartitionedMap list = new PartitionedMap<>( - elements, CollectionPipedUpdate.MAX_PIPED_ITEM_COUNT); - + PartitionedMap list = new PartitionedMap<>(elements, MAX_PIPED_ITEM_COUNT); for (Map elementMap : list) { updateList.add(new MapPipedUpdate<>(key, elementMap, tc)); } @@ -2943,10 +2936,10 @@ CollectionFuture> asyncSetPipedExist( throw new IllegalArgumentException( "The number of piped operations must be larger than 0."); } - if (exist.getItemCount() > SetPipedExist.MAX_PIPED_ITEM_COUNT) { + if (exist.getItemCount() > MAX_PIPED_ITEM_COUNT) { throw new IllegalArgumentException( "The number of piped operations must not exceed a maximum of " - + SetPipedExist.MAX_PIPED_ITEM_COUNT + "."); + + MAX_PIPED_ITEM_COUNT + "."); } final CountDownLatch latch = new CountDownLatch(1); @@ -3107,10 +3100,10 @@ public void complete() { // got status public void gotStatus(Integer index, OperationStatus status) { if (status instanceof CollectionOperationStatus) { - rv.addEachResult(index + (idx * CollectionPipedInsert.MAX_PIPED_ITEM_COUNT), + rv.addEachResult(index + (idx * MAX_PIPED_ITEM_COUNT), (CollectionOperationStatus) status); } else { - rv.addEachResult(index + (idx * CollectionPipedInsert.MAX_PIPED_ITEM_COUNT), + rv.addEachResult(index + (idx * MAX_PIPED_ITEM_COUNT), new CollectionOperationStatus(status)); } } diff --git a/src/main/java/net/spy/memcached/collection/CollectionPipedInsert.java b/src/main/java/net/spy/memcached/collection/CollectionPipedInsert.java index a496a3c5d..a4715cb32 100644 --- a/src/main/java/net/spy/memcached/collection/CollectionPipedInsert.java +++ b/src/main/java/net/spy/memcached/collection/CollectionPipedInsert.java @@ -30,8 +30,6 @@ public abstract class CollectionPipedInsert extends CollectionPipe { - public static final int MAX_PIPED_ITEM_COUNT = 500; - protected final String key; protected final CollectionAttributes attribute; protected final Transcoder tc; diff --git a/src/main/java/net/spy/memcached/collection/CollectionPipedUpdate.java b/src/main/java/net/spy/memcached/collection/CollectionPipedUpdate.java index b0469428f..7ac5060e4 100644 --- a/src/main/java/net/spy/memcached/collection/CollectionPipedUpdate.java +++ b/src/main/java/net/spy/memcached/collection/CollectionPipedUpdate.java @@ -29,8 +29,6 @@ public abstract class CollectionPipedUpdate extends CollectionPipe { - public static final int MAX_PIPED_ITEM_COUNT = 500; - protected final String key; protected final Transcoder tc; diff --git a/src/main/java/net/spy/memcached/collection/SetPipedExist.java b/src/main/java/net/spy/memcached/collection/SetPipedExist.java index 142988dc2..4bb3e0526 100644 --- a/src/main/java/net/spy/memcached/collection/SetPipedExist.java +++ b/src/main/java/net/spy/memcached/collection/SetPipedExist.java @@ -28,8 +28,6 @@ public class SetPipedExist extends CollectionPipe { - public static final int MAX_PIPED_ITEM_COUNT = 500; - private static final String COMMAND = "sop exist"; private final String key; diff --git a/src/test/java/net/spy/memcached/ArcusTimeoutTest.java b/src/test/java/net/spy/memcached/ArcusTimeoutTest.java index deedc0af9..446b06342 100644 --- a/src/test/java/net/spy/memcached/ArcusTimeoutTest.java +++ b/src/test/java/net/spy/memcached/ArcusTimeoutTest.java @@ -27,7 +27,6 @@ import java.util.concurrent.TimeoutException; import net.spy.memcached.collection.CollectionAttributes; -import net.spy.memcached.collection.CollectionPipedInsert; import net.spy.memcached.collection.ElementFlagFilter; import net.spy.memcached.collection.SMGetElement; import net.spy.memcached.collection.SMGetMode; @@ -142,7 +141,7 @@ void testBulkDeleteTimeoutUsingSingleThread() { @Test void testSopPipedInsertBulkTimeout() { String key = "testTimeout"; - int valueCount = CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + int valueCount = ArcusClient.MAX_PIPED_ITEM_COUNT; Object[] valueList = new Object[valueCount]; for (int i = 0; i < valueList.length; i++) { valueList[i] = "MyValue" + i; @@ -199,7 +198,7 @@ void testBopPipedInsertBulkTimeout() { String key = "MyBopKey"; String value = "MyValue"; - int bkeySize = CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + int bkeySize = ArcusClient.MAX_PIPED_ITEM_COUNT; Map bkeys = new TreeMap<>(); for (int i = 0; i < bkeySize; i++) { bkeys.put((long) i, value); @@ -297,7 +296,7 @@ void testMopInsertBulkMultipleTimeout() { String key = "MyMopKey"; String value = "MyValue"; - int elementSize = CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + int elementSize = ArcusClient.MAX_PIPED_ITEM_COUNT; Map elements = new TreeMap<>(); for (int i = 0; i < elementSize; i++) { elements.put(String.valueOf(i), value); diff --git a/src/test/manual/net/spy/memcached/bulkoperation/SopInsertBulkMultipleValueTest.java b/src/test/manual/net/spy/memcached/bulkoperation/SopInsertBulkMultipleValueTest.java index 28439ccc9..96a621b55 100644 --- a/src/test/manual/net/spy/memcached/bulkoperation/SopInsertBulkMultipleValueTest.java +++ b/src/test/manual/net/spy/memcached/bulkoperation/SopInsertBulkMultipleValueTest.java @@ -23,9 +23,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import net.spy.memcached.ArcusClient; import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; -import net.spy.memcached.collection.CollectionPipedInsert; import net.spy.memcached.ops.CollectionOperationStatus; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ void testInsertAndGet() { String key = "testInsertAndGet"; String prefix = "MyValue"; - int valueCount = CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + int valueCount = ArcusClient.MAX_PIPED_ITEM_COUNT; Object[] valueList = new Object[valueCount]; for (int i = 0; i < valueList.length; i++) { valueList[i] = String.format("%s%d", prefix, i); diff --git a/src/test/manual/net/spy/memcached/collection/list/LopBulkAPITest.java b/src/test/manual/net/spy/memcached/collection/list/LopBulkAPITest.java index 92a56edc3..f428bda89 100644 --- a/src/test/manual/net/spy/memcached/collection/list/LopBulkAPITest.java +++ b/src/test/manual/net/spy/memcached/collection/list/LopBulkAPITest.java @@ -22,10 +22,10 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import net.spy.memcached.ArcusClient; import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; import net.spy.memcached.collection.CollectionOverflowAction; -import net.spy.memcached.collection.CollectionPipedInsert; import net.spy.memcached.internal.CollectionFuture; import net.spy.memcached.ops.CollectionOperationStatus; @@ -43,7 +43,7 @@ class LopBulkAPITest extends BaseIntegrationTest { private final List valueList = new ArrayList<>(); private int getValueCount() { - return CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + return ArcusClient.MAX_PIPED_ITEM_COUNT; } @BeforeEach diff --git a/src/test/manual/net/spy/memcached/collection/map/MopBulkAPITest.java b/src/test/manual/net/spy/memcached/collection/map/MopBulkAPITest.java index 169ddb0ee..864a5a17f 100644 --- a/src/test/manual/net/spy/memcached/collection/map/MopBulkAPITest.java +++ b/src/test/manual/net/spy/memcached/collection/map/MopBulkAPITest.java @@ -21,10 +21,10 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import net.spy.memcached.ArcusClient; import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; import net.spy.memcached.collection.CollectionOverflowAction; -import net.spy.memcached.collection.CollectionPipedInsert; import net.spy.memcached.internal.CollectionFuture; import net.spy.memcached.ops.CollectionOperationStatus; @@ -42,7 +42,7 @@ class MopBulkAPITest extends BaseIntegrationTest { private final Map updateMap = new HashMap<>(); private int getValueCount() { - return CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + return ArcusClient.MAX_PIPED_ITEM_COUNT; } @BeforeEach diff --git a/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java b/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java index ac38a08f6..2cf92bc73 100644 --- a/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java +++ b/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java @@ -24,9 +24,9 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import net.spy.memcached.ArcusClient; import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; -import net.spy.memcached.collection.CollectionPipedInsert; import net.spy.memcached.internal.CollectionFuture; import net.spy.memcached.ops.CollectionOperationStatus; @@ -43,7 +43,7 @@ class SopBulkAPITest extends BaseIntegrationTest { private final List valueList = new ArrayList<>(); private int getValueCount() { - return CollectionPipedInsert.MAX_PIPED_ITEM_COUNT; + return ArcusClient.MAX_PIPED_ITEM_COUNT; } @BeforeEach diff --git a/src/test/manual/net/spy/memcached/collection/set/SopPipedExistTest.java b/src/test/manual/net/spy/memcached/collection/set/SopPipedExistTest.java index cbfdeab5f..a1dd7c5a0 100644 --- a/src/test/manual/net/spy/memcached/collection/set/SopPipedExistTest.java +++ b/src/test/manual/net/spy/memcached/collection/set/SopPipedExistTest.java @@ -20,11 +20,11 @@ import java.util.List; import java.util.Map; +import net.spy.memcached.ArcusClient; import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; import net.spy.memcached.collection.CollectionResponse; import net.spy.memcached.collection.ElementValueType; -import net.spy.memcached.collection.SetPipedExist; import net.spy.memcached.internal.CollectionFuture; import org.junit.jupiter.api.AfterEach; @@ -146,7 +146,7 @@ void testMaxPipedExist() { List findValues = new ArrayList<>(); // insert items - for (int i = 0; i < SetPipedExist.MAX_PIPED_ITEM_COUNT; i++) { + for (int i = 0; i < ArcusClient.MAX_PIPED_ITEM_COUNT; i++) { findValues.add("VALUE" + i); if (i / 2 == 0) { @@ -164,7 +164,7 @@ void testMaxPipedExist() { assertTrue(future.getOperationStatus().isSuccess()); - for (int i = 0; i < SetPipedExist.MAX_PIPED_ITEM_COUNT; i++) { + for (int i = 0; i < ArcusClient.MAX_PIPED_ITEM_COUNT; i++) { if (i / 2 == 0) { assertFalse(map.get("VALUE" + i)); } else {