ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [13/50] [abbrv] ignite git commit: IGNITE-4034 Get rid of specialized methods in platform targets
Date Wed, 26 Oct 2016 22:55:05 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 56e042c..56fc4b1 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -214,10 +214,12 @@ namespace ignite
             JniMethod M_PLATFORM_PROCESSOR_GET_CACHE_NAMES = JniMethod("getCacheNames", "(J)V", false);
 
             const char* C_PLATFORM_TARGET = "org/apache/ignite/internal/processors/platform/PlatformTarget";
+            JniMethod M_PLATFORM_TARGET_IN_LONG_OUT_LONG = JniMethod("inLongOutLong", "(IJ)J", false);
             JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_LONG = JniMethod("inStreamOutLong", "(IJ)J", false);
             JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT = JniMethod("inStreamOutObject", "(IJ)Ljava/lang/Object;", false);
             JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM = JniMethod("inStreamOutStream", "(IJJ)V", false);
             JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM = JniMethod("inObjectStreamOutStream", "(ILjava/lang/Object;JJ)V", false);
+            JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM = JniMethod("inObjectStreamOutObjectStream", "(ILjava/lang/Object;JJ)Ljava/lang/Object;", false);
             JniMethod M_PLATFORM_TARGET_OUT_LONG = JniMethod("outLong", "(I)J", false);
             JniMethod M_PLATFORM_TARGET_OUT_STREAM = JniMethod("outStream", "(IJ)V", false);
             JniMethod M_PLATFORM_TARGET_OUT_OBJECT = JniMethod("outObject", "(I)Ljava/lang/Object;", false);
@@ -226,72 +228,10 @@ namespace ignite
             JniMethod M_PLATFORM_TARGET_LISTEN_FUTURE_AND_GET = JniMethod("listenFutureAndGet", "(JI)Lorg/apache/ignite/internal/processors/platform/utils/PlatformListenable;", false);
             JniMethod M_PLATFORM_TARGET_LISTEN_FOR_OPERATION_AND_GET = JniMethod("listenFutureForOperationAndGet", "(JII)Lorg/apache/ignite/internal/processors/platform/utils/PlatformListenable;", false);
 
