Skip to content

Commit

Permalink
INTERNAL: Refactor pipe insert and pipe update api.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 committed Jul 24, 2023
1 parent 781c441 commit e9d9203
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/net/spy/memcached/ArcusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncCollectionPip

final CountDownLatch latch = new CountDownLatch(updateList.size());
final PipedCollectionFuture<Integer, CollectionOperationStatus> rv =
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout, updateList.size());
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout);

for (int i = 0; i < updateList.size(); i++) {
final CollectionPipedUpdate<T> update = updateList.get(i);
Expand Down Expand Up @@ -868,8 +868,8 @@ public void gotStatus(Integer index, OperationStatus status) {
}
}
});
addOp(key, op);
rv.addOperation(op);
addOp(key, op);
}
return rv;
}
Expand Down Expand Up @@ -3699,7 +3699,7 @@ <T> CollectionFuture<Map<Integer, CollectionOperationStatus>> asyncCollectionPip

final CountDownLatch latch = new CountDownLatch(insertList.size());
final PipedCollectionFuture<Integer, CollectionOperationStatus> rv =
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout, insertList.size());
new PipedCollectionFuture<Integer, CollectionOperationStatus>(latch, operationTimeout);

for (int i = 0; i < insertList.size(); i++) {
final CollectionPipedInsert<T> insert = insertList.get(i);
Expand Down Expand Up @@ -3736,8 +3736,8 @@ public void gotStatus(Integer index, OperationStatus status) {
}
}
});
addOp(key, op);
rv.addOperation(op);
addOp(key, op);
}
return rv;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
public class PipedCollectionFuture<K, V>
extends CollectionFuture<Map<K, V>> {
private final ConcurrentLinkedQueue<Operation> ops = new ConcurrentLinkedQueue<Operation>();
private final List<CollectionOperationStatus> mergedOperationStatus;
private final List<CollectionOperationStatus> mergedOperationStatus
= Collections.synchronizedList(new ArrayList<CollectionOperationStatus>());

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

public PipedCollectionFuture(CountDownLatch l, long opTimeout, int opSize) {
public PipedCollectionFuture(CountDownLatch l, long opTimeout) {
super(l, opTimeout);
mergedOperationStatus = Collections
.synchronizedList(new ArrayList<CollectionOperationStatus>(opSize));
}

@Override
Expand Down

0 comments on commit e9d9203

Please sign in to comment.