@@ -923,8 +923,10 @@ public <T> CASResponse cas(String key, long casId, int exp, T value,
923
923
} catch (InterruptedException e ) {
924
924
throw new RuntimeException ("Interrupted waiting for value" , e );
925
925
} catch (ExecutionException e ) {
926
- if (e .getCause () instanceof CancellationException ) {
926
+ if (e .getCause () instanceof CancellationException ) {
927
927
throw (CancellationException ) e .getCause ();
928
+ } else if (e .getCause () instanceof TimeoutException ) {
929
+ throw new OperationTimeoutException ("Timeout waiting for value" , e );
928
930
} else {
929
931
throw new RuntimeException ("Exception waiting for value" , e );
930
932
}
@@ -1386,8 +1388,10 @@ public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
1386
1388
} catch (InterruptedException e ) {
1387
1389
throw new RuntimeException ("Interrupted waiting for value" , e );
1388
1390
} catch (ExecutionException e ) {
1389
- if (e .getCause () instanceof CancellationException ) {
1391
+ if (e .getCause () instanceof CancellationException ) {
1390
1392
throw (CancellationException ) e .getCause ();
1393
+ } else if (e .getCause () instanceof TimeoutException ) {
1394
+ throw new OperationTimeoutException ("Timeout waiting for value" , e );
1391
1395
} else {
1392
1396
throw new RuntimeException ("Exception waiting for value" , e );
1393
1397
}
@@ -1479,8 +1483,10 @@ public <T> T get(String key, Transcoder<T> tc) {
1479
1483
} catch (InterruptedException e ) {
1480
1484
throw new RuntimeException ("Interrupted waiting for value" , e );
1481
1485
} catch (ExecutionException e ) {
1482
- if (e .getCause () instanceof CancellationException ) {
1486
+ if (e .getCause () instanceof CancellationException ) {
1483
1487
throw (CancellationException ) e .getCause ();
1488
+ } else if (e .getCause () instanceof TimeoutException ) {
1489
+ throw new OperationTimeoutException ("Timeout waiting for value" , e );
1484
1490
} else {
1485
1491
throw new RuntimeException ("Exception waiting for value" , e );
1486
1492
}
@@ -1807,8 +1813,10 @@ public <T> Map<String, T> getBulk(Iterator<String> keyIter,
1807
1813
} catch (InterruptedException e ) {
1808
1814
throw new RuntimeException ("Interrupted getting bulk values" , e );
1809
1815
} catch (ExecutionException e ) {
1810
- if (e .getCause () instanceof CancellationException ) {
1816
+ if (e .getCause () instanceof CancellationException ) {
1811
1817
throw (CancellationException ) e .getCause ();
1818
+ } else if (e .getCause () instanceof TimeoutException ) {
1819
+ throw new OperationTimeoutException ("Timeout waiting for bulk values" , e );
1812
1820
} else {
1813
1821
throw new RuntimeException ("Exception waiting for bulk values" , e );
1814
1822
}
@@ -2389,8 +2397,10 @@ private long mutateWithDefault(Mutator t, String key, long by, long def,
2389
2397
} catch (InterruptedException e ) {
2390
2398
throw new RuntimeException ("Interrupted waiting for store" , e );
2391
2399
} catch (ExecutionException e ) {
2392
- if (e .getCause () instanceof CancellationException ) {
2400
+ if (e .getCause () instanceof CancellationException ) {
2393
2401
throw (CancellationException ) e .getCause ();
2402
+ } else if (e .getCause () instanceof TimeoutException ) {
2403
+ throw new OperationTimeoutException ("Timeout waiting for store" , e );
2394
2404
} else {
2395
2405
throw new RuntimeException ("Failed waiting for store" , e );
2396
2406
}
0 commit comments