http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/src/exports.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp index 2aecd59..9b7defd 100644 --- a/modules/platforms/cpp/jni/src/exports.cpp +++ b/modules/platforms/cpp/jni/src/exports.cpp @@ -26,12 +26,8 @@ extern "C" { return gcj::JniContext::Reallocate(memPtr, cap); } - void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) { - return ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr); - } - - void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name) { - return ctx->IgnitionInstance(name); + void IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) { + ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr); } long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name) { @@ -46,118 +42,10 @@ extern "C" { return ctx->IgnitionStopAll(cancel); } - void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj) { - return ctx->ProcessorReleaseStart(static_cast<jobject>(obj)); - } - - void* IGNITE_CALL IgniteProcessorProjection(gcj::JniContext* ctx, void* obj) { - return ctx->ProcessorProjection(static_cast<jobject>(obj)); - } - - void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name) { - return ctx->ProcessorCache(static_cast<jobject>(obj), name); - } - - void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name) { - return ctx->ProcessorCreateCache(static_cast<jobject>(obj), name); - } - - void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name) { - return ctx->ProcessorGetOrCreateCache(static_cast<jobject>(obj), name); - } - - void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) { - return ctx->ProcessorCreateCacheFromConfig(static_cast<jobject>(obj), memPtr); - } - - void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) { - return ctx->ProcessorGetOrCreateCacheFromConfig(static_cast<jobject>(obj), memPtr); - } - - void* IGNITE_CALL IgniteProcessorCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr) { - return ctx->ProcessorCreateNearCache(static_cast<jobject>(obj), name, memPtr); - } - - void* IGNITE_CALL IgniteProcessorGetOrCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr) { - return ctx->ProcessorGetOrCreateNearCache(static_cast<jobject>(obj), name, memPtr); - } - - void IGNITE_CALL IgniteProcessorDestroyCache(gcj::JniContext* ctx, void* obj, char* name) { - ctx->ProcessorDestroyCache(static_cast<jobject>(obj), name); - } - - void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name) { - return ctx->ProcessorAffinity(static_cast<jobject>(obj), name); - } - - void*IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable) { - return ctx->ProcessorDataStreamer(static_cast<jobject>(obj), name, keepPortable); - } - - void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj) { - return ctx->ProcessorTransactions(static_cast<jobject>(obj)); - } - - void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj) { - return ctx->ProcessorCompute(static_cast<jobject>(obj), static_cast<jobject>(prj)); - } - - void* IGNITE_CALL IgniteProcessorMessage(gcj::JniContext* ctx, void* obj, void* prj) { - return ctx->ProcessorMessage(static_cast<jobject>(obj), static_cast<jobject>(prj)); - } - - void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj) { - return ctx->ProcessorEvents(static_cast<jobject>(obj), static_cast<jobject>(prj)); - } - - void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj) { - return ctx->ProcessorServices(static_cast<jobject>(obj), static_cast<jobject>(prj)); - } - - void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj) { - return ctx->ProcessorExtensions(static_cast<jobject>(obj)); - } - - void* IGNITE_CALL IgniteProcessorExtension(gcj::JniContext* ctx, void* obj, int id) { - return ctx->ProcessorExtension(static_cast<jobject>(obj), id); - } - - void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create) { - return ctx->ProcessorAtomicLong(static_cast<jobject>(obj), name, initVal, create); - } - - void* IGNITE_CALL IgniteProcessorAtomicSequence(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create) { - return ctx->ProcessorAtomicSequence(static_cast<jobject>(obj), name, initVal, create); - } - - void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create) { - return ctx->ProcessorAtomicReference(static_cast<jobject>(obj), name, memPtr, create); - } - - void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr) { - return ctx->ProcessorGetIgniteConfiguration(static_cast<jobject>(obj), memPtr); - } - - void IGNITE_CALL IgniteProcessorGetCacheNames(gcj::JniContext* ctx, void* obj, long long memPtr) { - return ctx->ProcessorGetCacheNames(static_cast<jobject>(obj), memPtr); - } - long long IGNITE_CALL IgniteTargetInLongOutLong(gcj::JniContext* ctx, void* obj, int opType, long long val) { return ctx->TargetInLongOutLong(static_cast<jobject>(obj), opType, val); } - bool IGNITE_CALL IgniteProcessorLoggerIsLevelEnabled(gcj::JniContext* ctx, void* obj, int level) { - return ctx->ProcessorLoggerIsLevelEnabled(static_cast<jobject>(obj), level); - } - - void IGNITE_CALL IgniteProcessorLoggerLog(gcj::JniContext* ctx, void* obj, int level, char* message, char* category, char* errorInfo) { - ctx->ProcessorLoggerLog(static_cast<jobject>(obj), level, message, category, errorInfo); - } - - void* IGNITE_CALL IgniteProcessorBinaryProcessor(gcj::JniContext* ctx, void* obj) { - return ctx->ProcessorBinaryProcessor(static_cast<jobject>(obj)); - } - long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) { return ctx->TargetInStreamOutLong(static_cast<jobject>(obj), opType, memPtr); }
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/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 bc6af34..7eadec0 100644 --- a/modules/platforms/cpp/jni/src/java.cpp +++ b/modules/platforms/cpp/jni/src/java.cpp @@ -223,32 +223,6 @@ namespace ignite const char* C_PLATFORM_PROCESSOR = "org/apache/ignite/internal/processors/platform/PlatformProcessor"; JniMethod M_PLATFORM_PROCESSOR_RELEASE_START = JniMethod("releaseStart", "()V", false); - JniMethod M_PLATFORM_PROCESSOR_PROJECTION = JniMethod("projection", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_CACHE = JniMethod("cache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_CREATE_CACHE = JniMethod("createCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE = JniMethod("getOrCreateCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_CREATE_CACHE_FROM_CONFIG = JniMethod("createCacheFromConfig", "(J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE_FROM_CONFIG = JniMethod("getOrCreateCacheFromConfig", "(J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_CREATE_NEAR_CACHE = JniMethod("createNearCache", "(Ljava/lang/String;J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_NEAR_CACHE = JniMethod("getOrCreateNearCache", "(Ljava/lang/String;J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_DESTROY_CACHE = JniMethod("destroyCache", "(Ljava/lang/String;)V", false); - JniMethod M_PLATFORM_PROCESSOR_AFFINITY = JniMethod("affinity", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_DATA_STREAMER = JniMethod("dataStreamer", "(Ljava/lang/String;Z)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_TRANSACTIONS = JniMethod("transactions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_COMPUTE = JniMethod("compute", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_MESSAGE = JniMethod("message", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_EVENTS = JniMethod("events", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_SERVICES = JniMethod("services", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_EXTENSIONS = JniMethod("extensions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_EXTENSION = JniMethod("extension", "(I)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_ATOMIC_LONG = JniMethod("atomicLong", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE = JniMethod("atomicSequence", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE = JniMethod("atomicReference", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); - JniMethod M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION = JniMethod("getIgniteConfiguration", "(J)V", false); - JniMethod M_PLATFORM_PROCESSOR_GET_CACHE_NAMES = JniMethod("getCacheNames", "(J)V", false); - JniMethod M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(I)Z", false); - JniMethod M_PLATFORM_PROCESSOR_LOGGER_LOG = JniMethod("loggerLog", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", false); - JniMethod M_PLATFORM_PROCESSOR_BINARY_PROCESSOR = JniMethod("binaryProcessor", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false); const char* C_PLATFORM_TARGET = "org/apache/ignite/internal/processors/platform/PlatformTargetProxy"; JniMethod M_PLATFORM_TARGET_IN_LONG_OUT_LONG = JniMethod("inLongOutLong", "(IJ)J", false); @@ -262,86 +236,9 @@ namespace ignite 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", "(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); - - JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_CREATE = JniMethod("cacheEntryFilterCreate", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_APPLY = JniMethod("cacheEntryFilterApply", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_DESTROY = JniMethod("cacheEntryFilterDestroy", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_INVOKE = JniMethod("cacheInvoke", "(JJJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_MAP = JniMethod("computeTaskMap", "(JJJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_JOB_RESULT = JniMethod("computeTaskJobResult", "(JJJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_REDUCE = JniMethod("computeTaskReduce", "(JJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_COMPLETE = JniMethod("computeTaskComplete", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_SERIALIZE = JniMethod("computeJobSerialize", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CREATE = JniMethod("computeJobCreate", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_EXECUTE = JniMethod("computeJobExecute", "(JJIJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_DESTROY = JniMethod("computeJobDestroy", "(JJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CANCEL = JniMethod("computeJobCancel", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_LSNR_APPLY = JniMethod("continuousQueryListenerApply", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_CREATE = JniMethod("continuousQueryFilterCreate", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_EVAL = JniMethod("continuousQueryFilterApply", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_RELEASE = JniMethod("continuousQueryFilterRelease", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_TOPOLOGY_UPDATE = JniMethod("dataStreamerTopologyUpdate", "(JJJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_STREAM_RECEIVER_INVOKE = JniMethod("dataStreamerStreamReceiverInvoke", "(JJLorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;JZ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BYTE_RES = JniMethod("futureByteResult", "(JJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BOOL_RES = JniMethod("futureBoolResult", "(JJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_SHORT_RES = JniMethod("futureShortResult", "(JJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_CHAR_RES = JniMethod("futureCharResult", "(JJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_INT_RES = JniMethod("futureIntResult", "(JJI)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_FLOAT_RES = JniMethod("futureFloatResult", "(JJF)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_LONG_RES = JniMethod("futureLongResult", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_DOUBLE_RES = JniMethod("futureDoubleResult", "(JJD)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_OBJ_RES = JniMethod("futureObjectResult", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_NULL_RES = JniMethod("futureNullResult", "(JJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_ERR = JniMethod("futureError", "(JJJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_LIFECYCLE_EVENT = JniMethod("lifecycleEvent", "(JJI)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_CREATE = JniMethod("messagingFilterCreate", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_APPLY = JniMethod("messagingFilterApply", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_DESTROY = JniMethod("messagingFilterDestroy", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_CREATE = JniMethod("eventFilterCreate", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_APPLY = JniMethod("eventFilterApply", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_DESTROY = JniMethod("eventFilterDestroy", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INIT = JniMethod("serviceInit", "(JJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_EXECUTE = JniMethod("serviceExecute", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_CANCEL = JniMethod("serviceCancel", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INVOKE_METHOD = JniMethod("serviceInvokeMethod", "(JJJJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_CLUSTER_NODE_FILTER_APPLY = JniMethod("clusterNodeFilterApply", "(JJ)I", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_NODE_INFO = JniMethod("nodeInfo", "(JJ)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_MEMORY_REALLOCATE = JniMethod("memoryReallocate", "(JJI)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_ON_START = JniMethod("onStart", "(JLjava/lang/Object;J)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_ON_STOP = JniMethod("onStop", "(J)V", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG = JniMethod("extensionCallbackInLongOutLong", "(JIJ)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG = JniMethod("extensionCallbackInLongLongOutLong", "(JIJJ)J", true); - - JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED = JniMethod("onClientDisconnected", "(J)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED = JniMethod("onClientReconnected", "(JZ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_LOG = JniMethod("loggerLog", "(JILjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V", true); JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(JI)Z", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_INIT = JniMethod("affinityFunctionInit", "(JJLorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)J", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_PARTITION = JniMethod("affinityFunctionPartition", "(JJJ)I", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS = JniMethod("affinityFunctionAssignPartitions", "(JJJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_REMOVE_NODE = JniMethod("affinityFunctionRemoveNode", "(JJJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_DESTROY = JniMethod("affinityFunctionDestroy", "(JJ)V", true); - JniMethod M_PLATFORM_CALLBACK_UTILS_CONSOLE_WRITE = JniMethod("consoleWrite", "(Ljava/lang/String;Z)V", true); JniMethod M_PLATFORM_CALLBACK_UTILS_IN_LONG_OUT_LONG = JniMethod("inLongOutLong", "(JIJ)J", true); @@ -353,7 +250,7 @@ namespace ignite JniMethod M_PLATFORM_UTILS_GET_FULL_STACK_TRACE = JniMethod("getFullStackTrace", "(Ljava/lang/Throwable;)Ljava/lang/String;", true); const char* C_PLATFORM_IGNITION = "org/apache/ignite/internal/processors/platform/PlatformIgnition"; - JniMethod M_PLATFORM_IGNITION_START = JniMethod("start", "(Ljava/lang/String;Ljava/lang/String;IJJ)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true); + JniMethod M_PLATFORM_IGNITION_START = JniMethod("start", "(Ljava/lang/String;Ljava/lang/String;IJJ)V", true); JniMethod M_PLATFORM_IGNITION_INSTANCE = JniMethod("instance", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true); JniMethod M_PLATFORM_IGNITION_ENVIRONMENT_POINTER = JniMethod("environmentPointer", "(Ljava/lang/String;)J", true); JniMethod M_PLATFORM_IGNITION_STOP = JniMethod("stop", "(Ljava/lang/String;Z)Z", true); @@ -554,32 +451,6 @@ namespace ignite 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); - m_PlatformProcessor_createCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_CACHE); - m_PlatformProcessor_getOrCreateCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE); - m_PlatformProcessor_createCacheFromConfig = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_CACHE_FROM_CONFIG); - m_PlatformProcessor_getOrCreateCacheFromConfig = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE_FROM_CONFIG); - m_PlatformProcessor_createNearCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_NEAR_CACHE); - m_PlatformProcessor_getOrCreateNearCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_NEAR_CACHE); - m_PlatformProcessor_destroyCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_DESTROY_CACHE); - m_PlatformProcessor_affinity = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_AFFINITY); - m_PlatformProcessor_dataStreamer = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_DATA_STREAMER); - m_PlatformProcessor_transactions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_TRANSACTIONS); - m_PlatformProcessor_projection = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_PROJECTION); - m_PlatformProcessor_compute = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_COMPUTE); - m_PlatformProcessor_message = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_MESSAGE); - m_PlatformProcessor_events = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EVENTS); - m_PlatformProcessor_services = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_SERVICES); - m_PlatformProcessor_extensions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSIONS); - m_PlatformProcessor_extension = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSION); - m_PlatformProcessor_atomicLong = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_LONG); - m_PlatformProcessor_atomicSequence = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE); - m_PlatformProcessor_atomicReference = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE); - m_PlatformProcessor_getIgniteConfiguration = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION); - m_PlatformProcessor_getCacheNames = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_CACHE_NAMES); - m_PlatformProcessor_loggerIsLevelEnabled = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED); - m_PlatformProcessor_loggerLog = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_LOG); - m_PlatformProcessor_binaryProcessor = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_BINARY_PROCESSOR); c_PlatformTarget = FindClass(env, C_PLATFORM_TARGET); m_PlatformTarget_inLongOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_LONG_OUT_LONG); @@ -871,18 +742,18 @@ namespace ignite } } - jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) { + void JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) { return IgnitionStart(cfgPath, name, factoryId, dataPtr, NULL); } - jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo) + void JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); jstring cfgPath0 = env->NewStringUTF(cfgPath); jstring name0 = env->NewStringUTF(name); - jobject interop = env->CallStaticObjectMethod( + env->CallStaticVoidMethod( jvm->GetMembers().c_PlatformIgnition, jvm->GetMembers().m_PlatformIgnition_start, cfgPath0, @@ -893,30 +764,8 @@ namespace ignite ); ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, interop); - } - - - jobject JniContext::IgnitionInstance(char* name) - { - return IgnitionInstance(name, NULL); - } - - jobject JniContext::IgnitionInstance(char* name, JniErrorInfo* errInfo) - { - JNIEnv* env = Attach(); - - jstring name0 = env->NewStringUTF(name); - - jobject interop = env->CallStaticObjectMethod(jvm->GetMembers().c_PlatformIgnition, - jvm->GetMembers().m_PlatformIgnition_instance, name0); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, interop); } - + long long JniContext::IgnitionEnvironmentPointer(char* name) { return IgnitionEnvironmentPointer(name, NULL); @@ -970,318 +819,6 @@ namespace ignite ExceptionCheck(env, errInfo); } - void JniContext::ProcessorReleaseStart(jobject obj) { - JNIEnv* env = Attach(); - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_releaseStart); - - ExceptionCheck(env); - } - - jobject JniContext::ProcessorProjection(jobject obj, JniErrorInfo* errInfo) { - JNIEnv* env = Attach(); - - jobject prj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_projection); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, prj); - } - - jobject JniContext::ProcessorCache0(jobject obj, const char* name, jmethodID mthd, JniErrorInfo* errInfo) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject cache = env->CallObjectMethod(obj, mthd, name0); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, cache); - } - - jobject JniContext::ProcessorCacheFromConfig0(jobject obj, long long memPtr, jmethodID mthd, JniErrorInfo* errInfo) - { - JNIEnv* env = Attach(); - - jobject cache = env->CallObjectMethod(obj, mthd, memPtr); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, cache); - } - - jobject JniContext::ProcessorCache(jobject obj, const char* name) { - return ProcessorCache(obj, name, NULL); - } - - jobject JniContext::ProcessorCache(jobject obj, const char* name, JniErrorInfo* errInfo) { - return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_cache, errInfo); - } - - jobject JniContext::ProcessorCreateCache(jobject obj, const char* name) { - return ProcessorCreateCache(obj, name, NULL); - } - - jobject JniContext::ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo) - { - return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_createCache, errInfo); - } - - jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name) { - return ProcessorGetOrCreateCache(obj, name, NULL); - } - - jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo) - { - return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_getOrCreateCache, errInfo); - } - - void JniContext::ProcessorDestroyCache(jobject obj, const char* name) { - ProcessorDestroyCache(obj, name, NULL); - } - - void JniContext::ProcessorDestroyCache(jobject obj, const char* name, JniErrorInfo* errInfo) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_destroyCache, name0); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env, errInfo); - } - - jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr) { - return ProcessorCreateCacheFromConfig(obj, memPtr, NULL); - } - - jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo) - { - return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_createCacheFromConfig, errInfo); - } - - jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr) { - return ProcessorGetOrCreateCacheFromConfig(obj, memPtr, NULL); - } - - jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo) - { - return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_getOrCreateCacheFromConfig, errInfo); - } - - jobject JniContext::ProcessorCreateNearCache(jobject obj, const char* name, long long memPtr) - { - return ProcessorGetOrCreateNearCache0(obj, name, memPtr, jvm->GetMembers().m_PlatformProcessor_createNearCache); - } - - jobject JniContext::ProcessorGetOrCreateNearCache(jobject obj, const char* name, long long memPtr) - { - return ProcessorGetOrCreateNearCache0(obj, name, memPtr, jvm->GetMembers().m_PlatformProcessor_getOrCreateNearCache); - } - - jobject JniContext::ProcessorGetOrCreateNearCache0(jobject obj, const char* name, long long memPtr, jmethodID methodID) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject cache = env->CallObjectMethod(obj, methodID, name0, memPtr); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, cache); - } - - jobject JniContext::ProcessorAffinity(jobject obj, const char* name) { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject aff = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_affinity, name0); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, aff); - } - - jobject JniContext::ProcessorDataStreamer(jobject obj, const char* name, bool keepPortable) { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject ldr = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_dataStreamer, name0, - keepPortable); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, ldr); - } - - jobject JniContext::ProcessorTransactions(jobject obj, JniErrorInfo* errInfo) { - JNIEnv* env = Attach(); - - jobject tx = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_transactions); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, tx); - } - - jobject JniContext::ProcessorCompute(jobject obj, jobject prj) { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_compute, prj); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorCompute(jobject obj, jobject prj, JniErrorInfo* errInfo) { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_compute, prj); - - ExceptionCheck(env, errInfo); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorMessage(jobject obj, jobject prj) { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_message, prj); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorEvents(jobject obj, jobject prj) { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_events, prj); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorServices(jobject obj, jobject prj) { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_services, prj); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorExtensions(jobject obj) - { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extensions); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorExtension(jobject obj, int id) - { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extension, id); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicLong, name0, initVal, create); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorAtomicSequence(jobject obj, char* name, long long initVal, bool create) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicSequence, name0, initVal, create); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - jobject JniContext::ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create) - { - JNIEnv* env = Attach(); - - jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL; - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicReference, name0, memPtr, create); - - if (name0) - env->DeleteLocalRef(name0); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - - void JniContext::ProcessorGetIgniteConfiguration(jobject obj, long long memPtr) - { - JNIEnv* env = Attach(); - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_getIgniteConfiguration, memPtr); - - ExceptionCheck(env); - } - - void JniContext::ProcessorGetCacheNames(jobject obj, long long memPtr) - { - JNIEnv* env = Attach(); - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_getCacheNames, memPtr); - - ExceptionCheck(env); - } - long long JniContext::TargetInLongOutLong(jobject obj, int opType, long long val, JniErrorInfo* err) { JNIEnv* env = Attach(); @@ -1292,51 +829,6 @@ namespace ignite return res; } - bool JniContext::ProcessorLoggerIsLevelEnabled(jobject obj, int level) - { - JNIEnv* env = Attach(); - - jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerIsLevelEnabled, level); - - ExceptionCheck(env); - - return res != 0; - } - - void JniContext::ProcessorLoggerLog(jobject obj, int level, char* message, char* category, char* errorInfo) - { - JNIEnv* env = Attach(); - - jstring message0 = message != NULL ? env->NewStringUTF(message) : NULL; - jstring category0 = category != NULL ? env->NewStringUTF(category) : NULL; - jstring errorInfo0 = errorInfo != NULL ? env->NewStringUTF(errorInfo) : NULL; - - - env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerLog, level, message0, category0, errorInfo0); - - if (message0) - env->DeleteLocalRef(message0); - - if (category0) - env->DeleteLocalRef(category0); - - if (errorInfo0) - env->DeleteLocalRef(errorInfo0); - - ExceptionCheck(env); - } - - jobject JniContext::ProcessorBinaryProcessor(jobject obj) - { - JNIEnv* env = Attach(); - - jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_binaryProcessor); - - ExceptionCheck(env); - - return LocalToGlobal(env, res); - } - long long JniContext::TargetInStreamOutLong(jobject obj, int opType, long long memPtr, JniErrorInfo* err) { JNIEnv* env = Attach(); http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs index c5d056d..44ebef3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs @@ -253,7 +253,9 @@ namespace Apache.Ignite.Core var javaLogger = log as JavaLogger; if (javaLogger != null) - javaLogger.SetProcessor(interopProc); + { + javaLogger.SetIgnite(node); + } // 6. On-start callback (notify lifecycle components). node.OnStart(); @@ -291,10 +293,14 @@ namespace Apache.Ignite.Core } finally { + var ignite = _startup.Ignite; + _startup = null; - if (interopProc != null) - UU.ProcessorReleaseStart(interopProc); + if (ignite != null) + { + ignite.ProcessorReleaseStart(); + } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/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 b1bf5eb..e6b2408 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs @@ -1166,7 +1166,7 @@ namespace Apache.Ignite.Core.Impl.Cache { if (loc) { - var target = DoOutOpObject((int) CacheOp.LocIterator, w => w.WriteInt(peekModes)); + var target = DoOutOpObject((int) CacheOp.LocIterator, (IBinaryStream s) => s.WriteInt(peekModes)); return new CacheEnumerator<TK, TV>(target, Marshaller, _flagKeepBinary); } http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs index 6e07b78..30afe57 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs @@ -135,6 +135,18 @@ namespace Apache.Ignite.Core.Impl.Cluster /** */ private const int OpGetPersistentStoreMetrics = 30; + /** */ + private const int OpGetCompute = 31; + + /** */ + private const int OpGetMessaging = 32; + + /** */ + private const int OpGetEvents = 33; + + /** */ + private const int OpGetServices = 34; + /** Initial Ignite instance. */ private readonly Ignite _ignite; @@ -147,17 +159,14 @@ namespace Apache.Ignite.Core.Impl.Cluster /** Nodes for the given topology version. */ private volatile IList<IClusterNode> _nodes; - /** Processor. */ - private readonly IUnmanagedTarget _proc; - /** Compute. */ - private readonly Lazy<Compute> _comp; + private readonly Lazy<ICompute> _comp; /** Messaging. */ - private readonly Lazy<Messaging> _msg; + private readonly Lazy<IMessaging> _msg; /** Events. */ - private readonly Lazy<Events> _events; + private readonly Lazy<IEvents> _events; /** Services. */ private readonly Lazy<IServices> _services; @@ -165,29 +174,20 @@ namespace Apache.Ignite.Core.Impl.Cluster /// <summary> /// Constructor. /// </summary> - /// <param name="proc">Processor.</param> /// <param name="target">Target.</param> - /// <param name="marsh">Marshaller.</param> /// <param name="ignite">Grid.</param> /// <param name="pred">Predicate.</param> [SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily")] - public ClusterGroupImpl(IUnmanagedTarget proc, IUnmanagedTarget target, Marshaller marsh, - Ignite ignite, Func<IClusterNode, bool> pred) - : base(target, marsh) + public ClusterGroupImpl(IUnmanagedTarget target, Ignite ignite, Func<IClusterNode, bool> pred) + : base(target, ignite.Marshaller) { - _proc = proc; _ignite = ignite; _pred = pred; - _comp = new Lazy<Compute>(() => - new Compute(new ComputeImpl(UU.ProcessorCompute(proc, target), marsh, this, false))); - - _msg = new Lazy<Messaging>(() => new Messaging(UU.ProcessorMessage(proc, target), marsh, this)); - - _events = new Lazy<Events>(() => new Events(UU.ProcessorEvents(proc, target), marsh, this)); - - _services = new Lazy<IServices>(() => - new Services(UU.ProcessorServices(proc, target), marsh, this, false, false)); + _comp = new Lazy<ICompute>(() => CreateCompute()); + _msg = new Lazy<IMessaging>(() => CreateMessaging()); + _events = new Lazy<IEvents>(() => CreateEvents()); + _services = new Lazy<IServices>(() => CreateServices()); } /** <inheritDoc /> */ @@ -202,6 +202,14 @@ namespace Apache.Ignite.Core.Impl.Cluster return _comp.Value; } + /// <summary> + /// Creates the compute. + /// </summary> + private ICompute CreateCompute() + { + return new Compute(new ComputeImpl(DoOutOpObject(OpGetCompute), Marshaller, this, false)); + } + /** <inheritDoc /> */ public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes) { @@ -257,7 +265,7 @@ namespace Apache.Ignite.Core.Impl.Cluster { var newPred = _pred == null ? p : node => _pred(node) && p(node); - return new ClusterGroupImpl(_proc, Target, Marshaller, _ignite, newPred); + return new ClusterGroupImpl(Target, _ignite, newPred); } /** <inheritDoc /> */ @@ -413,12 +421,28 @@ namespace Apache.Ignite.Core.Impl.Cluster return _msg.Value; } + /// <summary> + /// Creates the messaging. + /// </summary> + private IMessaging CreateMessaging() + { + return new Messaging(DoOutOpObject(OpGetMessaging), Marshaller, this); + } + /** <inheritDoc /> */ public IEvents GetEvents() { return _events.Value; } + /// <summary> + /// Creates the events. + /// </summary> + private IEvents CreateEvents() + { + return new Events(DoOutOpObject(OpGetEvents), Marshaller, this); + } + /** <inheritDoc /> */ public IServices GetServices() { @@ -426,6 +450,14 @@ namespace Apache.Ignite.Core.Impl.Cluster } /// <summary> + /// Creates the services. + /// </summary> + private IServices CreateServices() + { + return new Services(DoOutOpObject(OpGetServices), Marshaller, this, false, false); + } + + /// <summary> /// Pings a remote node. /// </summary> /// <param name="nodeId">ID of a node to ping.</param> @@ -635,7 +667,7 @@ namespace Apache.Ignite.Core.Impl.Cluster /// <returns>New cluster group.</returns> private IClusterGroup GetClusterGroup(IUnmanagedTarget prj) { - return new ClusterGroupImpl(_proc, prj, Marshaller, _ignite, _pred); + return new ClusterGroupImpl(prj, _ignite, _pred); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs index 7a028cd..cace7b2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs @@ -186,10 +186,10 @@ namespace Apache.Ignite.Core.Impl.Compute long ptr = Marshaller.Ignite.HandleRegistry.Allocate(holder); - var futTarget = DoOutOpObject(OpExecNative, w => + var futTarget = DoOutOpObject(OpExecNative, (IBinaryStream s) => { - w.WriteLong(ptr); - w.WriteLong(_prj.TopologyVersion); + s.WriteLong(ptr); + s.WriteLong(_prj.TopologyVersion); }); var future = holder.Future; http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs index b9e3030..96e58d4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs @@ -547,8 +547,7 @@ namespace Apache.Ignite.Core.Impl.Datastream return result; } - return new DataStreamerImpl<TK1, TV1>(UU.ProcessorDataStreamer(Marshaller.Ignite.InteropProcessor, - _cacheName, true), Marshaller, _cacheName, true); + return Marshaller.Ignite.GetDataStreamer<TK1, TV1>(_cacheName, true); } /** <inheritDoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs index 953ddb6..c91334d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs @@ -138,7 +138,7 @@ namespace Apache.Ignite.Core.Impl.Datastream for (var i = 0; i < size; i++) entries.Add(new CacheEntry<TK, TV>(reader.ReadObject<TK>(), reader.ReadObject<TV>())); - receiver.Receive(grid.Cache<TK, TV>(cache, keepBinary), entries); + receiver.Receive(grid.GetCache<TK, TV>(cache, keepBinary), entries); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index 205f6e2..715776e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -42,6 +42,7 @@ namespace Apache.Ignite.Core.Impl using Apache.Ignite.Core.Impl.Plugin; using Apache.Ignite.Core.Impl.Transactions; using Apache.Ignite.Core.Impl.Unmanaged; + using Apache.Ignite.Core.Interop; using Apache.Ignite.Core.Lifecycle; using Apache.Ignite.Core.Log; using Apache.Ignite.Core.Messaging; @@ -53,8 +54,37 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Native Ignite wrapper. /// </summary> - internal class Ignite : IIgnite, ICluster + internal class Ignite : PlatformTarget, IIgnite, ICluster { + /// <summary> + /// Operation codes for PlatformProcessorImpl calls. + /// </summary> + private enum Op + { + GetCache = 1, + CreateCache = 2, + GetOrCreateCache = 3, + CreateCacheFromConfig = 4, + GetOrCreateCacheFromConfig = 5, + DestroyCache = 6, + GetAffinity = 7, + GetDataStreamer = 8, + GetTransactions = 9, + GetClusterGroup = 10, + GetExtension = 11, + GetAtomicLong = 12, + GetAtomicReference = 13, + GetAtomicSequence = 14, + GetIgniteConfiguration = 15, + GetCacheNames = 16, + CreateNearCache = 17, + GetOrCreateNearCache = 18, + LoggerIsLevelEnabled = 19, + LoggerLog = 20, + GetBinaryProcessor = 21, + ReleaseStart = 22 + } + /** */ private readonly IgniteConfiguration _cfg; @@ -109,7 +139,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="lifecycleHandlers">Lifecycle beans.</param> /// <param name="cbs">Callbacks.</param> public Ignite(IgniteConfiguration cfg, string name, IUnmanagedTarget proc, Marshaller marsh, - IList<LifecycleHandlerHolder> lifecycleHandlers, UnmanagedCallbacks cbs) + IList<LifecycleHandlerHolder> lifecycleHandlers, UnmanagedCallbacks cbs) : base(proc, marsh) { Debug.Assert(cfg != null); Debug.Assert(proc != null); @@ -126,17 +156,17 @@ namespace Apache.Ignite.Core.Impl marsh.Ignite = this; - _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null); + _prj = new ClusterGroupImpl(DoOutOpObject((int) Op.GetClusterGroup), this, null); _binary = new Binary.Binary(marsh); - _binaryProc = new BinaryProcessor(UU.ProcessorBinaryProcessor(proc), marsh); + _binaryProc = new BinaryProcessor(DoOutOpObject((int) Op.GetBinaryProcessor), marsh); cbs.Initialize(this); // Grid is not completely started here, can't initialize interop transactions right away. _transactions = new Lazy<TransactionsImpl>( - () => new TransactionsImpl(UU.ProcessorTransactions(proc), marsh, GetLocalNode().Id)); + () => new TransactionsImpl(DoOutOpObject((int) Op.GetTransactions), marsh, GetLocalNode().Id)); // Set reconnected task to completed state for convenience. _clientReconnectTaskCompletionSource.SetResult(false); @@ -207,7 +237,7 @@ namespace Apache.Ignite.Core.Impl /** <inheritdoc /> */ public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes) { - return ((IClusterGroup) _prj).ForNodes(nodes); + return _prj.ForNodes(nodes); } /** <inheritdoc /> */ @@ -219,12 +249,6 @@ namespace Apache.Ignite.Core.Impl /** <inheritdoc /> */ public IClusterGroup ForNodeIds(IEnumerable<Guid> ids) { - return ((IClusterGroup) _prj).ForNodeIds(ids); - } - - /** <inheritdoc /> */ - public IClusterGroup ForNodeIds(ICollection<Guid> ids) - { return _prj.ForNodeIds(ids); } @@ -389,7 +413,8 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(name, "name"); - return Cache<TK, TV>(UU.ProcessorCache(_proc, name)); + + return GetCache<TK, TV>(DoOutOpObject((int) Op.GetCache, w => w.WriteString(name))); } /** <inheritdoc /> */ @@ -397,7 +422,7 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(name, "name"); - return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, name)); + return GetCache<TK, TV>(DoOutOpObject((int) Op.GetOrCreateCache, w => w.WriteString(name))); } /** <inheritdoc /> */ @@ -407,31 +432,10 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration, + public ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration) { - IgniteArgumentCheck.NotNull(configuration, "configuration"); - IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name"); - configuration.Validate(Logger); - - using (var stream = IgniteManager.Memory.Allocate().GetStream()) - { - var writer = BinaryUtils.Marshaller.StartMarshal(stream); - - configuration.Write(writer); - - if (nearConfiguration != null) - { - writer.WriteBoolean(true); - nearConfiguration.Write(writer); - } - else - writer.WriteBoolean(false); - - stream.SynchronizeOutput(); - - return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, stream.MemoryPointer)); - } + return GetOrCreateCache<TK, TV>(configuration, nearConfiguration, Op.GetOrCreateCacheFromConfig); } /** <inheritdoc /> */ @@ -439,7 +443,9 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(name, "name"); - return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, name)); + var cacheTarget = DoOutOpObject((int) Op.CreateCache, w => w.WriteString(name)); + + return GetCache<TK, TV>(cacheTarget); } /** <inheritdoc /> */ @@ -452,29 +458,37 @@ namespace Apache.Ignite.Core.Impl public ICache<TK, TV> CreateCache<TK, TV>(CacheConfiguration configuration, NearCacheConfiguration nearConfiguration) { + return GetOrCreateCache<TK, TV>(configuration, nearConfiguration, Op.CreateCacheFromConfig); + } + + /// <summary> + /// Gets or creates the cache. + /// </summary> + private ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration, + NearCacheConfiguration nearConfiguration, Op op) + { IgniteArgumentCheck.NotNull(configuration, "configuration"); IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name"); configuration.Validate(Logger); - using (var stream = IgniteManager.Memory.Allocate().GetStream()) + var cacheTarget = DoOutOpObject((int) op, s => { - // Use system marshaller: full footers, always unregistered mode. - var writer = BinaryUtils.Marshaller.StartMarshal(stream); + var w = BinaryUtils.Marshaller.StartMarshal(s); - configuration.Write(writer); + configuration.Write(w); if (nearConfiguration != null) { - writer.WriteBoolean(true); - nearConfiguration.Write(writer); + w.WriteBoolean(true); + nearConfiguration.Write(w); } else - writer.WriteBoolean(false); - - stream.SynchronizeOutput(); + { + w.WriteBoolean(false); + } + }); - return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, stream.MemoryPointer)); - } + return GetCache<TK, TV>(cacheTarget); } /** <inheritdoc /> */ @@ -482,7 +496,7 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(name, "name"); - UU.ProcessorDestroyCache(_proc, name); + DoOutOp((int) Op.DestroyCache, w => w.WriteString(name)); } /// <summary> @@ -493,7 +507,7 @@ namespace Apache.Ignite.Core.Impl /// <returns> /// New instance of cache wrapping specified native cache. /// </returns> - public ICache<TK, TV> Cache<TK, TV>(IUnmanagedTarget nativeCache, bool keepBinary = false) + public ICache<TK, TV> GetCache<TK, TV>(IUnmanagedTarget nativeCache, bool keepBinary = false) { return new CacheImpl<TK, TV>(this, nativeCache, _marsh, false, keepBinary, false, false); } @@ -541,8 +555,21 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(cacheName, "cacheName"); - return new DataStreamerImpl<TK, TV>(UU.ProcessorDataStreamer(_proc, cacheName, false), - _marsh, cacheName, false); + return GetDataStreamer<TK, TV>(cacheName, false); + } + + /// <summary> + /// Gets the data streamer. + /// </summary> + internal IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName, bool keepBinary) + { + var streamerTarget = DoOutOpObject((int) Op.GetDataStreamer, w => + { + w.WriteString(cacheName); + w.WriteBoolean(keepBinary); + }); + + return new DataStreamerImpl<TK, TV>(streamerTarget, _marsh, cacheName, keepBinary); } /** <inheritdoc /> */ @@ -556,11 +583,12 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNull(cacheName, "cacheName"); - return new CacheAffinityImpl(UU.ProcessorAffinity(_proc, cacheName), _marsh, false, this); + var aff = DoOutOpObject((int) Op.GetAffinity, w => w.WriteString(cacheName)); + + return new CacheAffinityImpl(aff, _marsh, false, this); } /** <inheritdoc /> */ - public ITransactions GetTransactions() { return _transactions.Value; @@ -589,7 +617,12 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNullOrEmpty(name, "name"); - var nativeLong = UU.ProcessorAtomicLong(_proc, name, initialValue, create); + var nativeLong = DoOutOpObject((int) Op.GetAtomicLong, w => + { + w.WriteString(name); + w.WriteLong(initialValue); + w.WriteBoolean(create); + }); if (nativeLong == null) return null; @@ -602,7 +635,12 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNullOrEmpty(name, "name"); - var nativeSeq = UU.ProcessorAtomicSequence(_proc, name, initialValue, create); + var nativeSeq = DoOutOpObject((int) Op.GetAtomicSequence, w => + { + w.WriteString(name); + w.WriteLong(initialValue); + w.WriteBoolean(create); + }); if (nativeSeq == null) return null; @@ -615,81 +653,47 @@ namespace Apache.Ignite.Core.Impl { IgniteArgumentCheck.NotNullOrEmpty(name, "name"); - var refTarget = GetAtomicReferenceUnmanaged(name, initialValue, create); - - return refTarget == null ? null : new AtomicReference<T>(refTarget, Marshaller, name); - } - - /// <summary> - /// Gets the unmanaged atomic reference. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="initialValue">The initial value.</param> - /// <param name="create">Create flag.</param> - /// <returns>Unmanaged atomic reference, or null.</returns> - private IUnmanagedTarget GetAtomicReferenceUnmanaged<T>(string name, T initialValue, bool create) - { - IgniteArgumentCheck.NotNullOrEmpty(name, "name"); - - // Do not allocate memory when default is not used. - if (!create) - return UU.ProcessorAtomicReference(_proc, name, 0, false); - - using (var stream = IgniteManager.Memory.Allocate().GetStream()) + var refTarget = DoOutOpObject((int) Op.GetAtomicReference, w => { - var writer = Marshaller.StartMarshal(stream); - - writer.Write(initialValue); - - Marshaller.FinishMarshal(writer); + w.WriteString(name); + w.WriteObject(initialValue); + w.WriteBoolean(create); + }); - var memPtr = stream.SynchronizeOutput(); - - return UU.ProcessorAtomicReference(_proc, name, memPtr, true); - } + return refTarget == null ? null : new AtomicReference<T>(refTarget, Marshaller, name); } /** <inheritdoc /> */ public IgniteConfiguration GetConfiguration() { - using (var stream = IgniteManager.Memory.Allocate(1024).GetStream()) - { - UU.ProcessorGetIgniteConfiguration(_proc, stream.MemoryPointer); - - stream.SynchronizeInput(); - - return new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(stream), _cfg); - } + return DoInOp((int) Op.GetIgniteConfiguration, + s => new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(s), _cfg)); } /** <inheritdoc /> */ public ICache<TK, TV> CreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration) { - return GetOrCreateNearCache0<TK, TV>(name, configuration, UU.ProcessorCreateNearCache); + return GetOrCreateNearCache0<TK, TV>(name, configuration, Op.CreateNearCache); } /** <inheritdoc /> */ public ICache<TK, TV> GetOrCreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration) { - return GetOrCreateNearCache0<TK, TV>(name, configuration, UU.ProcessorGetOrCreateNearCache); + return GetOrCreateNearCache0<TK, TV>(name, configuration, Op.GetOrCreateNearCache); } /** <inheritdoc /> */ public ICollection<string> GetCacheNames() { - using (var stream = IgniteManager.Memory.Allocate(1024).GetStream()) + return OutStream((int) Op.GetCacheNames, r => { - UU.ProcessorGetCacheNames(_proc, stream.MemoryPointer); - stream.SynchronizeInput(); - - var reader = _marsh.StartUnmarshal(stream); - var res = new string[stream.ReadInt()]; + var res = new string[r.ReadInt()]; - for (int i = 0; i < res.Length; i++) - res[i] = reader.ReadString(); + for (var i = 0; i < res.Length; i++) + res[i] = r.ReadString(); - return res; - } + return (ICollection<string>) res; + }); } /** <inheritdoc /> */ @@ -768,20 +772,17 @@ namespace Apache.Ignite.Core.Impl /// Gets or creates near cache. /// </summary> private ICache<TK, TV> GetOrCreateNearCache0<TK, TV>(string name, NearCacheConfiguration configuration, - Func<IUnmanagedTarget, string, long, IUnmanagedTarget> func) + Op op) { IgniteArgumentCheck.NotNull(configuration, "configuration"); - using (var stream = IgniteManager.Memory.Allocate().GetStream()) + var cacheTarget = DoOutOpObject((int) op, w => { - var writer = BinaryUtils.Marshaller.StartMarshal(stream); + w.WriteString(name); + configuration.Write(w); + }); - configuration.Write(writer); - - stream.SynchronizeOutput(); - - return Cache<TK, TV>(func(_proc, name, stream.MemoryPointer)); - } + return GetCache<TK, TV>(cacheTarget); } /// <summary> @@ -794,14 +795,6 @@ namespace Apache.Ignite.Core.Impl } /// <summary> - /// Marshaller. - /// </summary> - internal Marshaller Marshaller - { - get { return _marsh; } - } - - /// <summary> /// Gets the binary processor. /// </summary> internal BinaryProcessor BinaryProcessor @@ -892,5 +885,43 @@ namespace Apache.Ignite.Core.Impl { get { return _pluginProcessor; } } + + /// <summary> + /// Notify processor that it is safe to use. + /// </summary> + internal void ProcessorReleaseStart() + { + InLongOutLong((int) Op.ReleaseStart, 0); + } + + /// <summary> + /// Checks whether log level is enabled in Java logger. + /// </summary> + internal bool LoggerIsLevelEnabled(LogLevel logLevel) + { + return InLongOutLong((int) Op.LoggerIsLevelEnabled, (long) logLevel) == True; + } + + /// <summary> + /// Logs to the Java logger. + /// </summary> + internal void LoggerLog(LogLevel level, string msg, string category, string err) + { + InStreamOutLong((int) Op.LoggerLog, w => + { + w.WriteInt((int) level); + w.WriteString(msg); + w.WriteString(category); + w.WriteString(err); + }); + } + + /// <summary> + /// Gets the platform plugin extension. + /// </summary> + internal IPlatformTarget GetExtension(int id) + { + return InStreamOutObject((int) Op.GetExtension, w => w.WriteInt(id)); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs index 23e7a37..2e47fe8 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs @@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Impl.Log using System.Collections.Generic; using System.Diagnostics; using System.Linq; - using Apache.Ignite.Core.Impl.Unmanaged; using Apache.Ignite.Core.Log; /// <summary> @@ -30,7 +29,7 @@ namespace Apache.Ignite.Core.Impl.Log internal class JavaLogger : ILogger { /** */ - private IUnmanagedTarget _proc; + private Ignite _ignite; /** */ private readonly List<LogLevel> _enabledLevels = new List<LogLevel>(5); @@ -45,19 +44,19 @@ namespace Apache.Ignite.Core.Impl.Log /// <summary> /// Sets the processor. /// </summary> - /// <param name="proc">The proc.</param> - public void SetProcessor(IUnmanagedTarget proc) + /// <param name="ignite">The proc.</param> + public void SetIgnite(Ignite ignite) { - Debug.Assert(proc != null); + Debug.Assert(ignite != null); lock (_syncRoot) { - _proc = proc; + _ignite = ignite; // Preload enabled levels. _enabledLevels.AddRange( - new[] { LogLevel.Trace, LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error } - .Where(x => UnmanagedUtils.ProcessorLoggerIsLevelEnabled(proc, (int)x))); + new[] {LogLevel.Trace, LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error} + .Where(x => ignite.LoggerIsLevelEnabled(x))); foreach (var log in _pendingLogs) { @@ -82,7 +81,7 @@ namespace Apache.Ignite.Core.Impl.Log var msg = args == null ? message : string.Format(formatProvider, message, args); var err = ex != null ? ex.ToString() : null; - if (_proc != null) + if (_ignite != null) Log(level, msg, category, err); else _pendingLogs.Add(Tuple.Create(level, msg, category, err)); @@ -94,7 +93,7 @@ namespace Apache.Ignite.Core.Impl.Log { lock (_syncRoot) { - return _proc == null || _enabledLevels.Contains(level); + return _ignite == null || _enabledLevels.Contains(level); } } @@ -104,7 +103,9 @@ namespace Apache.Ignite.Core.Impl.Log private void Log(LogLevel level, string msg, string category, string err) { if (IsEnabled(level)) - UnmanagedUtils.ProcessorLoggerLog(_proc, (int)level, msg, category, err); + { + _ignite.LoggerLog(level, msg, category, err); + } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs index 8dd8eaf..474af0e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs @@ -300,7 +300,7 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <param name="type">Operation type.</param> /// <param name="action">Action to be performed on the stream.</param> - /// <returns></returns> + /// <returns>Resulting object.</returns> protected IUnmanagedTarget DoOutOpObject(int type, Action<BinaryWriter> action) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) @@ -319,6 +319,22 @@ namespace Apache.Ignite.Core.Impl /// Perform out operation. /// </summary> /// <param name="type">Operation type.</param> + /// <param name="action">Action to be performed on the stream.</param> + /// <returns>Resulting object.</returns> + protected IUnmanagedTarget DoOutOpObject(int type, Action<IBinaryStream> action) + { + using (var stream = IgniteManager.Memory.Allocate().GetStream()) + { + action(stream); + + return UU.TargetInStreamOutObject(_target, type, stream.SynchronizeOutput()); + } + } + + /// <summary> + /// Perform out operation. + /// </summary> + /// <param name="type">Operation type.</param> /// <returns>Resulting object.</returns> protected IUnmanagedTarget DoOutOpObject(int type) { http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs index cc20cb3..eac7556 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs @@ -20,7 +20,6 @@ namespace Apache.Ignite.Core.Impl.Plugin using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Resource; - using Apache.Ignite.Core.Impl.Unmanaged; using Apache.Ignite.Core.Interop; using Apache.Ignite.Core.Plugin; @@ -65,11 +64,7 @@ namespace Apache.Ignite.Core.Impl.Plugin /** <inheritdoc /> */ public IPlatformTarget GetExtension(int id) { - var ignite = _pluginProcessor.Ignite; - - var ext = UnmanagedUtils.ProcessorExtension(ignite.InteropProcessor, id); - - return new PlatformTarget(ext, ignite.Marshaller); + return _pluginProcessor.Ignite.GetExtension(id); } /** <inheritdoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs index 289589f..1720a79 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs @@ -30,105 +30,16 @@ namespace Apache.Ignite.Core.Impl.Unmanaged public static extern int Reallocate(long memPtr, int cap); [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStart")] - public static extern void* IgnitionStart(void* ctx, sbyte* cfgPath, sbyte* gridName, int factoryId, + public static extern void IgnitionStart(void* ctx, sbyte* cfgPath, sbyte* gridName, int factoryId, long dataPtr); [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStop")] [return: MarshalAs(UnmanagedType.U1)] public static extern bool IgnitionStop(void* ctx, sbyte* gridName, [MarshalAs(UnmanagedType.U1)] bool cancel); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStopAll")] - public static extern void IgnitionStopAll(void* ctx, [MarshalAs(UnmanagedType.U1)] bool cancel); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorReleaseStart")] - public static extern void ProcessorReleaseStart(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorProjection")] - public static extern void* ProcessorProjection(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCache")] - public static extern void* ProcessorCache(void* ctx, void* obj, sbyte* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateCache")] - public static extern void* ProcessorCreateCache(void* ctx, void* obj, sbyte* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateCacheFromConfig")] - public static extern void* ProcessorCreateCacheFromConfig(void* ctx, void* obj, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateCache")] - public static extern void* ProcessorGetOrCreateCache(void* ctx, void* obj, sbyte* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateCacheFromConfig")] - public static extern void* ProcessorGetOrCreateCacheFromConfig(void* ctx, void* obj, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateNearCache")] - public static extern void* ProcessorCreateNearCache(void* ctx, void* obj, sbyte* name, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateNearCache")] - public static extern void* ProcessorGetOrCreateNearCache(void* ctx, void* obj, sbyte* name, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorDestroyCache")] - public static extern void ProcessorDestroyCache(void* ctx, void* obj, sbyte* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAffinity")] - public static extern void* ProcessorAffinity(void* ctx, void* obj, sbyte* name); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorDataStreamer")] - public static extern void* ProcessorDataStreamer(void* ctx, void* obj, sbyte* name, - [MarshalAs(UnmanagedType.U1)] bool keepBinary); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorTransactions")] - public static extern void* ProcessorTransactions(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCompute")] - public static extern void* ProcessorCompute(void* ctx, void* obj, void* prj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorMessage")] - public static extern void* ProcessorMessage(void* ctx, void* obj, void* prj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorEvents")] - public static extern void* ProcessorEvents(void* ctx, void* obj, void* prj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorServices")] - public static extern void* ProcessorServices(void* ctx, void* obj, void* prj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtensions")] - public static extern void* ProcessorExtensions(void* ctx, void* obj); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtension")] - public static extern void* ProcessorExtension(void* ctx, void* obj, int id); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicLong")] - public static extern void* ProcessorAtomicLong(void* ctx, void* obj, sbyte* name, long initVal, - [MarshalAs(UnmanagedType.U1)] bool create); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicSequence")] - public static extern void* ProcessorAtomicSequence(void* ctx, void* obj, sbyte* name, long initVal, - [MarshalAs(UnmanagedType.U1)] bool create); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicReference")] - public static extern void* ProcessorAtomicReference(void* ctx, void* obj, sbyte* name, long memPtr, - [MarshalAs(UnmanagedType.U1)] bool create); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetIgniteConfiguration")] - public static extern void ProcessorGetIgniteConfiguration(void* ctx, void* obj, long memPtr); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetCacheNames")] - public static extern void ProcessorGetCacheNames(void* ctx, void* obj, long memPtr); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInLongOutLong")] public static extern long TargetInLongOutLong(void* ctx, void* target, int opType, long val); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerIsLevelEnabled")] - [return: MarshalAs(UnmanagedType.U1)] - public static extern bool ProcessorLoggerIsLevelEnabled(void* ctx, void* obj, int level); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerLog")] - public static extern void ProcessorLoggerLog(void* ctx, void* obj, int level, sbyte* messsage, sbyte* category, sbyte* errorInfo); - - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorBinaryProcessor")] - public static extern void* ProcessorBinaryProcessor(void* ctx, void* obj); - [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutLong")] public static extern long TargetInStreamOutLong(void* ctx, void* target, int opType, long memPtr);