ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [70/82] [abbrv] ignite git commit: IGNITE-1337: Moved "common" CPP project to Ignite.
Date Tue, 01 Sep 2015 12:08:19 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
new file mode 100644
index 0000000..9e57bde
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _IGNITE_COMMON_COMMON
+#define _IGNITE_COMMON_COMMON
+
+#define IGNITE_EXPORT __declspec(dllexport)
+#define IGNITE_IMPORT __declspec(dllimport)
+#define IGNITE_CALL __stdcall
+
+#define IGNITE_IMPORT_EXPORT IGNITE_EXPORT
+
+#include <iostream>
+
+#define IGNITE_TRACE_ALLOC(addr) \
+    std::cout << "ALLOC " << __FILE__ << "(" << __LINE__ << "): 0x" << (void*)addr << std::endl;
+
+/**
+ * Common construction to disable copy constructor and assignment for class.
+ */
+#define IGNITE_NO_COPY_ASSIGNMENT(cls) \
+    cls(const cls& src); \
+    cls& operator= (const cls& other); 
+
+namespace ignite
+{
+    namespace common
+    {
+        /**
+         * Helper class to manage attached threads.
+         */
+        class AttachHelper 
+        {
+        public:                       
+            /**
+             * Callback invoked on successful thread attach ot JVM.
+             */
+            static void OnThreadAttach();
+        };   
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
new file mode 100644
index 0000000..0a47beb
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_COMMON_CONCURRENT_OS
+#define _IGNITE_COMMON_CONCURRENT_OS
+
+#include <map>
+#include <stdint.h>
+#include <windows.h>
+
+#include "ignite/common/common.h"
+
+namespace ignite
+{
+    namespace common 
+    {
+        namespace concurrent 
+        {
+            /**
+             * Static class to manage memory visibility semantics. 
+             */
+            class IGNITE_IMPORT_EXPORT Memory {
+            public:
+                /**
+                 * Full fence. 
+                 */
+                static void Fence();
+            };
+
+            /**
+             * Critical section.
+             */
+            class IGNITE_IMPORT_EXPORT CriticalSection {
+            public:
+                /**
+                 * Constructor.
+                 */
+                CriticalSection();
+
+                /**
+                 * Destructor. 
+                 */
+                ~CriticalSection();
+
+                /**
+                 * Enter critical section.
+                 */
+                void Enter();
+
+                /**
+                 * Leave critical section.
+                 */
+                void Leave();
+            private:
+                /** Handle. */
+                CRITICAL_SECTION* hnd;
+
+                IGNITE_NO_COPY_ASSIGNMENT(CriticalSection)
+            };
+
+            /**
+             * Special latch with count = 1.
+             */
+            class IGNITE_IMPORT_EXPORT SingleLatch
+            {                
+            public:
+                /**
+                 * Constructor.
+                 */
+                SingleLatch();
+
+                /**
+                 * Destructor.
+                 */
+                ~SingleLatch();
+
+                /**
+                 * Perform the countdown.
+                 */
+                void CountDown();
+
+                /**
+                 * Await the countdown.
+                 */
+                void Await();
+            private:
+                /** Handle. */
+                void* hnd;
+
+                IGNITE_NO_COPY_ASSIGNMENT(SingleLatch)
+            };
+
+            /**
+             * Primitives for atomic access.
+             */
+            class IGNITE_IMPORT_EXPORT Atomics
+            {
+            public:
+                /**
+                 * Update the 32-bit integer value if it is equal to expected value.
+                 *
+                 * @param ptr Pointer.
+                 * @param expVal Expected value.
+                 * @param newVal New value.
+                 * @return True if update occurred as a result of this call, false otherwise.
+                 */
+                static bool CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal);
+
+                /**
+                 * Update the 32-bit integer value if it is equal to expected value.
+                 *
+                 * @param ptr Pointer.
+                 * @param expVal Expected value.
+                 * @param newVal New value.
+                 * @return Value which were observed during CAS attempt.
+                 */
+                static int32_t CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal);
+                
+                /**
+                 * Increment 32-bit integer and return new value.
+                 *
+                 * @param ptr Pointer.
+                 * @return Value after increment.
+                 */
+                static int32_t IncrementAndGet32(int32_t* ptr);
+
+                /**
+                 * Decrement 32-bit integer and return new value.
+                 *
+                 * @param ptr Pointer.
+                 * @return Value after decrement.
+                 */
+                static int32_t DecrementAndGet32(int32_t* ptr);
+
+                /**
+                 * Update the 64-bit integer value if it is equal to expected value.
+                 *
+                 * @param ptr Pointer.
+                 * @param expVal Expected value.
+                 * @param newVal New value.
+                 * @return True if update occurred as a result of this call, false otherwise.
+                 */
+                static bool CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal);
+
+                /**
+                 * Update the 64-bit integer value if it is equal to expected value.
+                 *
+                 * @param ptr Pointer.
+                 * @param expVal Expected value.
+                 * @param newVal New value.
+                 * @return Value which were observed during CAS attempt.
+                 */
+                static int64_t CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal);
+                
+                /**
+                 * Increment 64-bit integer and return new value.
+                 *
+                 * @param ptr Pointer.
+                 * @return Value after increment.
+                 */
+                static int64_t IncrementAndGet64(int64_t* ptr);
+
+                /**
+                 * Decrement 64-bit integer and return new value.
+                 *
+                 * @param ptr Pointer.
+                 * @return Value after decrement.
+                 */
+                static int64_t DecrementAndGet64(int64_t* ptr);
+            };
+
+            /**
+             * Thread-local entry.
+             */
+            class IGNITE_IMPORT_EXPORT ThreadLocalEntry
+            {
+            public:
+                /**
+                 * Virtual destructor to allow for correct typed entries cleanup.
+                 */
+                virtual ~ThreadLocalEntry()
+                {
+                    // No-op.
+                }
+            };
+
+            /**
+             * Typed thread-local entry.
+             */
+            template<typename T>
+            class IGNITE_IMPORT_EXPORT ThreadLocalTypedEntry : public ThreadLocalEntry
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param val Value.
+                 */
+                ThreadLocalTypedEntry(T val) : val(val)
+                {
+                    // No-op.
+                }
+                
+                ~ThreadLocalTypedEntry()
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Get value.
+                 *
+                 * @return Value.
+                 */
+                T Get()
+                {
+                    return val;
+                }
+            private:
+                /** Value. */
+                T val; 
+            };
+
+            /**
+             * Thread-local abstraction.
+             */
+            class IGNITE_IMPORT_EXPORT ThreadLocal
+            {
+            public:
+                /**
+                 * Allocate thread-local index. Invoked once on DLL process attach.
+                 *
+                 * @return True if allocation was successful.
+                 */
+                static bool OnProcessAttach();
+
+                /**
+                 * Release thread-local entry. Invoked on DLL thread detach.
+                 */
+                static void OnThreadDetach();
+
+                /**
+                 * Release thread-local index. Invoked once on DLL process detach.
+                 */
+                static void OnProcessDetach();
+
+                /**
+                 * Get next available index to be used in thread-local storage.
+                 *
+                 * @return Index.
+                 */
+                static int32_t NextIndex();
+
+                /**
+                 * Get value by index.
+                 *
+                 * @param idx Index.
+                 * @return Value associated with the index or NULL.
+                 */
+                template<typename T>
+                static T Get(int32_t idx)
+                {
+                    void* winVal = Get0();
+
+                    if (winVal)
+                    {
+                        std::map<int32_t, ThreadLocalEntry*>* map = 
+                            static_cast<std::map<int32_t, ThreadLocalEntry*>*>(winVal);
+
+                        ThreadLocalTypedEntry<T>* entry = static_cast<ThreadLocalTypedEntry<T>*>((*map)[idx]);
+                        
+                        if (entry)
+                            return entry->Get();
+                    }
+
+                    return T();
+                }
+
+                /**
+                 * Set value at the given index.
+                 *
+                 * @param idx Index.
+                 * @param val Value to be associated with the index.
+                 */
+                template<typename T>
+                static void Set(int32_t idx, const T& val)
+                {
+                    void* winVal = Get0();
+
+                    if (winVal)
+                    {
+                        std::map<int32_t, ThreadLocalEntry*>* map = 
+                            static_cast<std::map<int32_t, ThreadLocalEntry*>*>(winVal);
+
+                        ThreadLocalEntry* appVal = (*map)[idx];
+
+                        if (appVal)
+                            delete appVal;
+
+                        (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
+                    }
+                    else
+                    {
+                        std::map<int32_t, ThreadLocalEntry*>* map = new std::map<int32_t, ThreadLocalEntry*>();
+
+                        Set0(map);
+
+                        (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
+                    }
+                }
+
+                /**
+                 * Remove value at the given index.
+                 *
+                 * @param idx Index.
+                 */
+                static void Remove(int32_t idx);
+
+            private:
+                /**
+                 * Internal get routine.
+                 *
+                 * @param Associated value.
+                 */
+                static void* Get0();
+
+                /**
+                 * Internal set routine.
+                 *
+                 * @param ptr Pointer.
+                 */
+                static void Set0(void* ptr);
+
+                /**
+                 * Internal thread-local map clear routine.
+                 *
+                 * @param mapPtr Pointer to map.
+                 */
+                static void Clear0(void* mapPtr);
+            };
+
+            /**
+             * Thread-local instance. Simplifies API avoiding direct index allocations.
+             */
+            template<typename T>
+            class IGNITE_IMPORT_EXPORT ThreadLocalInstance
+            {
+            public:
+                /**
+                 * Constructor.
+                 */
+                ThreadLocalInstance() : idx(ThreadLocal::NextIndex())
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Get value.
+                 *
+                 * @return Value.
+                 */
+                T Get()
+                {
+                    return ThreadLocal::Get<T>(idx);
+                }
+
+                /**
+                 * Set instance.
+                 *
+                 * @param val Value.
+                 */
+                void Set(const T& val)
+                {
+                    ThreadLocal::Set<T>(idx, val);
+                }
+
+                /**
+                 * Remove instance.
+                 */
+                void Remove()
+                {
+                    ThreadLocal::Remove(idx);
+                }
+
+            private:
+                /** Index. */
+                int32_t idx; 
+            };
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/os/win/src/common.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/src/common.cpp b/modules/platform/src/main/cpp/common/os/win/src/common.cpp
new file mode 100644
index 0000000..e83e736
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/os/win/src/common.cpp
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+
+#include "ignite/common/common.h"
+#include "ignite/common/concurrent.h"
+#include "ignite/common/java.h"
+
+using namespace ignite::common::concurrent;
+using namespace ignite::common::java;
+
+namespace ignite
+{
+    namespace common
+    {
+        void AttachHelper::OnThreadAttach()
+        {
+            // No-op.
+        }
+    }
+}
+
+BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
+{
+    switch (fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            if (!ThreadLocal::OnProcessAttach())
+                return FALSE;
+
+            break;
+
+        case DLL_THREAD_DETACH:
+            ThreadLocal::OnThreadDetach();
+
+            JniContext::Detach();
+
+            break;
+
+        case DLL_PROCESS_DETACH:
+            ThreadLocal::OnProcessDetach();
+
+            break;
+
+        default:
+            break;
+    }
+
+    return TRUE;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp b/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
new file mode 100644
index 0000000..a21f7ec
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ignite/common/concurrent_os.h"
+
+namespace ignite
+{
+    namespace common
+    {
+        namespace concurrent
+        {
+            /** Thread-local index for Windows. */
+            DWORD winTlsIdx;
+
+            void Memory::Fence() {
+                MemoryBarrier();
+            }
+
+            CriticalSection::CriticalSection() : hnd(new CRITICAL_SECTION) {
+                InitializeCriticalSection(hnd);
+
+                Memory::Fence();
+            }
+
+            CriticalSection::~CriticalSection() {
+                Memory::Fence();
+
+                delete hnd;
+            }
+
+            void CriticalSection::Enter() {
+                Memory::Fence();
+
+                EnterCriticalSection(hnd);
+            }
+
+            void CriticalSection::Leave() {
+                Memory::Fence();
+
+                LeaveCriticalSection(hnd);
+            }
+
+            SingleLatch::SingleLatch() : hnd(CreateEvent(NULL, TRUE, FALSE, NULL))
+            {
+                Memory::Fence();
+            }
+
+            SingleLatch::~SingleLatch()
+            {
+                Memory::Fence();
+
+                CloseHandle(hnd);
+            }
+
+            void SingleLatch::CountDown()
+            {
+                SetEvent(hnd);
+            }
+
+            void SingleLatch::Await()
+            {
+                WaitForSingleObject(hnd, INFINITE);
+            }
+
+            bool Atomics::CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal)
+            {
+                return CompareAndSet32Val(ptr, expVal, newVal) == expVal;
+            }
+
+            int32_t Atomics::CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal)
+            {
+                return InterlockedCompareExchange(reinterpret_cast<LONG*>(ptr), newVal, expVal);
+            }
+
+            int32_t Atomics::IncrementAndGet32(int32_t* ptr)
+            {
+                return InterlockedIncrement(reinterpret_cast<LONG*>(ptr));
+            }
+
+            int32_t Atomics::DecrementAndGet32(int32_t* ptr)
+            {
+                return InterlockedDecrement(reinterpret_cast<LONG*>(ptr));
+            }
+
+            bool Atomics::CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal)
+            {
+                return CompareAndSet64Val(ptr, expVal, newVal) == expVal;
+            }
+
+            int64_t Atomics::CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal)
+            {
+                return InterlockedCompareExchange64(reinterpret_cast<LONG64*>(ptr), newVal, expVal);
+            }
+
+            int64_t Atomics::IncrementAndGet64(int64_t* ptr)
+            {
+                return InterlockedIncrement64(reinterpret_cast<LONG64*>(ptr));
+            }
+
+            int64_t Atomics::DecrementAndGet64(int64_t* ptr)
+            {
+                return InterlockedDecrement64(reinterpret_cast<LONG64*>(ptr));
+            }
+            
+            bool ThreadLocal::OnProcessAttach()
+            {
+                return (winTlsIdx = TlsAlloc()) != TLS_OUT_OF_INDEXES;
+            }
+
+            void ThreadLocal::OnThreadDetach()
+            {
+                if (winTlsIdx != TLS_OUT_OF_INDEXES)
+                {
+                    void* mapPtr = Get0();
+
+                    Clear0(mapPtr);
+                }
+            }
+
+            void ThreadLocal::OnProcessDetach()
+            {
+                if (winTlsIdx != TLS_OUT_OF_INDEXES)
+                    TlsFree(winTlsIdx);
+            }
+
+            void* ThreadLocal::Get0()
+            {
+                return TlsGetValue(winTlsIdx);
+            }
+
+            void ThreadLocal::Set0(void* ptr)
+            {
+                TlsSetValue(winTlsIdx, ptr);
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/README.TXT b/modules/platform/src/main/cpp/common/project/README.TXT
new file mode 100644
index 0000000..97f4c64
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/README.TXT
@@ -0,0 +1 @@
+Contains IDE projects artifacts.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/README.TXT b/modules/platform/src/main/cpp/common/project/vs/README.TXT
new file mode 100644
index 0000000..f4fb456
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/vs/README.TXT
@@ -0,0 +1 @@
+Contains Visual Studio project artifacts.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
new file mode 100644
index 0000000..478932f
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{4F7E4917-4612-4B96-9838-025711ADE391}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>common</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v100</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v100</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v100</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v100</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <TargetName>ignite.common</TargetName>
+    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <TargetName>ignite.common</TargetName>
+    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <TargetName>ignite.common</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <TargetName>ignite.common</TargetName>
+    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
+      <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
+      <OptimizeReferences>false</OptimizeReferences>
+      <EnableCOMDATFolding>false</EnableCOMDATFolding>
+      <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>false</SDLCheck>
+      <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
+      <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
+      <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <StringPooling>true</StringPooling>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
+      <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Full</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>false</SDLCheck>
+      <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <StringPooling>true</StringPooling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
+      <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\include\ignite\common\concurrent.h" />
+    <ClInclude Include="..\..\include\ignite\common\exports.h" />
+    <ClInclude Include="..\..\include\ignite\common\java.h" />
+    <ClInclude Include="..\..\os\win\include\ignite\common\common.h" />
+    <ClInclude Include="..\..\os\win\include\ignite\common\concurrent_os.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\os\win\src\common.cpp" />
+    <ClCompile Include="..\..\os\win\src\concurrent_os.cpp" />
+    <ClCompile Include="..\..\src\concurrent.cpp" />
+    <ClCompile Include="..\..\src\exports.cpp" />
+    <ClCompile Include="..\..\src\java.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ItemGroup>
+    <None Include="module.def" />
+  </ItemGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
new file mode 100644
index 0000000..3d4ae54
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Misc">
+      <UniqueIdentifier>{1dbec2be-5cb4-4f70-aef6-b4627d39b99b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Code">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\os\win\include\ignite\common\common.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\os\win\include\ignite\common\concurrent_os.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\common\exports.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\common\java.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\common\concurrent.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>Misc</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\os\win\src\common.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\concurrent.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\os\win\src\concurrent_os.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\exports.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\java.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="module.def">
+      <Filter>Misc</Filter>
+    </None>
+  </ItemGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/module.def b/modules/platform/src/main/cpp/common/project/vs/module.def
new file mode 100644
index 0000000..d9e8d2b
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/vs/module.def
@@ -0,0 +1,99 @@
+LIBRARY ignite.common.dll
+EXPORTS
+IgniteReallocate @1 
+IgniteIgnitionStart @2 
+IgniteIgnitionInstance @3 
+IgniteIgnitionEnvironmentPointer @4 
+IgniteIgnitionStop @5 
+IgniteIgnitionStopAll @6 
+IgniteTargetOutLong @7
+IgniteProcessorReleaseStart @8 
+IgniteProcessorProjection @9 
+IgniteProcessorCache @10 
+IgniteProcessorCreateCache @11 
+IgniteProcessorGetOrCreateCache @12 
+IgniteProcessorAffinity @13 
+IgniteProcessorDataStreamer @14 
+IgniteProcessorTransactions @15 
+IgniteProcessorServices @16
+IgniteTargetInStreamOutObject @17 
+IgniteTargetInStreamOutLong @18 
+IgniteTargetOutStream @19 
+IgniteTargetInStreamOutStream @20 
+IgniteTargetInObjectStreamOutStream @21 
+IgniteTargetListenFuture @22 
+IgniteTargetListenFutureForOperation @23 
+IgniteAffinityPartitions @24 
+IgniteCacheWithSkipStore @25 
+IgniteCacheWithNoRetries @26 
+IgniteCacheWithExpiryPolicy @27 
+IgniteCacheWithAsync @28 
+IgniteCacheWithKeepPortable @29 
+IgniteCacheClear @30 
+IgniteCacheRemoveAll @31 
+IgniteCacheOutOpQueryCursor @32 
+IgniteCacheOutOpContinuousQuery @33 
+IgniteCacheIterator @34 
+IgniteCacheLocalIterator @35 
+IgniteCacheEnterLock @36 
+IgniteCacheExitLock @37 
+IgniteCacheTryEnterLock @38 
+IgniteCacheCloseLock @39 
+IgniteCacheRebalance @40 
+IgniteCacheSize @41 
+IgniteCacheStoreCallbackInvoke @42 
+IgniteComputeWithNoFailover @43 
+IgniteComputeWithTimeout @44 
+IgniteComputeExecuteNative @45 
+IgniteContinuousQueryClose @46 
+IgniteContinuousQueryGetInitialQueryCursor @47 
+IgniteDataStreamerListenTopology @48 
+IgniteDataStreamerAllowOverwriteGet @49 
+IgniteDataStreamerAllowOverwriteSet @50 
+IgniteDataStreamerSkipStoreGet @51 
+IgniteDataStreamerSkipStoreSet @52 
+IgniteDataStreamerPerNodeBufferSizeGet @53 
+IgniteDataStreamerPerNodeBufferSizeSet @54 
+IgniteDataStreamerPerNodeParallelOperationsGet @55 
+IgniteDataStreamerPerNodeParallelOperationsSet @56 
+IgniteMessagingWithAsync @57 
+IgniteProjectionForOthers @58 
+IgniteProjectionForRemotes @59 
+IgniteProjectionForDaemons @60 
+IgniteProjectionForRandom @61 
+IgniteProjectionForOldest @62 
+IgniteProjectionForYoungest @63 
+IgniteProcessorCompute @64 
+IgniteProcessorMessage @65 
+IgniteProcessorEvents @66 
+IgniteProjectionResetMetrics @67 
+IgniteProjectionOutOpRet @68 
+IgniteQueryCursorIterator @69 
+IgniteQueryCursorClose @70 
+IgniteTransactionsStart @71 
+IgniteTransactionsCommit @72 
+IgniteTransactionsCommitAsync @73 
+IgniteTransactionsRollback @74 
+IgniteTransactionsRollbackAsync @75 
+IgniteTransactionsClose @76 
+IgniteTransactionsState @77 
+IgniteTransactionsSetRollbackOnly @78 
+IgniteTransactionsResetMetrics @79 
+IgniteAcquire @80 
+IgniteRelease @81 
+IgniteThrowToJava @82 
+IgniteHandlersSize @83 
+IgniteCreateContext @84 
+IgniteDeleteContext @85 
+IgniteDestroyJvm @86 
+IgniteEventsWithAsync @87 
+IgniteEventsStopLocalListen @88 
+IgniteEventsLocalListen @89 
+IgniteEventsIsEnabled @90 
+IgniteTargetOutObject @91 
+IgniteServicesWithAsync @92
+IgniteServicesWithServerKeepPortable @93
+IgniteServicesCancel @94
+IgniteServicesCancelAll @95
+IgniteServicesGetServiceProxy @96
+IgniteProcessorExtensions @97
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/project/vs/targetver.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/targetver.h b/modules/platform/src/main/cpp/common/project/vs/targetver.h
new file mode 100644
index 0000000..4bea158
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/project/vs/targetver.h
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/src/concurrent.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/concurrent.cpp b/modules/platform/src/main/cpp/common/src/concurrent.cpp
new file mode 100644
index 0000000..3f85b65
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/src/concurrent.cpp
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ignite/common/concurrent.h"
+
+namespace ignite
+{
+    namespace common
+    {
+        namespace concurrent
+        {
+            /** Thread-local index generator for application. */
+            int32_t appTlsIdxGen = 0;
+
+            int32_t ThreadLocal::NextIndex()
+            {
+                return Atomics::IncrementAndGet32(&appTlsIdxGen);
+            }
+
+            void ThreadLocal::Remove(int32_t idx)
+            {
+                void* val = Get0();
+
+                if (val)
+                {
+                    std::map<int32_t, ThreadLocalEntry*>* map =
+                        static_cast<std::map<int32_t, ThreadLocalEntry*>*>(val);
+
+                    ThreadLocalEntry* appVal = (*map)[idx];
+
+                    if (appVal)
+                        delete appVal;
+
+                    map->erase(idx);
+
+                    if (map->size() == 0)
+                    {
+                        delete map;
+
+                        Set0(NULL);
+                    }
+                }
+            }
+
+            void ThreadLocal::Clear0(void* mapPtr)
+            {
+                if (mapPtr)
+                {
+                    std::map<int32_t, ThreadLocalEntry*>* map =
+                        static_cast<std::map<int32_t, ThreadLocalEntry*>*>(mapPtr);
+
+                    for (std::map<int32_t, ThreadLocalEntry*>::iterator it = map->begin(); it != map->end(); ++it)
+                        delete it->second;
+
+                    delete map;
+                }
+            }
+
+            SharedPointerImpl::SharedPointerImpl(void* ptr) : ptr(ptr), refCnt(1)
+            {
+                Memory::Fence();
+            }
+
+            void* SharedPointerImpl::Pointer()
+            {
+                return ptr;
+            }
+
+            void SharedPointerImpl::Increment()
+            {
+                Atomics::IncrementAndGet32(&refCnt);
+            }
+
+            bool SharedPointerImpl::Decrement()
+            {
+                return Atomics::DecrementAndGet32(&refCnt) == 0;
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ca8cbc7/modules/platform/src/main/cpp/common/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/exports.cpp b/modules/platform/src/main/cpp/common/src/exports.cpp
new file mode 100644
index 0000000..10e4801
--- /dev/null
+++ b/modules/platform/src/main/cpp/common/src/exports.cpp
@@ -0,0 +1,413 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ignite/common/exports.h"
+#include "ignite/common/java.h"
+
+namespace gcj = ignite::common::java;
+
+/* --- Target methods. --- */
+extern "C" {
+    int IGNITE_CALL IgniteReallocate(long long memPtr, int cap) {
+        return gcj::JniContext::Reallocate(memPtr, cap);
+    }
+
+    void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* gridName, int factoryId, long long dataPtr) {
+        return ctx->IgnitionStart(cfgPath, gridName, factoryId, dataPtr);
+    }
+
+	void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* gridName) {
+        return ctx->IgnitionInstance(gridName);
+    }
+
+    long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* gridName) {
+        return ctx->IgnitionEnvironmentPointer(gridName);
+    }
+
+	bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* gridName, bool cancel) {
+        return ctx->IgnitionStop(gridName, cancel);
+    }
+
+	void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel) {
+        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 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));
+    }
+
+    long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
+        return ctx->TargetInStreamOutLong(static_cast<jobject>(obj), opType, memPtr);
+    }
+
+    void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr) {
+        ctx->TargetInStreamOutStream(static_cast<jobject>(obj), opType, inMemPtr, outMemPtr);
+    }
+
+    void* IGNITE_CALL IgniteTargetInStreamOutObject(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
+        return ctx->TargetInStreamOutObject(static_cast<jobject>(obj), opType, memPtr);
+    }
+
+    void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) {
+        ctx->TargetInObjectStreamOutStream(static_cast<jobject>(obj), opType, arg, inMemPtr, outMemPtr);
+    }
+    
+    long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType) {
+        return ctx->TargetOutLong(static_cast<jobject>(obj), opType);
+    }
+
+    void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
+        ctx->TargetOutStream(static_cast<jobject>(obj), opType, memPtr);
+    }
+
+    void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType) {
+        return ctx->TargetOutObject(static_cast<jobject>(obj), opType);
+    }
+
+    void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ) {
+        ctx->TargetListenFuture(static_cast<jobject>(obj), futId, typ);
+    }
+
+    void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId) {
+        ctx->TargetListenFutureForOperation(static_cast<jobject>(obj), futId, typ, opId);
+    }
+
+    int IGNITE_CALL IgniteAffinityPartitions(gcj::JniContext* ctx, void* obj) {
+        return ctx->AffinityPartitions(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheWithSkipStore(gcj::JniContext* ctx, void* obj) {
+        return ctx->CacheWithSkipStore(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheWithNoRetries(gcj::JniContext* ctx, void* obj) {
+        return ctx->CacheWithNoRetries(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheWithExpiryPolicy(gcj::JniContext* ctx, void* obj, long long create, long long update, long long access) {
+        return ctx->CacheWithExpiryPolicy(static_cast<jobject>(obj), create, update, access);
+    }
+
+    void* IGNITE_CALL IgniteCacheWithAsync(gcj::JniContext* ctx, void* obj) {
+        return ctx->CacheWithAsync(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheWithKeepPortable(gcj::JniContext* ctx, void* obj)
+    {
+        return ctx->CacheWithKeepPortable(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteCacheClear(gcj::JniContext* ctx, void* obj) {
+        ctx->CacheClear(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteCacheRemoveAll(gcj::JniContext* ctx, void* obj) {
+        ctx->CacheRemoveAll(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheOutOpQueryCursor(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
+        return ctx->CacheOutOpQueryCursor(static_cast<jobject>(obj), type, memPtr);
+    }
+
+    void* IGNITE_CALL IgniteCacheOutOpContinuousQuery(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
+        return ctx->CacheOutOpContinuousQuery(static_cast<jobject>(obj), type, memPtr);
+    }
+
+    void* IGNITE_CALL IgniteCacheIterator(gcj::JniContext* ctx, void* obj) {
+        return ctx->CacheIterator(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteCacheLocalIterator(gcj::JniContext* ctx, void* obj, int peekModes) {
+        return ctx->CacheLocalIterator(static_cast<jobject>(obj), peekModes);
+    }
+
+    void IGNITE_CALL IgniteCacheEnterLock(gcj::JniContext* ctx, void* obj, long long id) {
+        ctx->CacheEnterLock(static_cast<jobject>(obj), id);
+    }
+
+    void IGNITE_CALL IgniteCacheExitLock(gcj::JniContext* ctx, void* obj, long long id) {
+        ctx->CacheExitLock(static_cast<jobject>(obj), id);
+    }
+
+    bool IGNITE_CALL IgniteCacheTryEnterLock(gcj::JniContext* ctx, void* obj, long long id, long long timeout) {
+        return ctx->CacheTryEnterLock(static_cast<jobject>(obj), id, timeout);
+    }
+
+    void IGNITE_CALL IgniteCacheCloseLock(gcj::JniContext* ctx, void* obj, long long id) {
+        ctx->CacheCloseLock(static_cast<jobject>(obj), id);
+    }
+
+    void IGNITE_CALL IgniteCacheRebalance(gcj::JniContext* ctx, void* obj, long long futId) {
+        ctx->CacheRebalance(static_cast<jobject>(obj), futId);
+    }
+
+    int IGNITE_CALL IgniteCacheSize(gcj::JniContext* ctx, void* obj, int peekModes, bool loc) {
+        return ctx->CacheSize(static_cast<jobject>(obj), peekModes, loc);
+    }
+
+    void IGNITE_CALL IgniteComputeWithNoFailover(gcj::JniContext* ctx, void* obj) {
+        ctx->ComputeWithNoFailover(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteComputeWithTimeout(gcj::JniContext* ctx, void* obj, long long timeout) {
+        ctx->ComputeWithTimeout(static_cast<jobject>(obj), timeout);
+    }
+
+    void IGNITE_CALL IgniteComputeExecuteNative(gcj::JniContext* ctx, void* obj, long long taskPtr, long long topVer) {
+        ctx->ComputeExecuteNative(static_cast<jobject>(obj), taskPtr, topVer);
+    }
+
+    void IGNITE_CALL IgniteContinuousQueryClose(gcj::JniContext* ctx, void* obj) {
+        ctx->ContinuousQueryClose(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteContinuousQueryGetInitialQueryCursor(gcj::JniContext* ctx, void* obj) {
+        return ctx->ContinuousQueryGetInitialQueryCursor(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteCacheStoreCallbackInvoke(gcj::JniContext* ctx, void* obj, long long memPtr) {
+        ctx->CacheStoreCallbackInvoke(static_cast<jobject>(obj), memPtr);
+    }
+
+    void IGNITE_CALL IgniteDataStreamerListenTopology(gcj::JniContext* ctx, void* obj, long long ptr) {
+        ctx->DataStreamerListenTopology(static_cast<jobject>(obj), ptr);
+    }
+
+    bool IGNITE_CALL IgniteDataStreamerAllowOverwriteGet(gcj::JniContext* ctx, void* obj) {
+        return ctx->DataStreamerAllowOverwriteGet(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteDataStreamerAllowOverwriteSet(gcj::JniContext* ctx, void* obj, bool val) {
+        ctx->DataStreamerAllowOverwriteSet(static_cast<jobject>(obj), val);
+    }
+
+    bool IGNITE_CALL IgniteDataStreamerSkipStoreGet(gcj::JniContext* ctx, void* obj) {
+        return ctx->DataStreamerSkipStoreGet(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteDataStreamerSkipStoreSet(gcj::JniContext* ctx, void* obj, bool val) {
+        ctx->DataStreamerSkipStoreSet(static_cast<jobject>(obj), val);
+    }
+
+    int IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeGet(gcj::JniContext* ctx, void* obj) {
+        return ctx->DataStreamerPerNodeBufferSizeGet(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeSet(gcj::JniContext* ctx, void* obj, int val) {
+        ctx->DataStreamerPerNodeBufferSizeSet(static_cast<jobject>(obj), val);
+    }
+
+    int IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsGet(gcj::JniContext* ctx, void* obj) {
+        return ctx->DataStreamerPerNodeParallelOperationsGet(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsSet(gcj::JniContext* ctx, void* obj, int val) {
+        ctx->DataStreamerPerNodeParallelOperationsSet(static_cast<jobject>(obj), val);
+    }
+
+    void* IGNITE_CALL IgniteMessagingWithAsync(gcj::JniContext* ctx, void* obj) {
+        return ctx->MessagingWithAsync(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForOthers(gcj::JniContext* ctx, void* obj, void* prj) {
+        return ctx->ProjectionForOthers(static_cast<jobject>(obj), static_cast<jobject>(prj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForRemotes(gcj::JniContext* ctx, void* obj) {
+        return ctx->ProjectionForRemotes(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForDaemons(gcj::JniContext* ctx, void* obj) {
+        return ctx->ProjectionForDaemons(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForRandom(gcj::JniContext* ctx, void* obj) {
+        return ctx->ProjectionForRandom(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForOldest(gcj::JniContext* ctx, void* obj) {
+        return ctx->ProjectionForOldest(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionForYoungest(gcj::JniContext* ctx, void* obj) {
+        return ctx->ProjectionForYoungest(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteProjectionResetMetrics(gcj::JniContext* ctx, void* obj) {
+        ctx->ProjectionResetMetrics(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteProjectionOutOpRet(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
+        return ctx->ProjectionOutOpRet(static_cast<jobject>(obj), type, memPtr);
+    }
+
+    void IGNITE_CALL IgniteQueryCursorIterator(gcj::JniContext* ctx, void* obj) {
+        ctx->QueryCursorIterator(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteQueryCursorClose(gcj::JniContext* ctx, void* obj) {
+        ctx->QueryCursorClose(static_cast<jobject>(obj));
+    }
+
+    long long IGNITE_CALL IgniteTransactionsStart(gcj::JniContext* ctx, void* obj, int concurrency, int isolation, long long timeout, int txSize) {
+        return ctx->TransactionsStart(static_cast<jobject>(obj), concurrency, isolation, timeout, txSize);
+    }   
+
+    int IGNITE_CALL IgniteTransactionsCommit(gcj::JniContext* ctx, void* obj, long long id) {
+        return ctx->TransactionsCommit(static_cast<jobject>(obj), id);
+    }
+
+    void IGNITE_CALL IgniteTransactionsCommitAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId) {
+        return ctx->TransactionsCommitAsync(static_cast<jobject>(obj), id, futId);
+    }
+
+    int IGNITE_CALL IgniteTransactionsRollback(gcj::JniContext* ctx, void* obj, long long id) {
+        return ctx->TransactionsRollback(static_cast<jobject>(obj), id);
+    }
+
+    void IGNITE_CALL IgniteTransactionsRollbackAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId) {
+        return ctx->TransactionsRollbackAsync(static_cast<jobject>(obj), id, futId);
+    }
+
+    int IGNITE_CALL IgniteTransactionsClose(gcj::JniContext* ctx, void* obj, long long id) {
+        return ctx->TransactionsClose(static_cast<jobject>(obj), id);
+    }
+
+    int IGNITE_CALL IgniteTransactionsState(gcj::JniContext* ctx, void* obj, long long id) {
+        return ctx->TransactionsState(static_cast<jobject>(obj), id);
+    }
+
+    bool IGNITE_CALL IgniteTransactionsSetRollbackOnly(gcj::JniContext* ctx, void* obj, long long id) {
+        return ctx->TransactionsSetRollbackOnly(static_cast<jobject>(obj), id);
+    }
+
+    void IGNITE_CALL IgniteTransactionsResetMetrics(gcj::JniContext* ctx, void* obj) {
+        ctx->TransactionsResetMetrics(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteAcquire(gcj::JniContext* ctx, void* obj) {
+        return ctx->Acquire(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteRelease(void* obj) {
+        gcj::JniContext::Release(static_cast<jobject>(obj));
+    }
+
+    void IGNITE_CALL IgniteThrowToJava(gcj::JniContext* ctx, char* err) {
+        ctx->ThrowToJava(err);
+    }
+    
+    int IGNITE_CALL IgniteHandlersSize() {
+        return sizeof(gcj::JniHandlers);
+    }
+
+    void* IGNITE_CALL IgniteCreateContext(char** opts, int optsLen, gcj::JniHandlers* cbs) {
+        return gcj::JniContext::Create(opts, optsLen, *cbs);
+    }
+
+    void IGNITE_CALL IgniteDeleteContext(gcj::JniContext* ctx) {
+        delete ctx;
+    }
+
+    void IGNITE_CALL IgniteDestroyJvm(gcj::JniContext* ctx) {
+        ctx->DestroyJvm();
+    }
+
+    void* IGNITE_CALL IgniteEventsWithAsync(gcj::JniContext* ctx, void* obj) {
+        return ctx->EventsWithAsync(static_cast<jobject>(obj));
+    }
+
+    bool IGNITE_CALL IgniteEventsStopLocalListen(gcj::JniContext* ctx, void* obj, long long hnd) {
+        return ctx->EventsStopLocalListen(static_cast<jobject>(obj), hnd);
+    }
+
+    void IGNITE_CALL IgniteEventsLocalListen(gcj::JniContext* ctx, void* obj, long long hnd, int type) {
+        ctx->EventsLocalListen(static_cast<jobject>(obj), hnd, type);
+    }
+
+    bool IGNITE_CALL IgniteEventsIsEnabled(gcj::JniContext* ctx, void* obj, int type) {
+        return ctx->EventsIsEnabled(static_cast<jobject>(obj), type);
+    }    
+    
+	void* IGNITE_CALL IgniteServicesWithAsync(gcj::JniContext* ctx, void* obj) {
+		return ctx->ServicesWithAsync(static_cast<jobject>(obj));
+    }
+
+    void* IGNITE_CALL IgniteServicesWithServerKeepPortable(gcj::JniContext* ctx, void* obj) {
+    		return ctx->ServicesWithServerKeepPortable(static_cast<jobject>(obj));
+        }
+
+	void IGNITE_CALL IgniteServicesCancel(gcj::JniContext* ctx, void* obj, char* name) {
+		ctx->ServicesCancel(static_cast<jobject>(obj), name);
+    }
+
+	void IGNITE_CALL IgniteServicesCancelAll(gcj::JniContext* ctx, void* obj) {
+		ctx->ServicesCancelAll(static_cast<jobject>(obj));
+    }
+
+	void* IGNITE_CALL IgniteServicesGetServiceProxy(gcj::JniContext* ctx, void* obj, char* name, bool sticky) {
+		return ctx->ServicesGetServiceProxy(static_cast<jobject>(obj), name, sticky);
+    }
+}
\ No newline at end of file


Mime
View raw message