-            const char* C_PLATFORM_CLUSTER_GRP = "org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup";
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_OTHERS = JniMethod("forOthers", "(Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;)Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_REMOTES = JniMethod("forRemotes", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_DAEMONS = JniMethod("forDaemons", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_RANDOM = JniMethod("forRandom", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_OLDEST = JniMethod("forOldest", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_FOR_YOUNGEST = JniMethod("forYoungest", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
-            JniMethod M_PLATFORM_CLUSTER_GRP_RESET_METRICS = JniMethod("resetMetrics", "()V", false);
-
-            const char* C_PLATFORM_MESSAGING = "org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging";
-            JniMethod M_PLATFORM_MESSAGING_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/messaging/PlatformMessaging;", false);
-
-            const char* C_PLATFORM_COMPUTE = "org/apache/ignite/internal/processors/platform/compute/PlatformCompute";
-            JniMethod M_PLATFORM_COMPUTE_WITH_NO_FAILOVER = JniMethod("withNoFailover", "()V", false);
-            JniMethod M_PLATFORM_COMPUTE_WITH_TIMEOUT = JniMethod("withTimeout", "(J)V", false);
-            JniMethod M_PLATFORM_COMPUTE_EXECUTE_NATIVE = JniMethod("executeNative", "(JJ)Lorg/apache/ignite/internal/processors/platform/utils/PlatformListenable;", false);
-
-            const char* C_PLATFORM_CACHE = "org/apache/ignite/internal/processors/platform/cache/PlatformCache";
-            JniMethod M_PLATFORM_CACHE_WITH_SKIP_STORE = JniMethod("withSkipStore", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
-            JniMethod M_PLATFORM_CACHE_WITH_NO_RETRIES = JniMethod("withNoRetries", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
-            JniMethod M_PLATFORM_CACHE_WITH_EXPIRY_PLC = JniMethod("withExpiryPolicy", "(JJJ)Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
-            JniMethod M_PLATFORM_CACHE_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
-            JniMethod M_PLATFORM_CACHE_WITH_KEEP_PORTABLE = JniMethod("withKeepBinary", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
-            JniMethod M_PLATFORM_CACHE_CLEAR = JniMethod("clear", "()V", false);
-            JniMethod M_PLATFORM_CACHE_REMOVE_ALL = JniMethod("removeAll", "()V", false);
-            JniMethod M_PLATFORM_CACHE_ITERATOR = JniMethod("iterator", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator;", false);
-            JniMethod M_PLATFORM_CACHE_LOCAL_ITERATOR = JniMethod("localIterator", "(I)Lorg/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator;", false);
-            JniMethod M_PLATFORM_CACHE_ENTER_LOCK = JniMethod("enterLock", "(J)V", false);
-            JniMethod M_PLATFORM_CACHE_EXIT_LOCK = JniMethod("exitLock", "(J)V", false);
-            JniMethod M_PLATFORM_CACHE_TRY_ENTER_LOCK = JniMethod("tryEnterLock", "(JJ)Z", false);
-            JniMethod M_PLATFORM_CACHE_CLOSE_LOCK = JniMethod("closeLock", "(J)V", false);
-            JniMethod M_PLATFORM_CACHE_REBALANCE = JniMethod("rebalance", "(J)V", false);
-            JniMethod M_PLATFORM_CACHE_SIZE = JniMethod("size", "(IZ)I", false);
-
-            const char* C_PLATFORM_AFFINITY = "org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity";
-            JniMethod C_PLATFORM_AFFINITY_PARTITIONS = JniMethod("partitions", "()I", false);
-
-            const char* C_PLATFORM_DATA_STREAMER = "org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer";
-            JniMethod M_PLATFORM_DATA_STREAMER_LISTEN_TOPOLOGY = JniMethod("listenTopology", "(J)V", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_GET_ALLOW_OVERWRITE = JniMethod("allowOverwrite", "()Z", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_SET_ALLOW_OVERWRITE = JniMethod("allowOverwrite", "(Z)V", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_GET_SKIP_STORE = JniMethod("skipStore", "()Z", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_SET_SKIP_STORE = JniMethod("skipStore", "(Z)V", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_GET_PER_NODE_BUFFER_SIZE = JniMethod("perNodeBufferSize", "()I", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_SET_PER_NODE_BUFFER_SIZE = JniMethod("perNodeBufferSize", "(I)V", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_GET_PER_NODE_PARALLEL_OPS = JniMethod("perNodeParallelOperations", "()I", false);
-            JniMethod M_PLATFORM_DATA_STREAMER_SET_PER_NODE_PARALLEL_OPS = JniMethod("perNodeParallelOperations", "(I)V", false);
-
-            const char* C_PLATFORM_TRANSACTIONS = "org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions";
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_START = JniMethod("txStart", "(IIJI)J", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_COMMIT = JniMethod("txCommit", "(J)I", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_ROLLBACK = JniMethod("txRollback", "(J)I", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_COMMIT_ASYNC = JniMethod("txCommitAsync", "(JJ)V", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_ROLLBACK_ASYNC = JniMethod("txRollbackAsync", "(JJ)V", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_STATE = JniMethod("txState", "(J)I", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_SET_ROLLBACK_ONLY = JniMethod("txSetRollbackOnly", "(J)Z", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_TX_CLOSE = JniMethod("txClose", "(J)I", false);
-            JniMethod M_PLATFORM_TRANSACTIONS_RESET_METRICS = JniMethod("resetMetrics", "()V", false);
-
-            const char* C_PLATFORM_CACHE_STORE_CALLBACK = "org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback";
-            JniMethod M_PLATFORM_CACHE_STORE_CALLBACK_INVOKE = JniMethod("invoke", "(J)V", false);
-
             const char* C_PLATFORM_CALLBACK_UTILS = "org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils";
 
             JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_CREATE = JniMethod("cacheStoreCreate", "(JJ)J", true);
-            JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_INVOKE = JniMethod("cacheStoreInvoke", "(JJJLjava/lang/Object;)I", true);
+            JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_INVOKE = JniMethod("cacheStoreInvoke", "(JJJ)I", true);
             JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_DESTROY = JniMethod("cacheStoreDestroy", "(JJ)V", true);
             JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_SESSION_CREATE = JniMethod("cacheStoreSessionCreate", "(JJ)J", true);
 
@@ -378,56 +318,6 @@ namespace ignite
             JniMethod M_PLATFORM_IGNITION_STOP = JniMethod("stop", "(Ljava/lang/String;Z)Z", true);
             JniMethod M_PLATFORM_IGNITION_STOP_ALL = JniMethod("stopAll", "(Z)V", true);
 
-            const char* C_PLATFORM_ABSTRACT_QRY_CURSOR = "org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor";
-            JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER = JniMethod("iterator", "()V", false);
-            JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER_HAS_NEXT = JniMethod("iteratorHasNext", "()Z", false);
-            JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_CLOSE = JniMethod("close", "()V", false);
-
-            const char* C_PLATFORM_CONT_QRY = "org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQuery";
-            JniMethod M_PLATFORM_CONT_QRY_CLOSE = JniMethod("close", "()V", false);
-            JniMethod M_PLATFORM_CONT_QRY_GET_INITIAL_QUERY_CURSOR = JniMethod("getInitialQueryCursor", "()Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
-
-            const char* C_PLATFORM_EVENTS = "org/apache/ignite/internal/processors/platform/events/PlatformEvents";
-            JniMethod M_PLATFORM_EVENTS_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/events/PlatformEvents;", false);
-            JniMethod M_PLATFORM_EVENTS_STOP_LOCAL_LISTEN = JniMethod("stopLocalListen", "(J)Z", false);
-            JniMethod M_PLATFORM_EVENTS_LOCAL_LISTEN = JniMethod("localListen", "(JI)V", false);
-            JniMethod M_PLATFORM_EVENTS_IS_ENABLED = JniMethod("isEnabled", "(I)Z", false);
-
-            const char* C_PLATFORM_SERVICES = "org/apache/ignite/internal/processors/platform/services/PlatformServices";
-			JniMethod M_PLATFORM_SERVICES_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/services/PlatformServices;", false);
-			JniMethod M_PLATFORM_SERVICES_WITH_SERVER_KEEP_PORTABLE = JniMethod("withServerKeepBinary", "()Lorg/apache/ignite/internal/processors/platform/services/PlatformServices;", false);
-			JniMethod M_PLATFORM_SERVICES_CANCEL = JniMethod("cancel", "(Ljava/lang/String;)V", false);
-			JniMethod M_PLATFORM_SERVICES_CANCEL_ALL = JniMethod("cancelAll", "()V", false);
-			JniMethod M_PLATFORM_SERVICES_SERVICE_PROXY = JniMethod("serviceProxy", "(Ljava/lang/String;Z)Ljava/lang/Object;", false);
-
-            const char* C_PLATFORM_ATOMIC_LONG = "org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong";
-            JniMethod M_PLATFORM_ATOMIC_LONG_GET = JniMethod("get", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_INCREMENT_AND_GET = JniMethod("incrementAndGet", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_GET_AND_INCREMENT = JniMethod("getAndIncrement", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_ADD_AND_GET = JniMethod("addAndGet", "(J)J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_GET_AND_ADD = JniMethod("getAndAdd", "(J)J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_DECREMENT_AND_GET = JniMethod("decrementAndGet", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_GET_AND_DECREMENT = JniMethod("getAndDecrement", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_GET_AND_SET = JniMethod("getAndSet", "(J)J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_COMPARE_AND_SET_AND_GET = JniMethod("compareAndSetAndGet", "(JJ)J", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_IS_CLOSED = JniMethod("isClosed", "()Z", false);
-            JniMethod M_PLATFORM_ATOMIC_LONG_CLOSE = JniMethod("close", "()V", false);
-
-            const char* C_PLATFORM_ATOMIC_SEQUENCE = "org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence";
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_GET = JniMethod("get", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_INCREMENT_AND_GET = JniMethod("incrementAndGet", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_GET_AND_INCREMENT = JniMethod("getAndIncrement", "()J", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_ADD_AND_GET = JniMethod("addAndGet", "(J)J", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_GET_AND_ADD = JniMethod("getAndAdd", "(J)J", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_GET_BATCH_SIZE = JniMethod("getBatchSize", "()I", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_SET_BATCH_SIZE = JniMethod("setBatchSize", "(I)V", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_IS_CLOSED = JniMethod("isClosed", "()Z", false);
-            JniMethod M_PLATFORM_ATOMIC_SEQUENCE_CLOSE = JniMethod("close", "()V", false);
-
-            const char* C_PLATFORM_ATOMIC_REFERENCE = "org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference";
-            JniMethod M_PLATFORM_ATOMIC_REFERENCE_IS_CLOSED = JniMethod("isClosed", "()Z", false);
-            JniMethod M_PLATFORM_ATOMIC_REFERENCE_CLOSE = JniMethod("close", "()V", false);
-
             const char* C_PLATFORM_LISTENABLE = "org/apache/ignite/internal/processors/platform/utils/PlatformListenable";
             JniMethod M_PLATFORM_LISTENABLE_CANCEL = JniMethod("cancel", "()Z", false);
             JniMethod M_PLATFORM_LISTENABLE_IS_CANCELED = JniMethod("isCancelled", "()Z", false);
@@ -584,78 +474,8 @@ namespace ignite
             }
 
             void JniMembers::Initialize(JNIEnv* env) {
-                c_PlatformAbstractQryCursor = FindClass(env, C_PLATFORM_ABSTRACT_QRY_CURSOR);
-                m_PlatformAbstractQryCursor_iter = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER);
-                m_PlatformAbstractQryCursor_iterHasNext = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER_HAS_NEXT);
-                m_PlatformAbstractQryCursor_close = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_CLOSE);
-
-                c_PlatformAffinity = FindClass(env, C_PLATFORM_AFFINITY);
-                m_PlatformAffinity_partitions = FindMethod(env, c_PlatformAffinity, C_PLATFORM_AFFINITY_PARTITIONS);
-
-                c_PlatformCache = FindClass(env, C_PLATFORM_CACHE);
-                m_PlatformCache_withSkipStore = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_SKIP_STORE);
-                m_PlatformCache_withNoRetries = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_NO_RETRIES);
-                m_PlatformCache_withExpiryPolicy = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_EXPIRY_PLC);
-                m_PlatformCache_withAsync = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_ASYNC);
-                m_PlatformCache_withKeepPortable = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_KEEP_PORTABLE);
-                m_PlatformCache_clear = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_CLEAR);
-                m_PlatformCache_removeAll = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_REMOVE_ALL);
-                m_PlatformCache_iterator = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_ITERATOR);
-                m_PlatformCache_localIterator = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_LOCAL_ITERATOR);
-                m_PlatformCache_enterLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_ENTER_LOCK);
-                m_PlatformCache_exitLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_EXIT_LOCK);
-                m_PlatformCache_tryEnterLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_TRY_ENTER_LOCK);
-                m_PlatformCache_closeLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_CLOSE_LOCK);
-                m_PlatformCache_rebalance = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_REBALANCE);
-                m_PlatformCache_size = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_SIZE);
-
-                c_PlatformCacheStoreCallback = FindClass(env, C_PLATFORM_CACHE_STORE_CALLBACK);
-                m_PlatformCacheStoreCallback_invoke = FindMethod(env, c_PlatformCacheStoreCallback, M_PLATFORM_CACHE_STORE_CALLBACK_INVOKE);
-
                 c_IgniteException = FindClass(env, C_IGNITE_EXCEPTION);
 
-                c_PlatformClusterGroup = FindClass(env, C_PLATFORM_CLUSTER_GRP);
-                m_PlatformClusterGroup_forOthers = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_OTHERS);
-                m_PlatformClusterGroup_forRemotes = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_REMOTES);
-                m_PlatformClusterGroup_forDaemons = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_DAEMONS);
-                m_PlatformClusterGroup_forRandom = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_RANDOM);
-                m_PlatformClusterGroup_forOldest = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_OLDEST);
-                m_PlatformClusterGroup_forYoungest = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_YOUNGEST);
-                m_PlatformClusterGroup_resetMetrics = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_RESET_METRICS);
-
-                c_PlatformCompute = FindClass(env, C_PLATFORM_COMPUTE);
-                m_PlatformCompute_withNoFailover = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_WITH_NO_FAILOVER);
-                m_PlatformCompute_withTimeout = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_WITH_TIMEOUT);
-                m_PlatformCompute_executeNative = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_EXECUTE_NATIVE);
-
-                c_PlatformContinuousQuery = FindClass(env, C_PLATFORM_CONT_QRY);
-                m_PlatformContinuousQuery_close = FindMethod(env, c_PlatformContinuousQuery, M_PLATFORM_CONT_QRY_CLOSE);
-                m_PlatformContinuousQuery_getInitialQueryCursor = FindMethod(env, c_PlatformContinuousQuery, M_PLATFORM_CONT_QRY_GET_INITIAL_QUERY_CURSOR);
-
-                c_PlatformDataStreamer = FindClass(env, C_PLATFORM_DATA_STREAMER);
-                m_PlatformDataStreamer_listenTopology = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_LISTEN_TOPOLOGY);
-                m_PlatformDataStreamer_getAllowOverwrite = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_ALLOW_OVERWRITE);
-                m_PlatformDataStreamer_setAllowOverwrite = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_ALLOW_OVERWRITE);
-                m_PlatformDataStreamer_getSkipStore = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_SKIP_STORE);
-                m_PlatformDataStreamer_setSkipStore = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_SKIP_STORE);
-                m_PlatformDataStreamer_getPerNodeBufSize = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_PER_NODE_BUFFER_SIZE);
-                m_PlatformDataStreamer_setPerNodeBufSize = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_PER_NODE_BUFFER_SIZE);
-                m_PlatformDataStreamer_getPerNodeParallelOps = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_PER_NODE_PARALLEL_OPS);
-                m_PlatformDataStreamer_setPerNodeParallelOps = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_PER_NODE_PARALLEL_OPS);
-
-                c_PlatformEvents = FindClass(env, C_PLATFORM_EVENTS);
-                m_PlatformEvents_withAsync = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_WITH_ASYNC);
-                m_PlatformEvents_stopLocalListen = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_STOP_LOCAL_LISTEN);
-                m_PlatformEvents_localListen = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_LOCAL_LISTEN);
-                m_PlatformEvents_isEnabled = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_IS_ENABLED);
-
-				c_PlatformServices = FindClass(env, C_PLATFORM_SERVICES);
-				m_PlatformServices_withAsync = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_WITH_ASYNC);
-				m_PlatformServices_withServerKeepPortable = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_WITH_SERVER_KEEP_PORTABLE);
-				m_PlatformServices_cancel = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_CANCEL);
-				m_PlatformServices_cancelAll = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_CANCEL_ALL);
-				m_PlatformServices_serviceProxy = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_SERVICE_PROXY);
-
                 c_PlatformIgnition = FindClass(env, C_PLATFORM_IGNITION);
                 m_PlatformIgnition_start = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_START);
                 m_PlatformIgnition_instance = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_INSTANCE);
