class HBase_1_1_2_ClientMapCacheService extends AbstractControllerService implements DistributedMapCacheClient {

   @Override
    public <K, V> V getAndPutIfAbsent(final K key, final V value, final Serializer<K> keySerializer, final Serializer<V> valueSerializer, final Deserializer<V> valueDeserializer) throws IOException {
      // Between the get and the putIfAbsent, the value could be deleted or updated.
      // Logic below takes care of the deleted case but not the updated case.
      // This is probably fine since DistributedMapCache and DetectDuplicate expect to receive the original cache value
      // Could possibly be fixed by implementing AtomicDistributedMapCache (Map Cache protocol version 2)
      final V got = get(key, keySerializer, valueDeserializer);
      final boolean wasAbsent = putIfAbsent(key, value, keySerializer, valueSerializer);

      if (! wasAbsent) return got;
      else return null;
   }

}