Skip to content

Commit

Permalink
FIX: getElement logic in BTreeStoreAndGetFuture.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 committed Sep 11, 2023
1 parent b4bec20 commit 0398941
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
package net.spy.memcached.internal;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;

import net.spy.memcached.OperationTimeoutException;
import net.spy.memcached.collection.Element;
import net.spy.memcached.ops.CollectionGetOpCallback;

Expand All @@ -41,6 +45,15 @@ public BTreeStoreAndGetFuture(CountDownLatch l, AtomicReference<T> oref, long op
}

public Element<E> getElement() {
try {
super.get(super.timeout, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
throw new OperationTimeoutException(e);
}
CollectionGetOpCallback callback = (CollectionGetOpCallback) op.getCallback();
callback.addResult();
return element;
Expand Down

0 comments on commit 0398941

Please sign in to comment.