@@ -663,9 +483,6 @@ namespace ignite
                 m_PlatformIgnition_stop = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_STOP);
                 m_PlatformIgnition_stopAll = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_STOP_ALL);
 
-                c_PlatformMessaging = FindClass(env, C_PLATFORM_MESSAGING);
-                m_PlatformMessaging_withAsync = FindMethod(env, c_PlatformMessaging, M_PLATFORM_MESSAGING_WITH_ASYNC);
-
                 c_PlatformProcessor = FindClass(env, C_PLATFORM_PROCESSOR);
                 m_PlatformProcessor_releaseStart = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_RELEASE_START);
                 m_PlatformProcessor_cache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CACHE);
@@ -692,6 +509,7 @@ namespace ignite
 				m_PlatformProcessor_getCacheNames = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_CACHE_NAMES);
 
                 c_PlatformTarget = FindClass(env, C_PLATFORM_TARGET);
+                m_PlatformTarget_inLongOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_LONG_OUT_LONG);
                 m_PlatformTarget_inStreamOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_LONG);
                 m_PlatformTarget_inStreamOutObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT);
                 m_PlatformTarget_outLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_LONG);
@@ -699,78 +517,29 @@ namespace ignite
                 m_PlatformTarget_outObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_OBJECT);
                 m_PlatformTarget_inStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM);
                 m_PlatformTarget_inObjectStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM);
+                m_PlatformTarget_inObjectStreamOutObjectStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM);
                 m_PlatformTarget_listenFuture = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE);
                 m_PlatformTarget_listenFutureForOperation = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION);
                 m_PlatformTarget_listenFutureAndGet = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE_AND_GET);
                 m_PlatformTarget_listenFutureForOperationAndGet = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION_AND_GET);
 
-                c_PlatformTransactions = FindClass(env, C_PLATFORM_TRANSACTIONS);
-                m_PlatformTransactions_txStart = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_START);
-                m_PlatformTransactions_txCommit = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_COMMIT);
-                m_PlatformTransactions_txRollback = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_ROLLBACK);
-                m_PlatformTransactions_txCommitAsync = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_COMMIT_ASYNC);
-                m_PlatformTransactions_txRollbackAsync = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_ROLLBACK_ASYNC);
-                m_PlatformTransactions_txState = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_STATE);
-                m_PlatformTransactions_txSetRollbackOnly = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_SET_ROLLBACK_ONLY);
-                m_PlatformTransactions_txClose = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_CLOSE);
-                m_PlatformTransactions_resetMetrics = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_RESET_METRICS);
-
                 c_PlatformUtils = FindClass(env, C_PLATFORM_UTILS);
                 m_PlatformUtils_reallocate = FindMethod(env, c_PlatformUtils, M_PLATFORM_UTILS_REALLOC);
                 m_PlatformUtils_errData = FindMethod(env, c_PlatformUtils, M_PLATFORM_UTILS_ERR_DATA);
 
-                c_PlatformAtomicLong = FindClass(env, C_PLATFORM_ATOMIC_LONG);
-                m_PlatformAtomicLong_get = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_GET);
-                m_PlatformAtomicLong_incrementAndGet = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_INCREMENT_AND_GET);
-                m_PlatformAtomicLong_getAndIncrement = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_GET_AND_INCREMENT);
-                m_PlatformAtomicLong_addAndGet = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_ADD_AND_GET);
-                m_PlatformAtomicLong_getAndAdd = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_GET_AND_ADD);
-                m_PlatformAtomicLong_decrementAndGet = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_DECREMENT_AND_GET);
-                m_PlatformAtomicLong_getAndDecrement = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_GET_AND_DECREMENT);
-                m_PlatformAtomicLong_getAndSet = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_GET_AND_SET);
-                m_PlatformAtomicLong_compareAndSetAndGet = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_COMPARE_AND_SET_AND_GET);
-                m_PlatformAtomicLong_isClosed = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_IS_CLOSED);
-                m_PlatformAtomicLong_close = FindMethod(env, c_PlatformAtomicLong, M_PLATFORM_ATOMIC_LONG_CLOSE);
-
-                jclass c_PlatformAtomicSequence = FindClass(env, C_PLATFORM_ATOMIC_SEQUENCE);
-                m_PlatformAtomicSequence_get = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_GET);
-                m_PlatformAtomicSequence_incrementAndGet = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_INCREMENT_AND_GET);
-                m_PlatformAtomicSequence_getAndIncrement = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_GET_AND_INCREMENT);
-                m_PlatformAtomicSequence_addAndGet = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_ADD_AND_GET);
-                m_PlatformAtomicSequence_getAndAdd = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_GET_AND_ADD);
-                m_PlatformAtomicSequence_getBatchSize = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_GET_BATCH_SIZE);
-                m_PlatformAtomicSequence_setBatchSize = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_SET_BATCH_SIZE);
-                m_PlatformAtomicSequence_isClosed = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_IS_CLOSED);
-                m_PlatformAtomicSequence_close = FindMethod(env, c_PlatformAtomicSequence, M_PLATFORM_ATOMIC_SEQUENCE_CLOSE);
-
-                jclass c_PlatformAtomicReference = FindClass(env, C_PLATFORM_ATOMIC_REFERENCE);
-                m_PlatformAtomicReference_isClosed = FindMethod(env, c_PlatformAtomicReference, M_PLATFORM_ATOMIC_REFERENCE_IS_CLOSED);
-                m_PlatformAtomicReference_close = FindMethod(env, c_PlatformAtomicReference, M_PLATFORM_ATOMIC_REFERENCE_CLOSE);
-
                 c_PlatformListenable = FindClass(env, C_PLATFORM_LISTENABLE);
                 m_PlatformListenable_cancel = FindMethod(env, c_PlatformListenable, M_PLATFORM_LISTENABLE_CANCEL);                    
