com.googlecode.objectify.cache
Class MergeFuture<K,V>

java.lang.Object
  extended by com.googlecode.objectify.cache.MergeFuture<K,V>
All Implemented Interfaces:
java.util.concurrent.Future<java.util.Map<K,V>>

public class MergeFuture<K,V>
extends java.lang.Object
implements java.util.concurrent.Future<java.util.Map<K,V>>

A Future which merges some previously loaded values with the results of another Future that is in progress. It can apply to any key/value pair type; typically it will be for Key/Entity or Key/T

Author:
Jeff Schnitzer

Constructor Summary
MergeFuture(java.util.Map<K,V> preloaded, java.util.concurrent.Future<java.util.Map<K,V>> pending)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 java.util.Map<K,V> get()
           
 java.util.Map<K,V> get(long timeout, java.util.concurrent.TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeFuture

public MergeFuture(java.util.Map<K,V> preloaded,
                   java.util.concurrent.Future<java.util.Map<K,V>> pending)
Parameters:
preloaded - is a collection of entities that have already been obtained, say from the memcache. TAKES OWNERSHIP OF THE MAP OBJECT - it will be modified later.
pending - is a future of entities that will be obtained sometime later, or null if merging is unnecessary and the preloaded values complete the result.
Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface java.util.concurrent.Future<java.util.Map<K,V>>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface java.util.concurrent.Future<java.util.Map<K,V>>

isDone

public boolean isDone()
Specified by:
isDone in interface java.util.concurrent.Future<java.util.Map<K,V>>
See Also:
Future.isDone()

get

public java.util.Map<K,V> get()
                       throws java.lang.InterruptedException,
                              java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future<java.util.Map<K,V>>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public java.util.Map<K,V> get(long timeout,
                              java.util.concurrent.TimeUnit unit)
                       throws java.lang.InterruptedException,
                              java.util.concurrent.ExecutionException,
                              java.util.concurrent.TimeoutException
Specified by:
get in interface java.util.concurrent.Future<java.util.Map<K,V>>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException


Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1