Skip to content

Commit 4bc1139

Browse files
brido4125jhpark816
authored andcommitted
INTERNAL: Refactor pipe insert and pipe update api.
1 parent 781c441 commit 4bc1139

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/net/spy/memcached/ArcusClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncCollectionPip
831831

832832
final CountDownLatch latch = new CountDownLatch(updateList.size());
833833
final PipedCollectionFuture<Integer, CollectionOperationStatus> rv =
834-
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout, updateList.size());
834+
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout);
835835

836836
for (int i = 0; i < updateList.size(); i++) {
837837
final CollectionPipedUpdate<T> update = updateList.get(i);
@@ -868,8 +868,8 @@ public void gotStatus(Integer index, OperationStatus status) {
868868
}
869869
}
870870
});
871-
addOp(key, op);
872871
rv.addOperation(op);
872+
addOp(key, op);
873873
}
874874
return rv;
875875
}
@@ -3699,7 +3699,7 @@ <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncCollectionPip
36993699

37003700
final CountDownLatch latch = new CountDownLatch(insertList.size());
37013701
final PipedCollectionFuture<Integer, CollectionOperationStatus> rv =
3702-
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout, insertList.size());
3702+
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout);
37033703

37043704
for (int i = 0; i < insertList.size(); i++) {
37053705
final CollectionPipedInsert<T> insert = insertList.get(i);
@@ -3736,8 +3736,8 @@ public void gotStatus(Integer index, OperationStatus status) {
37363736
}
37373737
}
37383738
});
3739-
addOp(key, op);
37403739
rv.addOperation(op);
3740+
addOp(key, op);
37413741
}
37423742
return rv;
37433743
}

src/main/java/net/spy/memcached/internal/PipedCollectionFuture.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
public class PipedCollectionFuture<K, V>
2222
extends CollectionFuture<Map<K, V>> {
2323
private final ConcurrentLinkedQueue<Operation> ops = new ConcurrentLinkedQueue<Operation>();
24-
private final List<CollectionOperationStatus> mergedOperationStatus;
24+
private final List<CollectionOperationStatus> mergedOperationStatus
25+
= Collections.synchronizedList(new ArrayList<CollectionOperationStatus>());
2526

2627
private final Map<K, V> mergedResult =
2728
new ConcurrentHashMap<K, V>();
2829

29-
public PipedCollectionFuture(CountDownLatch l, long opTimeout, int opSize) {
30+
public PipedCollectionFuture(CountDownLatch l, long opTimeout) {
3031
super(l, opTimeout);
31-
mergedOperationStatus = Collections
32-
.synchronizedList(new ArrayList<CollectionOperationStatus>(opSize));
3332
}
3433

3534
@Override

0 commit comments

Comments
 (0)