-                m_PlatformListenable_isCancelled = FindMethod(env, c_PlatformListenable, M_PLATFORM_LISTENABLE_IS_CANCELED);
+                m_PlatformListenable_isCancelled = FindMethod(env, c_PlatformListenable, M_PLATFORM_LISTENABLE_IS_CANCELED);                    
 
                 // Find utility classes which are not used from context, but are still required in other places.
                 CheckClass(env, C_PLATFORM_NO_CALLBACK_EXCEPTION);
             }
 
             void JniMembers::Destroy(JNIEnv* env) {
-                DeleteClass(env, c_PlatformAbstractQryCursor);
-                DeleteClass(env, c_PlatformAffinity);
-                DeleteClass(env, c_PlatformCache);
-                DeleteClass(env, c_PlatformCacheStoreCallback);
                 DeleteClass(env, c_IgniteException);
-                DeleteClass(env, c_PlatformClusterGroup);
-                DeleteClass(env, c_PlatformCompute);
-                DeleteClass(env, c_PlatformContinuousQuery);
-                DeleteClass(env, c_PlatformDataStreamer);
-                DeleteClass(env, c_PlatformEvents);
                 DeleteClass(env, c_PlatformIgnition);
-                DeleteClass(env, c_PlatformMessaging);
                 DeleteClass(env, c_PlatformProcessor);
                 DeleteClass(env, c_PlatformTarget);
-                DeleteClass(env, c_PlatformTransactions);
                 DeleteClass(env, c_PlatformUtils);
             }
 
@@ -1488,6 +1257,16 @@ namespace ignite
                 ExceptionCheck(env);
             }
 
+            long long JniContext::TargetInLongOutLong(jobject obj, int opType, long long val, JniErrorInfo* err) {
+                JNIEnv* env = Attach();
+
+                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTarget_inLongOutLong, opType, val);
+
+                ExceptionCheck(env, err);
+
+                return res;
+            }
+
             long long JniContext::TargetInStreamOutLong(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
                 JNIEnv* env = Attach();
 
@@ -1524,6 +1303,16 @@ namespace ignite
                 ExceptionCheck(env, err);
             }
 
+            jobject JniContext::TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) {
+                JNIEnv* env = Attach();
+
+                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformTarget_inObjectStreamOutObjectStream, opType, arg, inMemPtr, outMemPtr);
+
+                ExceptionCheck(env, err);
+
+                return LocalToGlobal(env, res);
+            }
+
             long long JniContext::TargetOutLong(jobject obj, int opType, JniErrorInfo* err)
             {
                 JNIEnv* env = Attach();
@@ -1592,83 +1381,6 @@ namespace ignite
                 return LocalToGlobal(env, res);
             }
 
-            int JniContext::AffinityPartitions(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jint parts = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformAffinity_partitions);
-
-                ExceptionCheck(env);
-
-                return parts;
-            }
-
-            jobject JniContext::CacheWithSkipStore(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withSkipStore);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, cache);
-            }
-
-            jobject JniContext::CacheWithNoRetries(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withNoRetries);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, cache);
-            }
-
-            jobject JniContext::CacheWithExpiryPolicy(jobject obj, long long create, long long update, long long access) {
-                JNIEnv* env = Attach();
-
-                jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withExpiryPolicy,
-                    create, update, access);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, cache);
-            }
-
-            jobject JniContext::CacheWithAsync(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withAsync);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, cache);
-            }
-
-            jobject JniContext::CacheWithKeepPortable(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withKeepPortable);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, cache);
-            }
-
-            void JniContext::CacheClear(jobject obj, JniErrorInfo* err) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_clear);
-
-                ExceptionCheck(env, err);
-            }
-
-            void JniContext::CacheRemoveAll(jobject obj, JniErrorInfo* err) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_removeAll);
-
-                ExceptionCheck(env, err);
-            }
-
             jobject JniContext::CacheOutOpQueryCursor(jobject obj, int type, long long memPtr, JniErrorInfo* err) {
                 JNIEnv* env = Attach();
 
@@ -1691,932 +1403,179 @@ namespace ignite
                 return LocalToGlobal(env, res);
             }
 
-            jobject JniContext::CacheIterator(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_iterator);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, res);
-            }
-
-            jobject JniContext::CacheLocalIterator(jobject obj, int peekModes) {
-                JNIEnv*env = Attach();
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_localIterator, peekModes);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, res);
-            }
-
-            void JniContext::CacheEnterLock(jobject obj, long long id) {
+            bool JniContext::ListenableCancel(jobject obj)
+            {
                 JNIEnv* env = Attach();
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_enterLock, id);
+                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformListenable_cancel);
 
                 ExceptionCheck(env);
-            }
-
-            void JniContext::CacheExitLock(jobject obj, long long id) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_exitLock, id);
 
-                ExceptionCheck(env);
+                return res != 0;;
             }
 
-            bool JniContext::CacheTryEnterLock(jobject obj, long long id, long long timeout) {
+            bool JniContext::ListenableIsCancelled(jobject obj)
+            {
                 JNIEnv* env = Attach();
 
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformCache_tryEnterLock, id, timeout);
+                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformListenable_isCancelled);
 
                 ExceptionCheck(env);
 
-                return res != 0;
+                return res != 0;;
             }
 
-            void JniContext::CacheCloseLock(jobject obj, long long id) {
-                JNIEnv* env = Attach();
+			jobject JniContext::Acquire(jobject obj)
+            {
+                if (obj) {
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_closeLock, id);
+                    JNIEnv* env = Attach();
 
-                ExceptionCheck(env);
-            }
+                    jobject obj0 = env->NewGlobalRef(obj);
 
-            void JniContext::CacheRebalance(jobject obj, long long futId) {
-                JNIEnv* env = Attach();
+                    ExceptionCheck(env);
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_rebalance, futId);
+                    return obj0;
+                }
 
-                ExceptionCheck(env);
+                return NULL;
             }
 
-            int JniContext::CacheSize(jobject obj, int peekModes, bool loc, JniErrorInfo* err) {
-                JNIEnv* env = Attach();
-
-                jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformCache_size, peekModes, loc);
-
-                ExceptionCheck(env, err);
+            void JniContext::Release(jobject obj) {
+                if (obj)
+                {
+                    JavaVM* jvm = JVM.GetJvm();
 
-                return res;
-            }
+                    if (jvm)
+                    {
+                        JNIEnv* env;
 
-            void JniContext::CacheStoreCallbackInvoke(jobject obj, long long memPtr) {
-                JNIEnv* env = Attach();
+                        jint attachRes = jvm->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCacheStoreCallback_invoke, memPtr);
+                        if (attachRes == JNI_OK)
+                        {
+                            AttachHelper::OnThreadAttach();
 
-                ExceptionCheck(env);
+                            env->DeleteGlobalRef(obj);
+                        }
+                    }
+                }
             }
 
-            void JniContext::ComputeWithNoFailover(jobject obj) {
+            void JniContext::ThrowToJava(char* msg) {
                 JNIEnv* env = Attach();
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCompute_withNoFailover);
-
-                ExceptionCheck(env);
+                env->ThrowNew(jvm->GetMembers().c_IgniteException, msg);
             }
 
-            void JniContext::ComputeWithTimeout(jobject obj, long long timeout) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCompute_withTimeout, timeout);
-
-                ExceptionCheck(env);
+            void JniContext::DestroyJvm() {
+                jvm->GetJvm()->DestroyJavaVM();
             }
 
