@@ -43,21 +43,24 @@ public class BulkGetFuture<T> implements BulkFuture<Map<String, T>> {
4343 private final Map <String , Future <T >> rvMap ;
4444 private final Collection <Operation > ops ;
4545 private final CountDownLatch latch ;
46- private boolean timeout = false ;
46+ private final long timeout ;
47+ private boolean isTimeout = false ;
4748
48- public BulkGetFuture (Map <String , Future <T >> m ,
49- Collection < Operation > getOps , CountDownLatch l ) {
49+ public BulkGetFuture (Map <String , Future <T >> rvMap , Collection < Operation > ops ,
50+ CountDownLatch latch , Long timeout ) {
5051 super ();
51- rvMap = m ;
52- ops = getOps ;
53- latch = l ;
52+ this .rvMap = rvMap ;
53+ this .ops = ops ;
54+ this .latch = latch ;
55+ this .timeout = timeout ;
5456 }
5557
5658 public BulkGetFuture (BulkGetFuture <T > other ) {
5759 super ();
5860 rvMap = other .rvMap ;
5961 ops = other .ops ;
6062 latch = other .latch ;
63+ timeout = other .timeout ;
6164 }
6265
6366 @ Override
@@ -72,7 +75,7 @@ public boolean cancel(boolean ign) {
7275 @ Override
7376 public Map <String , T > get () throws InterruptedException , ExecutionException {
7477 try {
75- return get (Long . MAX_VALUE , TimeUnit .MILLISECONDS );
78+ return get (timeout , TimeUnit .MILLISECONDS );
7679 } catch (TimeoutException e ) {
7780 throw new OperationTimeoutException (e );
7881 }
@@ -84,7 +87,7 @@ public Map<String, T> getSome(long duration, TimeUnit units)
8487 Collection <Operation > timedoutOps = new HashSet <Operation >();
8588 Map <String , T > ret = internalGet (duration , units , timedoutOps );
8689 if (timedoutOps .size () > 0 ) {
87- timeout = true ;
90+ isTimeout = true ;
8891 LoggerFactory .getLogger (getClass ()).warn (
8992 new CheckedOperationTimeoutException (duration , units , timedoutOps ).getMessage ());
9093 }
@@ -104,7 +107,7 @@ public Map<String, T> get(long duration, TimeUnit units)
104107 Collection <Operation > timedoutOps = new HashSet <Operation >();
105108 Map <String , T > ret = internalGet (duration , units , timedoutOps );
106109 if (timedoutOps .size () > 0 ) {
107- this . timeout = true ;
110+ isTimeout = true ;
108111 throw new CheckedOperationTimeoutException (duration , units , timedoutOps );
109112 }
110113 return ret ;
@@ -177,6 +180,6 @@ private Map<String, T> internalGet(long to, TimeUnit unit,
177180 * @see net.spy.memcached.internal.BulkFuture#isTimeout()
178181 */
179182 public boolean isTimeout () {
180- return timeout ;
183+ return isTimeout ;
181184 }
182185}
0 commit comments