/**
   * @param cache Cache.
   * @return Cache.
   */
  protected <K, V> GridCacheAdapter<K, V> internalCache(IgniteCache<K, V> cache) {
    if (isMultiJvmObject(cache))
      throw new UnsupportedOperationException(
          "Oparetion can't be supported automatically for multi jvm " + "(send closure instead).");

    return ((IgniteKernal) cache.unwrap(Ignite.class)).internalCache(cache.getName());
  }
 /**
  * @param cache Cache.
  * @return DHT cache.
  */
 protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K, V> cache) {
   return nearEnabled(cache)
       ? near(cache).dht()
       : ((IgniteKernal) cache.unwrap(Ignite.class))
           .<K, V>internalCache(cache.getName())
           .context()
           .dht();
 }
 /** @param cache Cache. */
 protected <K, V> GridCacheAdapter<K, V> cacheFromCtx(IgniteCache<K, V> cache) {
   return ((IgniteKernal) cache.unwrap(Ignite.class))
       .<K, V>internalCache(cache.getName())
       .context()
       .cache();
 }
 /**
  * @param cache Cache.
  * @return Local node.
  */
 public static ClusterNode localNode(IgniteCache<?, ?> cache) {
   return cache.unwrap(Ignite.class).cluster().localNode();
 }
 /**
  * @param cache Cache.
  * @return Affinity.
  */
 public static <K> Affinity<K> affinity(IgniteCache<K, ?> cache) {
   return cache.unwrap(Ignite.class).affinity(cache.getName());
 }
 /**
  * @param cache Cache.
  * @return Colocated cache.
  */
 protected static <K, V> GridDhtColocatedCache<K, V> colocated(IgniteCache<K, V> cache) {
   return ((IgniteKernal) cache.unwrap(Ignite.class))
       .<K, V>internalCache(cache.getName())
       .context()
       .colocated();
 }
 /**
  * @param cache Cache.
  * @return Near cache.
  */
 protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K, V> cache) {
   return ((IgniteKernal) cache.unwrap(Ignite.class))
       .<K, V>internalCache(cache.getName())
       .context()
       .near();
 }