-            void* JniContext::ComputeExecuteNative(jobject obj, long long taskPtr, long long topVer) {
-                JNIEnv* env = Attach();
+            /**
+             * Attach thread to JVM.
+             */
+            JNIEnv* JniContext::Attach() {
+                JNIEnv* env;
 
-                jobject res = env->CallObjectMethod(obj,
-                    jvm->GetMembers().m_PlatformCompute_executeNative, taskPtr, topVer);
+                jint attachRes = jvm->GetJvm()->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
 
-                ExceptionCheck(env);
+                if (attachRes == JNI_OK)
+                    AttachHelper::OnThreadAttach();
+                else {
+                    if (hnds.error)
+                        hnds.error(hnds.target, IGNITE_JNI_ERR_JVM_ATTACH, NULL, 0, NULL, 0, NULL, 0);
+                }
 
-                return LocalToGlobal(env, res);
+                return env;
             }
 
-            void JniContext::ContinuousQueryClose(jobject obj) {
-                JNIEnv* env = Attach();
+            void JniContext::ExceptionCheck(JNIEnv* env) {
+                ExceptionCheck(env, NULL);
+            }
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformContinuousQuery_close);
+            void JniContext::ExceptionCheck(JNIEnv* env, JniErrorInfo* errInfo)
+            {
+                if (env->ExceptionCheck()) {
+                    jthrowable err = env->ExceptionOccurred();
 
-                ExceptionCheck(env);
-            }
+                    if (PRINT_EXCEPTION)
+                        env->CallVoidMethod(err, jvm->GetJavaMembers().m_Throwable_printStackTrace);
 
-            jobject JniContext::ContinuousQueryGetInitialQueryCursor(jobject obj) {
-                JNIEnv* env = Attach();
+                    env->ExceptionClear();
 
-                jobject res = env->CallObjectMethod(obj,
-                    jvm->GetMembers().m_PlatformContinuousQuery_getInitialQueryCursor);
+                    // Get error class name and message.
+                    jclass cls = env->GetObjectClass(err);
 
-                ExceptionCheck(env);
+                    jstring clsName = static_cast<jstring>(env->CallObjectMethod(cls, jvm->GetJavaMembers().m_Class_getName));
+                    jstring msg = static_cast<jstring>(env->CallObjectMethod(err, jvm->GetJavaMembers().m_Throwable_getMessage));
 
-                return LocalToGlobal(env,  res);
-            }
+                    env->DeleteLocalRef(cls);
 
-            void JniContext::DataStreamerListenTopology(jobject obj, long long ptr) {
-                JNIEnv* env = Attach();
+                    int clsNameLen;
+                    std::string clsName0 = JavaStringToCString(env, clsName, &clsNameLen);
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_listenTopology, ptr);
+                    int msgLen;
+                    std::string msg0 = JavaStringToCString(env, msg, &msgLen);
 
-                ExceptionCheck(env);
-            }
+                    if (errInfo)
+                    {
+                        JniErrorInfo errInfo0(IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), msg0.c_str());
 
-            bool JniContext::DataStreamerAllowOverwriteGet(jobject obj) {
-                JNIEnv* env = Attach();
+                        *errInfo = errInfo0;
+                    }
 
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getAllowOverwrite);
+                    // Get error additional data (if any).
+                    jbyteArray errData = static_cast<jbyteArray>(env->CallStaticObjectMethod(
+                        jvm->GetMembers().c_PlatformUtils, jvm->GetMembers().m_PlatformUtils_errData, err));
 
-                ExceptionCheck(env);
+                    if (errData)
+                    {
+                        jbyte* errBytesNative = env->GetByteArrayElements(errData, NULL);
 
-                return res != 0;
-            }
+                        int errBytesLen = env->GetArrayLength(errData);
 
-            void JniContext::DataStreamerAllowOverwriteSet(jobject obj, bool val) {
-                JNIEnv* env = Attach();
+                        if (hnds.error)
+                            hnds.error(hnds.target, IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), clsNameLen, msg0.c_str(), msgLen,
+                                errBytesNative, errBytesLen);
 
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setAllowOverwrite, val);
+                        env->ReleaseByteArrayElements(errData, errBytesNative, JNI_ABORT);
+                    }
+                    else
+                    {
+                        if (hnds.error)
+                            hnds.error(hnds.target, IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), clsNameLen, msg0.c_str(), msgLen,
+                                NULL, 0);
+                    }
 
-                ExceptionCheck(env);
+                    env->DeleteLocalRef(err);
+                }
             }
 
-            bool JniContext::DataStreamerSkipStoreGet(jobject obj) {
-                JNIEnv* env = Attach();
+            /**
+             * Convert local reference to global.
+             */
+            jobject JniContext::LocalToGlobal(JNIEnv* env, jobject localRef) {
+                if (localRef) {
+                    jobject globalRef = env->NewGlobalRef(localRef);
 
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getSkipStore);
+                    env->DeleteLocalRef(localRef); // Clear local ref irrespective of result.
 
-                ExceptionCheck(env);
+                    if (!globalRef)
+                        ExceptionCheck(env);
 
-                return res != 0;
+                    return globalRef;
+                }
+                else
+                    return NULL;
             }
 
-            void JniContext::DataStreamerSkipStoreSet(jobject obj, bool val) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setSkipStore, val);
+            JNIEXPORT jlong JNICALL JniCacheStoreCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr) {
+                IGNITE_SAFE_FUNC(env, envPtr, CacheStoreCreateHandler, cacheStoreCreate, memPtr);
+            }
 
