public
Description: A simple, asynchronous, single-threaded memcached client written in java.
Homepage: http://code.google.com/p/spymemcached/
Clone URL: git://github.com/dustin/java-memcached-client.git
Search Repo:
Some refactoring in the futures to get more consistent behavior.
dustin (author)
Tue May 13 22:19:42 -0700 2008
commit  f1969bf1f88b62a71dcc9f392c4c9f0756fcea09
tree    8aafba90a32922014e8babb98c2af083de0fcd09
parent  0be1844a79e2d9ecd635e770faf479f3a221be87
...
1413
1414
1415
1416
1417
1418
1419
 
 
 
 
 
1420
1421
1422
1423
1424
1425
1426
1427
1428
 
1429
1430
1431
 
 
 
 
 
 
 
1432
1433
1434
...
1413
1414
1415
 
 
 
 
1416
1417
1418
1419
1420
1421
 
 
 
 
1422
1423
1424
 
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
0
@@ -1413,22 +1413,26 @@
0
     }
0
 
0
     public T get() throws InterruptedException, ExecutionException {
0
- latch.await(globalOperationTimeout, TimeUnit.MILLISECONDS);
0
- assert isDone() : "Latch released, but operation wasn't done.";
0
- if(op != null && op.hasErrored()) {
0
- throw new ExecutionException(op.getException());
0
+ try {
0
+ return get(globalOperationTimeout, TimeUnit.MILLISECONDS);
0
+ } catch (TimeoutException e) {
0
+ throw new RuntimeException(
0
+ "Timed out waiting for operation", e);
0
       }
0
- if(isCancelled()) {
0
- throw new ExecutionException(new RuntimeException("Cancelled"));
0
- }
0
- return objRef.get();
0
     }
0
 
0
     public T get(long duration, TimeUnit units)
0
- throws InterruptedException, TimeoutExceptionException {
0
+ throws InterruptedException, TimeoutException, ExecutionException {
0
       if(!latch.await(duration, units)) {
0
         throw new TimeoutException("Timed out waiting for operation");
0
       }
0
+ if(op != null && op.hasErrored()) {
0
+ throw new ExecutionException(op.getException());
0
+ }
0
+ if(isCancelled()) {
0
+ throw new ExecutionException(new RuntimeException("Cancelled"));
0
+ }
0
+
0
       return objRef.get();
0
     }
0
 

Comments

    No one has commented yet.