-                ExceptionCheck(env);
-            }
-
-            int JniContext::DataStreamerPerNodeBufferSizeGet(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getPerNodeBufSize);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            void JniContext::DataStreamerPerNodeBufferSizeSet(jobject obj, int val) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setPerNodeBufSize, val);
-
-                ExceptionCheck(env);
-            }
-
-            int JniContext::DataStreamerPerNodeParallelOperationsGet(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getPerNodeParallelOps);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            void JniContext::DataStreamerPerNodeParallelOperationsSet(jobject obj, int val) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setPerNodeParallelOps, val);
-
-                ExceptionCheck(env);
-            }
-
-            jobject JniContext::MessagingWithAsync(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject msg = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformMessaging_withAsync);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, msg);
-            }
-
-            jobject JniContext::ProjectionForOthers(jobject obj, jobject prj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forOthers, prj);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            jobject JniContext::ProjectionForRemotes(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forRemotes);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            jobject JniContext::ProjectionForDaemons(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forDaemons);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            jobject JniContext::ProjectionForRandom(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forRandom);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            jobject JniContext::ProjectionForOldest(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forOldest);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            jobject JniContext::ProjectionForYoungest(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forYoungest);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, newPrj);
-            }
-
-            void JniContext::ProjectionResetMetrics(jobject obj) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_resetMetrics);
-
-                ExceptionCheck(env);
-            }
-
-            jobject JniContext::ProjectionOutOpRet(jobject obj, int type, long long memPtr) {
-                JNIEnv* env = Attach();
-
-                jobject res = env->CallObjectMethod(
-                    obj, jvm->GetMembers().m_PlatformTarget_inStreamOutObject, type, memPtr);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, res);
-            }
-
-
-            void JniContext::QueryCursorIterator(jobject obj, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_iter);
-
-                ExceptionCheck(env, errInfo);
-            }
-
-            bool JniContext::QueryCursorIteratorHasNext(jobject obj, JniErrorInfo* errInfo)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_iterHasNext);
-
-                ExceptionCheck(env, errInfo);
-
-                return res != 0;
-            }
-
-            void JniContext::QueryCursorClose(jobject obj, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_close);
-
-                ExceptionCheck(env, errInfo);
-            }
-
-            long long JniContext::TransactionsStart(jobject obj, int concurrency,
-                int isolation, long long timeout, int txSize, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                long long id = env->CallLongMethod(obj,
-                    jvm->GetMembers().m_PlatformTransactions_txStart,
-                    concurrency, isolation, timeout, txSize);
-
-                ExceptionCheck(env, errInfo);
-
-                return id;
-            }
-
-            int JniContext::TransactionsCommit(jobject obj, long long id, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                int res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txCommit, id);
-
-                ExceptionCheck(env, errInfo);
-
-                return res;
-            }
-
-            void JniContext::TransactionsCommitAsync(jobject obj, long long id, long long futId) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_txCommitAsync, id, futId);
-
-                ExceptionCheck(env);
-            }
-
-            int JniContext::TransactionsRollback(jobject obj, long long id, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                int res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txRollback, id);
-
-                ExceptionCheck(env, errInfo);
-
-                return res;
-            }
-
-            void JniContext::TransactionsRollbackAsync(jobject obj, long long id, long long futId) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_txRollbackAsync, id, futId);
-
-                ExceptionCheck(env);
-            }
-
-            int JniContext::TransactionsClose(jobject obj, long long id, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                jint state = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txClose, id);
-
-                ExceptionCheck(env, errInfo);
-
-                return state;
-            }
-
-            int JniContext::TransactionsState(jobject obj, long long id, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                jint state = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txState, id);
-
-                ExceptionCheck(env, errInfo);
-
-                return state;
-            }
-
-            bool JniContext::TransactionsSetRollbackOnly(jobject obj, long long id, JniErrorInfo* errInfo) {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformTransactions_txSetRollbackOnly, id);
-
-                ExceptionCheck(env, errInfo);
-
-                return res != 0;
-            }
-
-            void JniContext::TransactionsResetMetrics(jobject obj) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_resetMetrics);
-
-                ExceptionCheck(env);
-            }
-
-            jobject JniContext::EventsWithAsync(jobject obj) {
-                JNIEnv * env = Attach();
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformEvents_withAsync);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, res);
-            }
-
-            bool JniContext::EventsStopLocalListen(jobject obj, long long hnd) {
-                JNIEnv * env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformEvents_stopLocalListen, hnd);
-
-                ExceptionCheck(env);
-
-                return res != 0;
-            }
-
-            void JniContext::EventsLocalListen(jobject obj, long long hnd, int type) {
-                JNIEnv * env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformEvents_localListen, hnd, type);
-
-                ExceptionCheck(env);
-            }
-
-            bool JniContext::EventsIsEnabled(jobject obj, int type) {
-                JNIEnv * env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformEvents_isEnabled, type);
-
-                ExceptionCheck(env);
-
-                return res != 0;
-            }
-
-			jobject JniContext::ServicesWithAsync(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformServices_withAsync);
-
-				ExceptionCheck(env);
-
-				return LocalToGlobal(env, res);
-            }
-
-            jobject JniContext::ServicesWithServerKeepPortable(jobject obj) {
-                JNIEnv* env = Attach();
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformServices_withServerKeepPortable);
-
-                ExceptionCheck(env);
-
-                return LocalToGlobal(env, res);
-            }
-
-			void JniContext::ServicesCancel(jobject obj, char* name) {
-                JNIEnv* env = Attach();
-
-				jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformServices_cancel, name0);
-
-				if (name0)
-					env->DeleteLocalRef(name0);
-
-				ExceptionCheck(env);
-            }
-
-			void JniContext::ServicesCancelAll(jobject obj) {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformServices_cancelAll);
-
-				ExceptionCheck(env);
-            }
-
-			void* JniContext::ServicesGetServiceProxy(jobject obj, char* name, bool sticky) {
-				JNIEnv* env = Attach();
-
-				jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
-                jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformServices_serviceProxy, name0, sticky);
-
-				if (name0)
-					env->DeleteLocalRef(name0);
-
-				ExceptionCheck(env);
-
-				return LocalToGlobal(env, res);;
-			}
-
-            long long JniContext::AtomicLongGet(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_get);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongIncrementAndGet(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_incrementAndGet);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongGetAndIncrement(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_getAndIncrement);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongAddAndGet(jobject obj, long long value)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_addAndGet, value);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongGetAndAdd(jobject obj, long long value)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_getAndAdd, value);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongDecrementAndGet(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_decrementAndGet);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongGetAndDecrement(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_getAndDecrement);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongGetAndSet(jobject obj, long long value)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_getAndSet, value);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicLongCompareAndSetAndGet(jobject obj, long long expVal, long long newVal)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_compareAndSetAndGet, expVal, newVal);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            bool JniContext::AtomicLongIsClosed(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_isClosed);
-
-                ExceptionCheck(env);
-
-                return res != 0;;
-            }
-
-            void JniContext::AtomicLongClose(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAtomicLong_close);
-
-                ExceptionCheck(env);
-            }
-
-            long long JniContext::AtomicSequenceGet(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_get);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicSequenceIncrementAndGet(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_incrementAndGet);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicSequenceGetAndIncrement(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_getAndIncrement);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicSequenceAddAndGet(jobject obj, long long l)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_addAndGet, l);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            long long JniContext::AtomicSequenceGetAndAdd(jobject obj, long long l)
-            {
-                JNIEnv* env = Attach();
-
-                long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_getAndAdd, l);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            int JniContext::AtomicSequenceGetBatchSize(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                int res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_getBatchSize);
-
-                ExceptionCheck(env);
-
-                return res;
-            }
-
-            void JniContext::AtomicSequenceSetBatchSize(jobject obj, int size)
-            {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_setBatchSize, size);
-
-                ExceptionCheck(env);
-            }
-
-            bool JniContext::AtomicSequenceIsClosed(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_isClosed);
-
-                ExceptionCheck(env);
-
-                return res != 0;
-            }
-
-            void JniContext::AtomicSequenceClose(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAtomicSequence_close);
-
-                ExceptionCheck(env);
-            }
-
-            bool JniContext::AtomicReferenceIsClosed(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformAtomicReference_isClosed);
-
-                ExceptionCheck(env);
-
-                return res != 0;
-            }
-
-            void JniContext::AtomicReferenceClose(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAtomicReference_close);
-
-                ExceptionCheck(env);
-            }
-
-            bool JniContext::ListenableCancel(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformListenable_cancel);
-
-                ExceptionCheck(env);
-
-                return res != 0;;
-            }
-
-            bool JniContext::ListenableIsCancelled(jobject obj)
-            {
-                JNIEnv* env = Attach();
-
-                jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformListenable_isCancelled);
-
-                ExceptionCheck(env);
-
-                return res != 0;;
-            }
-
-			jobject JniContext::Acquire(jobject obj)
-            {
-                if (obj) {
-
-                    JNIEnv* env = Attach();
-
-                    jobject obj0 = env->NewGlobalRef(obj);
-
-                    ExceptionCheck(env);
-
-                    return obj0;
-                }
-
-                return NULL;
-            }
-
-            void JniContext::Release(jobject obj) {
-                if (obj)
-                {
-                    JavaVM* jvm = JVM.GetJvm();
-
-                    if (jvm)
-                    {
-                        JNIEnv* env;
-
-                        jint attachRes = jvm->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
-
-                        if (attachRes == JNI_OK)
-                        {
-                            AttachHelper::OnThreadAttach();
-
-                            env->DeleteGlobalRef(obj);
-                        }
-                    }
-                }
-            }
-
-            void JniContext::ThrowToJava(char* msg) {
-                JNIEnv* env = Attach();
-
-                env->ThrowNew(jvm->GetMembers().c_IgniteException, msg);
-            }
-
-            void JniContext::DestroyJvm() {
-                jvm->GetJvm()->DestroyJavaVM();
-            }
-
-            /**
-             * Attach thread to JVM.
-             */
-            JNIEnv* JniContext::Attach() {
-                JNIEnv* env;
-
-                jint attachRes = jvm->GetJvm()->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
-
-                if (attachRes == JNI_OK)
-                    AttachHelper::OnThreadAttach();
-                else {
-                    if (hnds.error)
-                        hnds.error(hnds.target, IGNITE_JNI_ERR_JVM_ATTACH, NULL, 0, NULL, 0, NULL, 0);
-                }
-
-                return env;
-            }
-
-            void JniContext::ExceptionCheck(JNIEnv* env) {
-                ExceptionCheck(env, NULL);
-            }
-
-            void JniContext::ExceptionCheck(JNIEnv* env, JniErrorInfo* errInfo)
-            {
-                if (env->ExceptionCheck()) {
-                    jthrowable err = env->ExceptionOccurred();
-
-                    if (PRINT_EXCEPTION)
-                        env->CallVoidMethod(err, jvm->GetJavaMembers().m_Throwable_printStackTrace);
-
-                    env->ExceptionClear();
-
-                    // Get error class name and message.
-                    jclass cls = env->GetObjectClass(err);
-
-                    jstring clsName = static_cast<jstring>(env->CallObjectMethod(cls, jvm->GetJavaMembers().m_Class_getName));
-                    jstring msg = static_cast<jstring>(env->CallObjectMethod(err, jvm->GetJavaMembers().m_Throwable_getMessage));
-
-                    env->DeleteLocalRef(cls);
-
-                    int clsNameLen;
-                    std::string clsName0 = JavaStringToCString(env, clsName, &clsNameLen);
-
-                    int msgLen;
-                    std::string msg0 = JavaStringToCString(env, msg, &msgLen);
-
-                    if (errInfo)
-                    {
-                        JniErrorInfo errInfo0(IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), msg0.c_str());
-
-                        *errInfo = errInfo0;
-                    }
-
-                    // Get error additional data (if any).
-                    jbyteArray errData = static_cast<jbyteArray>(env->CallStaticObjectMethod(
-                        jvm->GetMembers().c_PlatformUtils, jvm->GetMembers().m_PlatformUtils_errData, err));
-
-                    if (errData)
-                    {
-                        jbyte* errBytesNative = env->GetByteArrayElements(errData, NULL);
-
-                        int errBytesLen = env->GetArrayLength(errData);
-
-                        if (hnds.error)
-                            hnds.error(hnds.target, IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), clsNameLen, msg0.c_str(), msgLen,
-                                errBytesNative, errBytesLen);
-
-                        env->ReleaseByteArrayElements(errData, errBytesNative, JNI_ABORT);
-                    }
-                    else
-                    {
-                        if (hnds.error)
-                            hnds.error(hnds.target, IGNITE_JNI_ERR_GENERIC, clsName0.c_str(), clsNameLen, msg0.c_str(), msgLen,
-                                NULL, 0);
-                    }
-
-                    env->DeleteLocalRef(err);
-                }
-            }
-
-            /**
-             * Convert local reference to global.
-             */
-            jobject JniContext::LocalToGlobal(JNIEnv* env, jobject localRef) {
-                if (localRef) {
-                    jobject globalRef = env->NewGlobalRef(localRef);
-
-                    env->DeleteLocalRef(localRef); // Clear local ref irrespective of result.
-
-                    if (!globalRef)
-                        ExceptionCheck(env);
-
-                    return globalRef;
-                }
-                else
-                    return NULL;
-            }
-
-            JNIEXPORT jlong JNICALL JniCacheStoreCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr) {
-                IGNITE_SAFE_FUNC(env, envPtr, CacheStoreCreateHandler, cacheStoreCreate, memPtr);
-            }
-
-            JNIEXPORT jint JNICALL JniCacheStoreInvoke(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr, jlong memPtr, jobject cb) {
-                if (cb)
-                {
-                    jobject cb0 = env->NewGlobalRef(cb);
-
-                    if (cb0)
-                    {
-                        JniGlobalRefGuard guard(env, cb0);
-
-                        IGNITE_SAFE_FUNC(env, envPtr, CacheStoreInvokeHandler, cacheStoreInvoke, objPtr, memPtr, cb0);
-                    }
-                    else
-                        return 0;
-                }
-                else {
-                    IGNITE_SAFE_FUNC(env, envPtr, CacheStoreInvokeHandler, cacheStoreInvoke, objPtr, memPtr, NULL);
-                }
+            JNIEXPORT jint JNICALL JniCacheStoreInvoke(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr, jlong memPtr) {
+                IGNITE_SAFE_FUNC(env, envPtr, CacheStoreInvokeHandler, cacheStoreInvoke, objPtr, memPtr);
             }
 
             JNIEXPORT void JNICALL JniCacheStoreDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 62dc2df..e8448eb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -1889,6 +1889,50 @@ namespace Apache.Ignite.Core.Tests.Cache
             }, threads);
         }
 
+        /// <summary>
+        /// Simple cache lock test (while <see cref="TestLock"/> is ignored).
+        /// </summary>
+        [Test]
+        public void TestLockSimple()
+        {
+            if (!LockingEnabled())
+                return;
+
+            var cache = Cache();
+
+            const int key = 7;
+
+            Action<ICacheLock> checkLock = lck =>
+            {
+                using (lck)
+                {
+                    Assert.Throws<InvalidOperationException>(lck.Exit); // can't exit if not entered
+
+                    lck.Enter();
+
+                    Assert.IsTrue(cache.IsLocalLocked(key, true));
+                    Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+                    lck.Exit();
+
+                    Assert.IsFalse(cache.IsLocalLocked(key, true));
+                    Assert.IsFalse(cache.IsLocalLocked(key, false));
+
+                    Assert.IsTrue(lck.TryEnter());
+
+                    Assert.IsTrue(cache.IsLocalLocked(key, true));
+                    Assert.IsTrue(cache.IsLocalLocked(key, false));
+
+                    lck.Exit();
+                }
+
+                Assert.Throws<ObjectDisposedException>(lck.Enter); // Can't enter disposed lock
+            };
+
+            checkLock(cache.Lock(key));
+            checkLock(cache.LockAll(new[] { key, 1, 2, 3 }));
+        }
+
         [Test]
         [Ignore("IGNITE-835")]
         public void TestLock()

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
index 3269651..2d38c72 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
@@ -322,6 +322,7 @@ namespace Apache.Ignite.Core.Tests.Services
 
             // .. but setter does not
             var ex = Assert.Throws<ServiceInvocationException>(() => { prx.TestProperty = new object(); });
+            Assert.IsNotNull(ex.InnerException);
             Assert.AreEqual("Object of type 'System.Object' cannot be converted to type 'System.Int32'.",
                 ex.InnerException.Message);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 823f9f2..667f807 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -166,6 +166,7 @@
     <Compile Include="Common\Package-Info.cs" />
     <Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
     <Compile Include="Impl\Cache\Affinity\AffinityFunctionBase.cs" />
+    <Compile Include="Impl\Cache\ICacheLockInternal.cs" />
     <Compile Include="Impl\Common\Platform.cs" />
     <Compile Include="Impl\Cache\Affinity\AffinityFunctionSerializer.cs" />
     <Compile Include="Impl\Cache\Affinity\PlatformAffinityFunction.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
index 00e13c5..4ff1f2e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
@@ -76,6 +76,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         private const int OpPrimaryPartitions = 14;
 
         /** */
+        private const int OpPartitions = 15;
+
+        /** */
         private readonly bool _keepBinary;
         
         /** Grid. */
@@ -101,7 +104,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** <inheritDoc /> */
         public int Partitions
         {
-            get { return UU.AffinityPartitions(Target); }
+            get { return (int) DoOutOp(OpPartitions); }
         }
 
         /** <inheritDoc /> */

http://git-wip-us.apache.org/repos/asf/ignite/blob/eaf8ae24/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 8a25a2c..3a82932 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -41,7 +41,7 @@ namespace Apache.Ignite.Core.Impl.Cache
     /// Native cache wrapper.
     /// </summary>
     [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
-    internal class CacheImpl<TK, TV> : PlatformTarget, ICache<TK, TV>, ICacheInternal
+    internal class CacheImpl<TK, TV> : PlatformTarget, ICache<TK, TV>, ICacheInternal, ICacheLockInternal
     {
         /** Duration: unchanged. */
         private const long DurUnchanged = -2;
@@ -89,20 +89,18 @@ namespace Apache.Ignite.Core.Impl.Cache
             _flagAsync = flagAsync;
             _flagNoRetries = flagNoRetries;
 
-            _asyncInstance = new Lazy<CacheImpl<TK, TV>>(() => new CacheImpl<TK, TV>(this));
+            _asyncInstance = new Lazy<CacheImpl<TK, TV>>(WithAsync);
         }
 
         /// <summary>
-        /// Initializes a new async instance.
+        /// Returns an instance with async mode enabled.
         /// </summary>
-        /// <param name="cache">The cache.</param>
-        private CacheImpl(CacheImpl<TK, TV> cache) : base(UU.CacheWithAsync(cache.Target), cache.Marshaller)
+        private CacheImpl<TK, TV> WithAsync()
         {
-            _ignite = cache._ignite;
-            _flagSkipStore = cache._flagSkipStore;
-            _flagKeepBinary = cache._flagKeepBinary;
-            _flagAsync = true;
-            _flagNoRetries = cache._flagNoRetries;
+            var target = DoOutOpObject((int) CacheOp.WithAsync);
+
+            return new CacheImpl<TK, TV>(_ignite, target, Marshaller, _flagSkipStore, _flagKeepBinary, 
+                true, _flagNoRetries);
         }
 
         /** <inheritDoc /> */
@@ -170,7 +168,7 @@ namespace Apache.Ignite.Core.Impl.Cache
             if (_flagSkipStore)
                 return this;
 
-            return new CacheImpl<TK, TV>(_ignite, UU.CacheWithSkipStore(Target), Marshaller, 
+            return new CacheImpl<TK, TV>(_ignite, DoOutOpObject((int) CacheOp.WithSkipStore), Marshaller,
                 true, _flagKeepBinary, _flagAsync, true);
         }
 
@@ -194,7 +192,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 return result;
             }
 
-            return new CacheImpl<TK1, TV1>(_ignite, UU.CacheWithKeepBinary(Target), Marshaller, 
+            return new CacheImpl<TK1, TV1>(_ignite, DoOutOpObject((int) CacheOp.WithKeepBinary), Marshaller,
                 _flagSkipStore, true, _flagAsync, _flagNoRetries);
         }
 
@@ -207,7 +205,12 @@ namespace Apache.Ignite.Core.Impl.Cache
             long update = ConvertDuration(plc.GetExpiryForUpdate());
             long access = ConvertDuration(plc.GetExpiryForAccess());
 
-            IUnmanagedTarget cache0 = UU.CacheWithExpiryPolicy(Target, create, update, access);
+            IUnmanagedTarget cache0 = DoOutOpObject((int)CacheOp.WithExpiryPolicy, w =>
+            {
+                w.WriteLong(create);
+                w.WriteLong(update);
+                w.WriteLong(access);
+            });
 
             return new CacheImpl<TK, TV>(_ignite, cache0, Marshaller, _flagSkipStore, _flagKeepBinary, _flagAsync, _flagNoRetries);
         }
@@ -637,7 +640,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** <inheritdoc /> */
         public void Clear()
         {
-            UU.CacheClear(Target);
+            DoOutOp((int) CacheOp.ClearCache);
         }
 
         /** <inheritDoc /> */
@@ -749,7 +752,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** <inheritDoc /> */
         public void RemoveAll()
         {
-            UU.CacheRemoveAll(Target);
+            DoOutOp((int) CacheOp.RemoveAll2);
         }
 
         /** <inheritDoc /> */
@@ -788,9 +791,11 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <returns>Size.</returns>
         private int Size0(bool loc, params CachePeekMode[] modes)
         {
-            int modes0 = EncodePeekModes(modes);
+            var modes0 = EncodePeekModes(modes);
 
-            return UU.CacheSize(Target, modes0, loc);
+            var op = loc ? CacheOp.SizeLoc : CacheOp.Size;
+
+            return (int) DoOutInOpLong((int) op, modes0);
         }
 
         /** <inheritDoc /> */
@@ -871,10 +876,10 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             IgniteArgumentCheck.NotNull(key, "key");
 
-            return DoOutInOp((int)CacheOp.Lock, writer =>
+            return DoOutInOp((int) CacheOp.Lock, writer =>
             {
                 writer.Write(key);
-            }, input => new CacheLock(input.ReadInt(), Target));
+            }, input => new CacheLock(input.ReadInt(), this));
         }
 
         /** <inheritdoc /> */
@@ -882,10 +887,10 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             IgniteArgumentCheck.NotNull(keys, "keys");
 
-            return DoOutInOp((int)CacheOp.LockAll, writer =>
+            return DoOutInOp((int) CacheOp.LockAll, writer =>
             {
                 WriteEnumerable(writer, keys);
-            }, input => new CacheLock(input.ReadInt(), Target));
+            }, input => new CacheLock(input.ReadInt(), this));
         }
 
         /** <inheritdoc /> */
@@ -914,7 +919,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** <inheritDoc /> */
         public Task Rebalance()
         {
-            return GetFuture<object>((futId, futTyp) => UU.CacheRebalance(Target, futId)).Task;
+            return GetFuture<object>((futId, futTyp) => DoOutInOpLong((int) CacheOp.Rebalance, futId)).Task;
         }
 
         /** <inheritDoc /> */
@@ -923,7 +928,7 @@ namespace Apache.Ignite.Core.Impl.Cache
             if (_flagNoRetries)
                 return this;
 
-            return new CacheImpl<TK, TV>(_ignite, UU.CacheWithNoRetries(Target), Marshaller,
+            return new CacheImpl<TK, TV>(_ignite, DoOutOpObject((int) CacheOp.WithNoRetries), Marshaller,
                 _flagSkipStore, _flagKeepBinary, _flagAsync, true);
         }
 
@@ -965,22 +970,14 @@ namespace Apache.Ignite.Core.Impl.Cache
             if (string.IsNullOrEmpty(qry.Sql))
                 throw new ArgumentException("Sql cannot be null or empty");
 
-            IUnmanagedTarget cursor;
-
-            using (var stream = IgniteManager.Memory.Allocate().GetStream())
+            var cursor = DoOutOpObject((int) CacheOp.QrySqlFields, writer =>
             {
-                var writer = Marshaller.StartMarshal(stream);
-
                 writer.WriteBoolean(qry.Local);
                 writer.WriteString(qry.Sql);
                 writer.WriteInt(qry.PageSize);
 
                 WriteQueryArgs(writer, qry.Arguments);
-
-                FinishMarshal(writer);
-
-                cursor = UU.CacheOutOpQueryCursor(Target, (int) CacheOp.QrySqlFields, stream.SynchronizeOutput());
-            }
+            });
         
             return new FieldsQueryCursor<T>(cursor, Marshaller, _flagKeepBinary, readerFunc);
         }
@@ -990,18 +987,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             IgniteArgumentCheck.NotNull(qry, "qry");
 
-            IUnmanagedTarget cursor;
-
-            using (var stream = IgniteManager.Memory.Allocate().GetStream())
-            {
-                var writer = Marshaller.StartMarshal(stream);
-
-                qry.Write(writer, IsKeepBinary);
-
-                FinishMarshal(writer);
-
-                cursor = UU.CacheOutOpQueryCursor(Target, (int)qry.OpId, stream.SynchronizeOutput()); 
-            }
+            var cursor = DoOutOpObject((int) qry.OpId, writer => qry.Write(writer, IsKeepBinary));
 
             return new QueryCursor<TK, TV>(cursor, Marshaller, _flagKeepBinary);
         }
@@ -1058,41 +1044,8 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             qry.Validate();
 
-            var hnd = new ContinuousQueryHandleImpl<TK, TV>(qry, Marshaller, _flagKeepBinary);
-
-            try
-            {
-                using (var stream = IgniteManager.Memory.Allocate().GetStream())
-                {
-                    var writer = Marshaller.StartMarshal(stream);
-
-                    hnd.Start(_ignite, writer, () =>
-                    {
-                        if (initialQry != null)
-                        {
-                            writer.WriteInt((int) initialQry.OpId);
-
-                            initialQry.Write(writer, IsKeepBinary);
-                        }
-                        else
-                            writer.WriteInt(-1); // no initial query
-
-                        FinishMarshal(writer);
-
-                        // ReSharper disable once AccessToDisposedClosure
-                        return UU.CacheOutOpContinuousQuery(Target, (int) CacheOp.QryContinuous,
-                            stream.SynchronizeOutput());
-                    }, qry);
-                }
-
-                return hnd;
-            }
-            catch (Exception)
-            {
-                hnd.Dispose();
-
-                throw;
-            }
+            return new ContinuousQueryHandleImpl<TK, TV>(qry, Marshaller, _flagKeepBinary,
+                writeAction => DoOutOpObject((int) CacheOp.QryContinuous, writeAction), initialQry);
         }
 
         #endregion
@@ -1126,9 +1079,13 @@ namespace Apache.Ignite.Core.Impl.Cache
         internal CacheEnumerator<TK, TV> CreateEnumerator(bool loc, int peekModes)
         {
             if (loc)
-                return new CacheEnumerator<TK, TV>(UU.CacheLocalIterator(Target, peekModes), Marshaller, _flagKeepBinary);
+            {
+                var target = DoOutOpObject((int) CacheOp.LocIterator, w => w.WriteInt(peekModes));
 
-            return new CacheEnumerator<TK, TV>(UU.CacheIterator(Target), Marshaller, _flagKeepBinary);
+                return new CacheEnumerator<TK, TV>(target, Marshaller, _flagKeepBinary);
+            }
+
+            return new CacheEnumerator<TK, TV>(DoOutOpObject((int) CacheOp.Iterator), Marshaller, _flagKeepBinary);
         }
 
         #endregion
@@ -1312,5 +1269,33 @@ namespace Apache.Ignite.Core.Impl.Cache
                 ? new CacheResult<TR>()
                 : new CacheResult<TR>((TR)res);
         }
+
+        /** <inheritdoc /> */
+        public void Enter(long id)
+        {
+            DoOutInOpLong((int) CacheOp.EnterLock, id);
+        }
+
+        /** <inheritdoc /> */
+        public bool TryEnter(long id, TimeSpan timeout)
+        {
+            return DoOutOp((int) CacheOp.TryEnterLock, (IBinaryStream s) =>
+                   {
+                       s.WriteLong(id);
+                       s.WriteLong((long) timeout.TotalMilliseconds);
+                   }) == True;
+        }
+
+        /** <inheritdoc /> */
+        public void Exit(long id)
+        {
+            DoOutInOpLong((int) CacheOp.ExitLock, id);
+        }
+
+        /** <inheritdoc /> */
+        public void Close(long id)
+        {
+            DoOutInOpLong((int) CacheOp.CloseLock, id);
+        }
     }
 }


Mime
View raw message