http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
deleted file mode 100644
index c86de5d..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.dotnet;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.portable.PortableRawReaderEx;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import 
org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
-import 
org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStoreCallback;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.internal.util.lang.GridTuple;
-import org.apache.ignite.internal.util.lang.IgniteInClosureX;
-import org.apache.ignite.internal.util.typedef.C1;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.jetbrains.annotations.Nullable;
-
-import javax.cache.Cache;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import java.util.AbstractMap;
-import java.util.AbstractSet;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Wrapper for .NET cache store implementations.
- * <p>
- * This wrapper should be used if you have an implementation of
- * {@code GridGain.Cache.IGridCacheStore} interface in .NET and
- * would like to configure it a persistence storage for your cache.
- * If properly configured, this wrapper will instantiate an instance
- * of your cache store in .NET and delegate all calls to that instance.
- * To create an instance, assembly name and class name are passed to
- * <a target="_blank" 
href="http://msdn.microsoft.com/en-us/library/d133hta4.aspx";>System.Activator.CreateInstance(String,
 String)</a>
- * method in .NET during node startup. Refer to its documentation for
- * details.
- */
-public class PlatformDotNetCacheStore<K, V> implements CacheStore<K, V>, 
PlatformCacheStore {
-    /** Load cache operation code. */
-    private static final byte OP_LOAD_CACHE = (byte)0;
-
-    /** Load operation code. */
-    private static final byte OP_LOAD = (byte)1;
-
-    /** Load all operation code. */
-    private static final byte OP_LOAD_ALL = (byte)2;
-
-    /** Put operation code. */
-    private static final byte OP_PUT = (byte)3;
-
-    /** Put all operation code. */
-    private static final byte OP_PUT_ALL = (byte)4;
-
-    /** Remove operation code. */
-    private static final byte OP_RMV = (byte)5;
-
-    /** Remove all operation code. */
-    private static final byte OP_RMV_ALL = (byte)6;
-
-    /** Tx end operation code. */
-    private static final byte OP_SES_END = (byte)7;
-
-    /** Key used to distinguish session deployment.  */
-    private static final Object KEY_SES = new Object();
-
-    /** */
-    @CacheStoreSessionResource
-    private CacheStoreSession ses;
-
-    /** .Net assembly name. */
-    private String assemblyName;
-
-    /** .Net class name. */
-    private String clsName;
-
-    /** Properties. */
-    private Map<String, ?> props;
-
-    /** Interop processor. */
-    protected PlatformContext platformCtx;
-
-    /** Pointer to native store. */
-    protected long ptr;
-
-    /**
-     * Gets .NET assembly name.
-     *
-     * @return .NET assembly name.
-     */
-    public String getAssemblyName() {
-        return assemblyName;
-    }
-
-    /**
-     * Set .NET assembly name.
-     *
-     * @param assemblyName .NET assembly name.
-     */
-    public void setAssemblyName(String assemblyName) {
-        this.assemblyName = assemblyName;
-    }
-
-    /**
-     * Gets .NET class name.
-     *
-     * @return .NET class name.
-     */
-    public String getClassName() {
-        return clsName;
-    }
-
-    /**
-     * Sets .NET class name.
-     *
-     * @param clsName .NET class name.
-     */
-    public void setClassName(String clsName) {
-        this.clsName = clsName;
-    }
-
-    /**
-     * Get properties.
-     *
-     * @return Properties.
-     */
-    public Map<String, ?> getProperties() {
-        return props;
-    }
-
-    /**
-     * Set properties.
-     *
-     * @param props Properties.
-     */
-    public void setProperties(Map<String, ?> props) {
-        this.props = props;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V load(final K key) {
-        try {
-            final GridTuple<V> val = new GridTuple<>();
-
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_LOAD);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeObject(key);
-                }
-            }, new LoadCallback<>(platformCtx, val));
-
-            return val.get();
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheLoaderException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map<K, V> loadAll(final Iterable<? extends K> keys) {
-        try {
-            final Map<K, V> loaded = new HashMap<>();
-
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_LOAD_ALL);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeCollection((Collection) keys);
-                }
-            }, new LoadAllCallback<>(platformCtx, loaded));
-
-            return loaded;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheLoaderException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void loadCache(final IgniteBiInClosure<K, V> clo, final 
@Nullable Object... args) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_LOAD_CACHE);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeObjectArray(args);
-                }
-            }, new LoadCacheCallback<>(platformCtx, clo));
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheLoaderException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(final Cache.Entry<? extends K, ? extends V> 
entry) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_PUT);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeObject(entry.getKey());
-                    writer.writeObject(entry.getValue());
-                }
-            }, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"NullableProblems", "unchecked"})
-    @Override public void writeAll(final Collection<Cache.Entry<? extends K, ? 
extends V>> entries) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    Map<K, V> map = new AbstractMap<K, V>() {
-                        @Override public int size() {
-                            return entries.size();
-                        }
-
-                        @Override public Set<Entry<K, V>> entrySet() {
-                            return new AbstractSet<Entry<K, V>>() {
-                                @Override public Iterator<Entry<K, V>> 
iterator() {
-                                    return F.iterator(entries, new 
C1<Cache.Entry<? extends K, ? extends V>, Entry<K, V>>() {
-                                        private static final long 
serialVersionUID = 0L;
-
-                                        @Override public Entry<K, V> 
apply(Cache.Entry<? extends K, ? extends V> entry) {
-                                            return new 
GridMapEntry<>(entry.getKey(), entry.getValue());
-                                        }
-                                    }, true);
-                                }
-
-                                @Override public int size() {
-                                    return entries.size();
-                                }
-                            };
-                        }
-                    };
-
-                    writer.writeByte(OP_PUT_ALL);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeMap(map);
-                }
-            }, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void delete(final Object key) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_RMV);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeObject(key);
-                }
-            }, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void deleteAll(final Collection<?> keys) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_RMV_ALL);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeCollection(keys);
-                }
-            }, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void sessionEnd(final boolean commit) {
-        try {
-            doInvoke(new IgniteInClosureX<PortableRawWriterEx>() {
-                @Override public void applyx(PortableRawWriterEx writer) 
throws IgniteCheckedException {
-                    writer.writeByte(OP_SES_END);
-                    writer.writeLong(session());
-                    writer.writeString(ses.cacheName());
-                    writer.writeBoolean(commit);
-                }
-            }, null);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheWriterException(U.convertExceptionNoWrap(e));
-        }
-    }
-
-    /**
-     * Initialize the store.
-     *
-     * @param ctx Context.
-     * @param convertPortable Convert portable flag.
-     * @throws org.apache.ignite.IgniteCheckedException
-     */
-    public void initialize(GridKernalContext ctx, boolean convertPortable) 
throws IgniteCheckedException {
-        A.notNull(assemblyName, "assemblyName");
-        A.notNull(clsName, "clsName");
-
-        platformCtx = PlatformUtils.platformContext(ctx.grid());
-
-        try (PlatformMemory mem = platformCtx.memory().allocate()) {
-            PlatformOutputStream out = mem.output();
-
-            PortableRawWriterEx writer = platformCtx.writer(out);
-
-            writer.writeString(assemblyName);
-            writer.writeString(clsName);
-            writer.writeBoolean(convertPortable);
-            writer.writeMap(props);
-
-            out.synchronize();
-
-            ptr = platformCtx.gateway().cacheStoreCreate(mem.pointer());
-        }
-    }
-
-    /**
-     * Gets session pointer created in native platform.
-     *
-     * @return Session pointer.
-     * @throws org.apache.ignite.IgniteCheckedException If failed.
-     */
-    private long session() throws IgniteCheckedException {
-        Long sesPtr = (Long)ses.properties().get(KEY_SES);
-
-        if (sesPtr == null) {
-            // Session is not deployed yet, do that.
-            sesPtr = platformCtx.gateway().cacheStoreSessionCreate(ptr);
-
-            ses.properties().put(KEY_SES, sesPtr);
-        }
-
-        return sesPtr;
-    }
-
-    /**
-     * Perform actual invoke.
-     *
-     * @param task Task.
-     * @param cb Optional callback.
-     * @return Result.
-     * @throws org.apache.ignite.IgniteCheckedException If failed.
-     */
-    protected int doInvoke(IgniteInClosureX<PortableRawWriterEx> task, 
@Nullable PlatformCacheStoreCallback cb)
-        throws IgniteCheckedException{
-        try (PlatformMemory mem = platformCtx.memory().allocate()) {
-            PlatformOutputStream out = mem.output();
-
-            PortableRawWriterEx writer = platformCtx.writer(out);
-
-            task.apply(writer);
-
-            out.synchronize();
-
-            return platformCtx.gateway().cacheStoreInvoke(ptr, mem.pointer(), 
cb);
-        }
-    }
-
-    /**
-     * Destroys interop-aware component.
-     *
-     * @param ctx Context.
-     */
-    public void destroy(GridKernalContext ctx) {
-        assert ctx != null;
-
-        platformCtx.gateway().cacheStoreDestroy(ptr);
-    }
-
-    /**
-     * Load callback.
-     */
-    private static class LoadCallback<V> extends PlatformCacheStoreCallback {
-        /** Value. */
-        private final GridTuple<V> val;
-
-        /**
-         * Constructor.
-         *
-         * @param ctx Context.
-         * @param val Value.
-         */
-        public LoadCallback(PlatformContext ctx, GridTuple<V> val) {
-            super(ctx);
-
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("unchecked")
-        @Override protected void invoke0(PortableRawReaderEx reader) {
-            val.set((V)reader.readObjectDetached());
-        }
-    }
-
-    /**
-     * Load callback.
-     */
-    private static class LoadAllCallback<K, V> extends 
PlatformCacheStoreCallback {
-        /** Value. */
-        private final Map<K, V> loaded;
-
-        /**
-         * Constructor.
-         *
-         * @param ctx Context.
-         * @param loaded Map with loaded values.
-         */
-        public LoadAllCallback(PlatformContext ctx, Map<K, V> loaded) {
-            super(ctx);
-
-            this.loaded = loaded;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("unchecked")
-        @Override protected void invoke0(PortableRawReaderEx reader) {
-            loaded.put((K) reader.readObjectDetached(), (V) 
reader.readObjectDetached());
-        }
-    }
-
-    /**
-     * Load callback.
-     */
-    private static class LoadCacheCallback<K, V> extends 
PlatformCacheStoreCallback {
-        /** Value. */
-        private final IgniteBiInClosure<K, V> clo;
-
-        /**
-         * Constructor.
-         *
-         * @param ctx Context.
-         * @param clo Closure.
-         */
-        public LoadCacheCallback(PlatformContext ctx, IgniteBiInClosure<K, V> 
clo) {
-            super(ctx);
-
-            this.clo = clo;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("unchecked")
-        @Override protected void invoke0(PortableRawReaderEx reader) {
-            clo.apply((K) reader.readObjectDetached(), (V) 
reader.readObjectDetached());
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
deleted file mode 100644
index 8662375..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.dotnet;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PlatformConfiguration;
-import org.apache.ignite.internal.MarshallerContextImpl;
-import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableMetaDataHandler;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
-import 
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure;
-import 
org.apache.ignite.internal.processors.platform.lifecycle.PlatformLifecycleBean;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformInputStream;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lifecycle.LifecycleBean;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Closure to apply dot net configuration.
- */
-@SuppressWarnings({"UnusedDeclaration"})
-public class PlatformDotNetConfigurationClosure extends 
PlatformAbstractConfigurationClosure {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Configuration. */
-    private IgniteConfiguration cfg;
-
-    /** Memory manager. */
-    private PlatformMemoryManagerImpl memMgr;
-
-    /**
-     * Constructor.
-     *
-     * @param envPtr Environment pointer.
-     */
-    public PlatformDotNetConfigurationClosure(long envPtr) {
-        super(envPtr);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("deprecation")
-    @Override protected void apply0(IgniteConfiguration igniteCfg) {
-        // 3. Validate and copy Interop configuration setting environment 
pointer along the way.
-        PlatformConfiguration interopCfg = 
igniteCfg.getPlatformConfiguration();
-
-        if (interopCfg != null && !(interopCfg instanceof 
PlatformDotNetConfiguration))
-            throw new IgniteException("Illegal platform configuration (must be 
of type " +
-                PlatformDotNetConfiguration.class.getName() + "): " + 
interopCfg.getClass().getName());
-
-        PlatformDotNetConfiguration dotNetCfg = interopCfg != null ? 
(PlatformDotNetConfiguration)interopCfg : null;
-
-        if (dotNetCfg == null)
-            dotNetCfg = new PlatformDotNetConfiguration();
-
-        memMgr = new PlatformMemoryManagerImpl(gate, 1024);
-
-        PlatformDotNetConfigurationEx dotNetCfg0 = new 
PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr);
-
-        igniteCfg.setPlatformConfiguration(dotNetCfg0);
-
-        // Check marshaller
-        Marshaller marsh = igniteCfg.getMarshaller();
-
-        if (marsh == null) {
-            igniteCfg.setMarshaller(new PortableMarshaller());
-
-            dotNetCfg0.warnings(Collections.singleton("Marshaller is 
automatically set to " +
-                PortableMarshaller.class.getName() + " (other nodes must have 
the same marshaller type)."));
-        }
-        else if (!(marsh instanceof PortableMarshaller))
-            throw new IgniteException("Unsupported marshaller (only " + 
PortableMarshaller.class.getName() +
-                " can be used when running Ignite for .Net): " + 
marsh.getClass().getName());
-
-        // Set Ignite home so that marshaller context works.
-        String ggHome = igniteCfg.getIgniteHome();
-
-        if (ggHome == null)
-            ggHome = U.getIgniteHome();
-        else
-            // If user provided IGNITE_HOME - set it as a system property.
-            U.setIgniteHome(ggHome);
-
-        try {
-            U.setWorkDirectory(igniteCfg.getWorkDirectory(), ggHome);
-        }
-        catch (IgniteCheckedException e) {
-            throw U.convertException(e);
-        }
-
-        // 4. Callback to .Net.
-        prepare(igniteCfg, dotNetCfg0);
-    }
-
-    /**
-     * Prepare .Net size.
-     *
-     * @param igniteCfg Ignite configuration.
-     * @param interopCfg Interop configuration.
-     */
-    @SuppressWarnings("ConstantConditions")
-    private void prepare(IgniteConfiguration igniteCfg, 
PlatformDotNetConfigurationEx interopCfg) {
-        this.cfg = igniteCfg;
-
-        try (PlatformMemory outMem = memMgr.allocate()) {
-            try (PlatformMemory inMem = memMgr.allocate()) {
-                PlatformOutputStream out = outMem.output();
-
-                PortableRawWriterEx writer = marshaller().writer(out);
-
-                PlatformUtils.writeDotNetConfiguration(writer, 
interopCfg.unwrap());
-
-                List<PlatformDotNetLifecycleBean> beans = beans(igniteCfg);
-
-                writer.writeInt(beans.size());
-
-                for (PlatformDotNetLifecycleBean bean : beans) {
-                    writer.writeString(bean.getAssemblyName());
-                    writer.writeString(bean.getClassName());
-                    writer.writeMap(bean.getProperties());
-                }
-
-                out.synchronize();
-
-                gate.extensionCallbackInLongLongOutLong(
-                    PlatformUtils.OP_PREPARE_DOT_NET, outMem.pointer(), 
inMem.pointer());
-
-                processPrepareResult(inMem.input());
-            }
-        }
-    }
-
-    /**
-     * Process prepare result.
-     *
-     * @param in Input stream.
-     */
-    private void processPrepareResult(PlatformInputStream in) {
-        assert cfg != null;
-
-        List<PlatformDotNetLifecycleBean> beans = beans(cfg);
-        List<PlatformLifecycleBean> newBeans = new ArrayList<>();
-
-        int len = in.readInt();
-
-        for (int i = 0; i < len; i++) {
-            if (i < beans.size())
-                // Existing bean.
-                beans.get(i).initialize(gate, in.readLong());
-            else
-                // This bean is defined in .Net.
-                newBeans.add(new PlatformLifecycleBean(gate, in.readLong()));
-        }
-
-        if (!newBeans.isEmpty()) {
-            LifecycleBean[] newBeans0 = newBeans.toArray(new 
LifecycleBean[newBeans.size()]);
-
-            // New beans were added. Let's append them to the tail of the rest 
configured lifecycle beans.
-            LifecycleBean[] oldBeans = cfg.getLifecycleBeans();
-
-            if (oldBeans == null)
-                cfg.setLifecycleBeans(newBeans0);
-            else {
-                LifecycleBean[] mergedBeans = new 
LifecycleBean[oldBeans.length + newBeans.size()];
-
-                System.arraycopy(oldBeans, 0, mergedBeans, 0, oldBeans.length);
-                System.arraycopy(newBeans0, 0, mergedBeans, oldBeans.length, 
newBeans0.length);
-
-                cfg.setLifecycleBeans(mergedBeans);
-            }
-        }
-    }
-
-    /**
-     * Find .Net lifecycle beans in configuration.
-     *
-     * @param cfg Configuration.
-     * @return Beans.
-     */
-    private static List<PlatformDotNetLifecycleBean> beans(IgniteConfiguration 
cfg) {
-        List<PlatformDotNetLifecycleBean> res = new ArrayList<>();
-
-        if (cfg.getLifecycleBeans() != null) {
-            for (LifecycleBean bean : cfg.getLifecycleBeans()) {
-                if (bean instanceof PlatformDotNetLifecycleBean)
-                    res.add((PlatformDotNetLifecycleBean)bean);
-            }
-        }
-
-        return res;
-    }
-
-    /**
-     * Create portable marshaller.
-     *
-     * @return Marshaller.
-     */
-    @SuppressWarnings("deprecation")
-    private static GridPortableMarshaller marshaller() {
-        try {
-            PortableContext ctx = new PortableContext(new 
PortableMetaDataHandler() {
-                @Override public void addMeta(int typeId, PortableMetadata 
meta)
-                    throws PortableException {
-                    // No-op.
-                }
-
-                @Override public PortableMetadata metadata(int typeId) throws 
PortableException {
-                    return null;
-                }
-            }, null);
-
-            PortableMarshaller marsh = new PortableMarshaller();
-
-            marsh.setContext(new MarshallerContextImpl(null));
-
-            ctx.configure(marsh);
-
-            return new GridPortableMarshaller(ctx);
-        }
-        catch (IgniteCheckedException e) {
-            throw U.convertException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
deleted file mode 100644
index eaf0997..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.dotnet;
-
-import org.apache.ignite.internal.processors.platform.PlatformConfigurationEx;
-import 
org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
-
-import java.util.Collection;
-
-/**
- * Extended .Net configuration.
- */
-public class PlatformDotNetConfigurationEx extends PlatformDotNetConfiguration 
implements PlatformConfigurationEx {
-    /** Native gateway. */
-    private final PlatformCallbackGateway gate;
-
-    /** Memory manager. */
-    private final PlatformMemoryManagerImpl memMgr;
-
-    /** Warnings */
-    private Collection<String> warnings;
-
-    /**
-     * Copy constructor.
-     *
-     * @param cfg Configuration to copy.
-     * @param gate Native gateway.
-     * @param memMgr Memory manager.
-     */
-    public PlatformDotNetConfigurationEx(PlatformDotNetConfiguration cfg, 
PlatformCallbackGateway gate,
-        PlatformMemoryManagerImpl memMgr) {
-        super(cfg);
-
-        this.gate = gate;
-        this.memMgr = memMgr;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformCallbackGateway gate() {
-        return gate;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformMemoryManagerImpl memory() {
-        return memMgr;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String platform() {
-        return PlatformUtils.PLATFORM_DOTNET;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<String> warnings() {
-        return warnings;
-    }
-
-    /**
-     * @param warnings Warnings.
-     */
-    public void warnings(Collection<String> warnings) {
-        this.warnings = warnings;
-    }
-
-    /**
-     * Unwrap extended configuration.
-     *
-     * @return Original configuration.
-     */
-    public PlatformDotNetConfiguration unwrap() {
-        return new PlatformDotNetConfiguration(this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetService.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetService.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetService.java
deleted file mode 100644
index 1316c83..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.dotnet;
-
-import org.apache.ignite.internal.processors.platform.services.PlatformService;
-
-/**
- * Marker interface to denote a service implemented on .Net platform.
- */
-public interface PlatformDotNetService extends PlatformService {
-    // No-op.
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetServiceImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetServiceImpl.java
deleted file mode 100644
index ec241ee..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetServiceImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.dotnet;
-
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import 
org.apache.ignite.internal.processors.platform.services.PlatformAbstractService;
-
-/**
- * Interop .Net service.
- */
-public class PlatformDotNetServiceImpl extends PlatformAbstractService 
implements PlatformDotNetService {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Default constructor for serialization.
-     */
-    public PlatformDotNetServiceImpl() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param svc Service.
-     * @param ctx Context.
-     * @param srvKeepPortable Whether to keep objects portable on server if 
possible.
-     */
-    public PlatformDotNetServiceImpl(Object svc, PlatformContext ctx, boolean 
srvKeepPortable) {
-        super(svc, ctx, srvKeepPortable);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEventFilterListenerImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEventFilterListenerImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEventFilterListenerImpl.java
deleted file mode 100644
index b2dfd1c..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEventFilterListenerImpl.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.events;
-
-import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import 
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import 
org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-
-import java.util.UUID;
-
-/**
- * Platform event filter. Delegates apply to native platform.
- */
-public class PlatformEventFilterListenerImpl implements 
PlatformEventFilterListener
-{
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private final Object pred;
-
-    /** Event types. */
-    private final int[] types;
-
-    /** */
-    protected transient long hnd;
-
-    /** */
-    private transient PlatformContext ctx;
-
-    /**
-     * Constructor.
-     *
-     * @param hnd Handle in the native platform.
-     * @param ctx Context.
-     */
-    public PlatformEventFilterListenerImpl(long hnd, PlatformContext ctx) {
-        assert ctx != null;
-        assert hnd != 0;
-
-        this.hnd = hnd;
-        this.ctx = ctx;
-
-        pred = null;
-        types = null;
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param pred .Net portable predicate.
-     */
-    public PlatformEventFilterListenerImpl(Object pred, final int... types) {
-        assert pred != null;
-
-        this.pred = pred;
-        this.types = types;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean apply(Event evt) {
-        return apply0(null, evt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean apply(UUID uuid, Event evt) {
-        return apply0(uuid, evt);
-    }
-
-    /**
-     * Apply impl.
-     * @param uuid Node if.
-     * @param evt Event.
-     * @return Result.
-     */
-    private boolean apply0(final UUID uuid, final Event evt) {
-        if (!ctx.isEventTypeSupported(evt.type()))
-            return false;
-
-        if (types != null) {
-            boolean match = false;
-
-            for (int type : types) {
-                if (type == evt.type()) {
-                    match = true;
-                    break;
-                }
-            }
-
-            if (!match)
-                return false;
-        }
-
-        try (PlatformMemory mem = ctx.memory().allocate()) {
-            PlatformOutputStream out = mem.output();
-
-            PortableRawWriterEx writer = ctx.writer(out);
-
-            ctx.writeEvent(writer, evt);
-
-            writer.writeUuid(uuid);
-
-            out.synchronize();
-
-            int res = ctx.gateway().eventFilterApply(hnd, mem.pointer());
-
-            return res != 0;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onClose() {
-        ctx.gateway().eventFilterDestroy(hnd);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void initialize(GridKernalContext gridCtx) {
-        ctx = PlatformUtils.platformContext(gridCtx.grid());
-
-        try (PlatformMemory mem = ctx.memory().allocate()) {
-            PlatformOutputStream out = mem.output();
-
-            PortableRawWriterEx writer = ctx.writer(out);
-
-            writer.writeObjectDetached(pred);
-
-            out.synchronize();
-
-            hnd = ctx.gateway().eventFilterCreate(mem.pointer());
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        return this == o || o != null && o instanceof 
PlatformEventFilterListenerImpl &&
-            hnd == ((PlatformEventFilterListenerImpl)o).hnd;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return (int)(hnd ^ (hnd >>> 32));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
deleted file mode 100644
index 8585526..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.events;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteEvents;
-import org.apache.ignite.events.Event;
-import org.apache.ignite.events.EventAdapter;
-import org.apache.ignite.internal.portable.PortableRawReaderEx;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
-import 
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
-import 
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Interop events.
- */
-public class PlatformEvents extends PlatformAbstractTarget {
-    /** */
-    private static final int OP_REMOTE_QUERY = 1;
-
-    /** */
-    private static final int OP_REMOTE_LISTEN = 2;
-
-    /** */
-    private static final int OP_STOP_REMOTE_LISTEN = 3;
-
-    /** */
-    private static final int OP_WAIT_FOR_LOCAL = 4;
-
-    /** */
-    private static final int OP_LOCAL_QUERY = 5;
-
-    /** */
-    private static final int OP_RECORD_LOCAL = 6;
-
-    /** */
-    private static final int OP_ENABLE_LOCAL = 8;
-
-    /** */
-    private static final int OP_DISABLE_LOCAL = 9;
-
-    /** */
-    private static final int OP_GET_ENABLED_EVENTS = 10;
-
-    /** */
-    private final IgniteEvents events;
-
-    /** */
-    private final EventResultWriter eventResWriter;
-
-    /** */
-    private final EventCollectionResultWriter eventColResWriter;
-
-    /**
-     * Ctor.
-     *
-     * @param platformCtx Context.
-     * @param events Ignite events.
-     */
-    public PlatformEvents(PlatformContext platformCtx, IgniteEvents events) {
-        super(platformCtx);
-
-        assert events != null;
-
-        this.events = events;
-
-        eventResWriter = new EventResultWriter(platformCtx);
-        eventColResWriter = new EventCollectionResultWriter(platformCtx);
-    }
-
-    /**
-     * Gets events with asynchronous mode enabled.
-     *
-     * @return Events with asynchronous mode enabled.
-     */
-    public PlatformEvents withAsync() {
-        if (events.isAsync())
-            return this;
-
-        return new PlatformEvents(platformCtx, events.withAsync());
-    }
-
-    /**
-     * Adds an event listener for local events.
-     *
-     * @param hnd Interop listener handle.
-     * @param type Event type.
-     */
-    @SuppressWarnings({"unchecked"})
-    public void localListen(long hnd, int type) {
-        events.localListen(localFilter(hnd), type);
-    }
-
-    /**
-     * Removes an event listener for local events.
-     *
-     * @param hnd Interop listener handle.
-     */
-    @SuppressWarnings({"UnusedDeclaration", "unchecked"})
-    public boolean stopLocalListen(long hnd) {
-        return events.stopLocalListen(localFilter(hnd));
-    }
-
-    /**
-     * Check if event is enabled.
-     *
-     * @param type Event type.
-     * @return {@code True} if event of passed in type is enabled.
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    public boolean isEnabled(int type) {
-        return events.isEnabled(type);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long processInStreamOutLong(int type, 
PortableRawReaderEx reader)
-        throws IgniteCheckedException {
-        switch (type) {
-            case OP_RECORD_LOCAL:
-                // TODO: IGNITE-1410.
-                return TRUE;
-
-            case OP_ENABLE_LOCAL:
-
-                events.enableLocal(readEventTypes(reader));
-
-                return TRUE;
-
-            case OP_DISABLE_LOCAL:
-
-                events.disableLocal(readEventTypes(reader));
-
-                return TRUE;
-
-            case OP_STOP_REMOTE_LISTEN:
-                events.stopRemoteListen(reader.readUuid());
-
-                return TRUE;
-
-            default:
-                return super.processInStreamOutLong(type, reader);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"IfMayBeConditional", "ConstantConditions", 
"unchecked"})
-    @Override protected void processInStreamOutStream(int type, 
PortableRawReaderEx reader, PortableRawWriterEx writer)
-        throws IgniteCheckedException {
-        switch (type) {
-            case OP_LOCAL_QUERY: {
-                Collection<EventAdapter> result =
-                    events.localQuery(F.<EventAdapter>alwaysTrue(), 
readEventTypes(reader));
-
-                writer.writeInt(result.size());
-
-                for (EventAdapter e : result)
-                    platformCtx.writeEvent(writer, e);
-
-                break;
-            }
-
-            case OP_WAIT_FOR_LOCAL: {
-                boolean hasFilter = reader.readBoolean();
-
-                IgnitePredicate pred = hasFilter ? 
localFilter(reader.readLong()) : null;
-
-                int[] eventTypes = readEventTypes(reader);
-
-                EventAdapter result = (EventAdapter) events.waitForLocal(pred, 
eventTypes);
-
-                platformCtx.writeEvent(writer, result);
-
-                break;
-            }
-
-            case OP_REMOTE_LISTEN: {
-                int bufSize = reader.readInt();
-
-                long interval = reader.readLong();
-
-                boolean autoUnsubscribe = reader.readBoolean();
-
-                boolean hasLocFilter = reader.readBoolean();
-
-                PlatformEventFilterListener locFilter = hasLocFilter ? 
localFilter(reader.readLong()) : null;
-
-                boolean hasRmtFilter = reader.readBoolean();
-
-                UUID listenId;
-
-                if (hasRmtFilter) {
-                    PlatformEventFilterListener rmtFilter = 
platformCtx.createRemoteEventFilter(
-                        reader.readObjectDetached(), readEventTypes(reader));
-
-                    listenId = events.remoteListen(bufSize, interval, 
autoUnsubscribe, locFilter, rmtFilter);
-                }
-                else
-                    listenId = events.remoteListen(bufSize, interval, 
autoUnsubscribe, locFilter, null,
-                        readEventTypes(reader));
-
-                writer.writeUuid(listenId);
-
-                break;
-            }
-
-            case OP_REMOTE_QUERY: {
-                Object pred = reader.readObjectDetached();
-
-                long timeout = reader.readLong();
-
-                int[] types = readEventTypes(reader);
-
-                PlatformEventFilterListener filter = 
platformCtx.createRemoteEventFilter(pred, types);
-
-                Collection<Event> result = events.remoteQuery(filter, timeout);
-
-                if (result == null)
-                    writer.writeInt(-1);
-                else {
-                    writer.writeInt(result.size());
-
-                    for (Event e : result)
-                        platformCtx.writeEvent(writer, e);
-                }
-
-                break;
-            }
-
-            default:
-                super.processInStreamOutStream(type, reader, writer);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void processOutStream(int type, PortableRawWriterEx 
writer) throws IgniteCheckedException {
-        switch (type) {
-            case OP_GET_ENABLED_EVENTS:
-                writeEventTypes(events.enabledEvents(), writer);
-
-                break;
-
-            default:
-                super.processOutStream(type, writer);
-        }
-    }
-
-    /** <inheritDoc /> */
-    @Override protected IgniteFuture currentFuture() throws 
IgniteCheckedException {
-        return events.future();
-    }
-
-    /** <inheritDoc /> */
-    @Nullable @Override protected PlatformFutureUtils.Writer futureWriter(int 
opId) {
-        switch (opId) {
-            case OP_WAIT_FOR_LOCAL:
-                return eventResWriter;
-
-            case OP_REMOTE_QUERY:
-                return eventColResWriter;
-        }
-
-        return null;
-    }
-
-    /**
-     *  Reads event types array.
-     *
-     * @param reader Reader
-     * @return Event types, or null.
-     */
-    private int[] readEventTypes(PortableRawReaderEx reader) {
-        return reader.readIntArray();
-    }
-
-    /**
-     *  Reads event types array.
-     *
-     * @param writer Writer
-     * @param types Types.
-     */
-    private void writeEventTypes(int[] types, PortableRawWriterEx writer) {
-        if (types == null) {
-            writer.writeIntArray(null);
-
-            return;
-        }
-
-        int[] resultTypes = new int[types.length];
-
-        int idx = 0;
-
-        for (int t : types)
-            if (platformCtx.isEventTypeSupported(t))
-                resultTypes[idx++] = t;
-
-        writer.writeIntArray(Arrays.copyOf(resultTypes, idx));
-    }
-
-    /**
-     * Creates an interop filter from handle.
-     *
-     * @param hnd Handle.
-     * @return Interop filter.
-     */
-    private PlatformEventFilterListener localFilter(long hnd) {
-        return platformCtx.createLocalEventFilter(hnd);
-    }
-
-    /**
-     * Writes an EventBase.
-     */
-    private static class EventResultWriter implements 
PlatformFutureUtils.Writer {
-        /** */
-        private final PlatformContext platformCtx;
-
-        /**
-         * Constructor.
-         *
-         * @param platformCtx Context.
-         */
-        public EventResultWriter(PlatformContext platformCtx) {
-            assert platformCtx != null;
-
-            this.platformCtx = platformCtx;
-        }
-
-        /** <inheritDoc /> */
-        @Override public void write(PortableRawWriterEx writer, Object obj, 
Throwable err) {
-            platformCtx.writeEvent(writer, (EventAdapter)obj);
-        }
-
-        /** <inheritDoc /> */
-        @Override public boolean canWrite(Object obj, Throwable err) {
-            return obj instanceof EventAdapter && err == null;
-        }
-    }
-
-    /**
-     * Writes a collection of EventAdapter.
-     */
-    private static class EventCollectionResultWriter implements 
PlatformFutureUtils.Writer {
-        /** */
-        private final PlatformContext platformCtx;
-
-        /**
-         * Constructor.
-         *
-         * @param platformCtx Context.
-         */
-        public EventCollectionResultWriter(PlatformContext platformCtx) {
-            assert platformCtx != null;
-
-            this.platformCtx = platformCtx;
-        }
-
-        /** <inheritDoc /> */
-        @SuppressWarnings("unchecked")
-        @Override public void write(PortableRawWriterEx writer, Object obj, 
Throwable err) {
-            Collection<EventAdapter> events = (Collection<EventAdapter>)obj;
-
-            writer.writeInt(events.size());
-
-            for (EventAdapter e : events)
-                platformCtx.writeEvent(writer, e);
-        }
-
-        /** <inheritDoc /> */
-        @Override public boolean canWrite(Object obj, Throwable err) {
-            return obj instanceof Collection && err == null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java
deleted file mode 100644
index f17e824..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/lifecycle/PlatformLifecycleBean.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.lifecycle;
-
-import org.apache.ignite.IgniteException;
-import 
org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
-import org.apache.ignite.lifecycle.LifecycleBean;
-import org.apache.ignite.lifecycle.LifecycleEventType;
-
-/**
- * Lifecycle aware bean for interop.
- */
-public class PlatformLifecycleBean implements LifecycleBean {
-    /** Native gateway. */
-    public PlatformCallbackGateway gate;
-
-    /** Holder pointer. */
-    public long ptr;
-
-    /**
-     * Constructor.
-     */
-    protected PlatformLifecycleBean() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param gate Native gateway.
-     * @param ptr Holder pointer.
-     */
-    public PlatformLifecycleBean(PlatformCallbackGateway gate, long ptr) {
-        initialize(gate, ptr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onLifecycleEvent(LifecycleEventType evt) {
-        if (gate == null)
-            throw new IgniteException("Interop lifecycle bean can only be used 
in interop mode (did " +
-                    "you start the node with native platform bootstrapper?");
-
-        assert ptr != 0;
-
-        // Do not send after-stop events because gate will fail due to grid 
being stopped.
-        if (evt != LifecycleEventType.AFTER_NODE_STOP)
-            gate.lifecycleEvent(ptr, evt.ordinal());
-    }
-
-    /**
-     * Set pointers.
-     *
-     * @param gate Native gateway.
-     * @param ptr Target pointer.
-     */
-    public void initialize(PlatformCallbackGateway gate, long ptr) {
-        this.gate = gate;
-        this.ptr = ptr;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformAbstractMemory.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformAbstractMemory.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformAbstractMemory.java
deleted file mode 100644
index e305c71..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformAbstractMemory.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.memory;
-
-/**
- * Interop memory chunk abstraction.
- */
-public abstract class PlatformAbstractMemory implements PlatformMemory {
-    /** Stream factory. */
-    private static final StreamFactory STREAM_FACTORY = 
PlatformMemoryUtils.LITTLE_ENDIAN ?
-        new LittleEndianStreamFactory() : new BigEndianStreamFactory();
-
-    /** Cross-platform memory pointer. */
-    protected long memPtr;
-
-    /**
-     * Constructor.
-     *
-     * @param memPtr Cross-platform memory pointer.
-     */
-    protected PlatformAbstractMemory(long memPtr) {
-        this.memPtr = memPtr;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformInputStream input() {
-        return STREAM_FACTORY.createInput(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformOutputStream output() {
-        return STREAM_FACTORY.createOutput(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long pointer() {
-        return memPtr;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long data() {
-        return PlatformMemoryUtils.data(memPtr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int capacity() {
-        return PlatformMemoryUtils.capacity(memPtr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int length() {
-        return PlatformMemoryUtils.length(memPtr);
-    }
-
-    /**
-     * Stream factory.
-     */
-    private static interface StreamFactory {
-        /**
-         * Create input stream.
-         *
-         * @param mem Memory.
-         * @return Input stream.
-         */
-        PlatformInputStreamImpl createInput(PlatformMemory mem);
-
-        /**
-         * Create output stream.
-         *
-         * @param mem Memory.
-         * @return Output stream.
-         */
-        PlatformOutputStreamImpl createOutput(PlatformMemory mem);
-    }
-
-    /**
-     * Stream factory for LITTLE ENDIAN architecture.
-     */
-    private static class LittleEndianStreamFactory implements StreamFactory {
-        /** {@inheritDoc} */
-        @Override public PlatformInputStreamImpl createInput(PlatformMemory 
mem) {
-            return new PlatformInputStreamImpl(mem);
-        }
-
-        /** {@inheritDoc} */
-        @Override public PlatformOutputStreamImpl createOutput(PlatformMemory 
mem) {
-            return new PlatformOutputStreamImpl(mem);
-        }
-    }
-
-    /**
-     * Stream factory for BIG ENDIAN architecture.
-     */
-    private static class BigEndianStreamFactory implements StreamFactory {
-        /** {@inheritDoc} */
-        @Override public PlatformInputStreamImpl createInput(PlatformMemory 
mem) {
-            return new PlatformBigEndianInputStreamImpl(mem);
-        }
-
-        /** {@inheritDoc} */
-        @Override public PlatformOutputStreamImpl createOutput(PlatformMemory 
mem) {
-            return new PlatformBigEndianOutputStreamImpl(mem);
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianInputStreamImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianInputStreamImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianInputStreamImpl.java
deleted file mode 100644
index b54b151..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianInputStreamImpl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-package org.apache.ignite.internal.processors.platform.memory;
-
-/**
- * Interop input stream implementation working with BIG ENDIAN architecture.
- */
-public class PlatformBigEndianInputStreamImpl extends PlatformInputStreamImpl {
-    /**
-     * Constructor.
-     *
-     * @param mem Memory chunk.
-     */
-    public PlatformBigEndianInputStreamImpl(PlatformMemory mem) {
-        super(mem);
-    }
-
-    /** {@inheritDoc} */
-    @Override public short readShort() {
-        return Short.reverseBytes(super.readShort());
-    }
-
-    /** {@inheritDoc} */
-    @Override public short[] readShortArray(int cnt) {
-        short[] res = super.readShortArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = Short.reverseBytes(res[i]);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public char readChar() {
-        return Character.reverseBytes(super.readChar());
-    }
-
-    /** {@inheritDoc} */
-    @Override public char[] readCharArray(int cnt) {
-        char[] res = super.readCharArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = Character.reverseBytes(res[i]);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int readInt() {
-        return Integer.reverseBytes(super.readInt());
-    }
-
-    /** {@inheritDoc} */
-    @Override public int readInt(int pos) {
-        return Integer.reverseBytes(super.readInt(pos));
-    }
-
-    /** {@inheritDoc} */
-    @Override public int[] readIntArray(int cnt) {
-        int[] res = super.readIntArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = Integer.reverseBytes(res[i]);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float readFloat() {
-        return 
Float.intBitsToFloat(Integer.reverseBytes(Float.floatToIntBits(super.readFloat())));
-    }
-
-    /** {@inheritDoc} */
-    @Override public float[] readFloatArray(int cnt) {
-        float[] res = super.readFloatArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = 
Float.intBitsToFloat(Integer.reverseBytes(Float.floatToIntBits(res[i])));
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long readLong() {
-        return Long.reverseBytes(super.readLong());
-    }
-
-    /** {@inheritDoc} */
-    @Override public long[] readLongArray(int cnt) {
-        long[] res = super.readLongArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = Long.reverseBytes(res[i]);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double readDouble() {
-        return 
Double.longBitsToDouble(Long.reverseBytes(Double.doubleToLongBits(super.readDouble())));
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] readDoubleArray(int cnt) {
-        double[] res = super.readDoubleArray(cnt);
-
-        for (int i = 0; i < cnt; i++)
-            res[i] = 
Double.longBitsToDouble(Long.reverseBytes(Double.doubleToLongBits(res[i])));
-
-        return res;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianOutputStreamImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianOutputStreamImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianOutputStreamImpl.java
deleted file mode 100644
index 0f6ccbc..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformBigEndianOutputStreamImpl.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.memory;
-
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.UNSAFE;
-
-/**
- * Interop output stream implementation working with BIG ENDIAN architecture.
- */
-public class PlatformBigEndianOutputStreamImpl extends 
PlatformOutputStreamImpl {
-    /**
-     * Constructor.
-     *
-     * @param mem Underlying memory chunk.
-     */
-    public PlatformBigEndianOutputStreamImpl(PlatformMemory mem) {
-        super(mem);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeShort(short val) {
-        super.writeShort(Short.reverseBytes(val));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeShortArray(short[] val) {
-        int cnt = val.length << 1;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (short item : val) {
-            UNSAFE.putShort(startPos, Short.reverseBytes(item));
-
-            startPos += 2;
-        }
-
-        shift(cnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeChar(char val) {
-        super.writeChar(Character.reverseBytes(val));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeCharArray(char[] val) {
-        int cnt = val.length << 1;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (char item : val) {
-            UNSAFE.putChar(startPos, Character.reverseBytes(item));
-
-            startPos += 2;
-        }
-
-        shift(cnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeInt(int val) {
-        super.writeInt(Integer.reverseBytes(val));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeIntArray(int[] val) {
-        int cnt = val.length << 2;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (int item : val) {
-            UNSAFE.putInt(startPos, Integer.reverseBytes(item));
-
-            startPos += 4;
-        }
-
-        shift(cnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeInt(int pos, int val) {
-        super.writeInt(pos, Integer.reverseBytes(val));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeFloatArray(float[] val) {
-        int cnt = val.length << 2;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (float item : val) {
-            UNSAFE.putInt(startPos, 
Integer.reverseBytes(Float.floatToIntBits(item)));
-
-            startPos += 4;
-        }
-
-        shift(cnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeLong(long val) {
-        super.writeLong(Long.reverseBytes(val));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeLongArray(long[] val) {
-        int cnt = val.length << 3;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (long item : val) {
-            UNSAFE.putLong(startPos, Long.reverseBytes(item));
-
-            startPos += 8;
-        }
-
-        shift(cnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeDoubleArray(double[] val) {
-        int cnt = val.length << 3;
-
-        ensureCapacity(pos + cnt);
-
-        long startPos = data + pos;
-
-        for (double item : val) {
-            UNSAFE.putLong(startPos, 
Long.reverseBytes(Double.doubleToLongBits(item)));
-
-            startPos += 8;
-        }
-
-        shift(cnt);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformExternalMemory.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformExternalMemory.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformExternalMemory.java
deleted file mode 100644
index 8b6fad9..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformExternalMemory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.memory;
-
-import org.apache.ignite.IgniteException;
-import 
org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Interop external memory chunk.
- */
-public class PlatformExternalMemory extends PlatformAbstractMemory {
-    /** Native gateway. */
-    private final PlatformCallbackGateway gate;
-
-    /**
-     * Constructor.
-     *
-     * @param gate Native gateway.
-     * @param memPtr Memory pointer.
-     */
-    public PlatformExternalMemory(@Nullable PlatformCallbackGateway gate, long 
memPtr) {
-        super(memPtr);
-
-        this.gate = gate;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void reallocate(int cap) {
-        if (gate == null)
-            throw new IgniteException("Failed to re-allocate external memory 
chunk because it is read-only.");
-
-        gate.memoryReallocate(memPtr, cap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void close() {
-        // Do nothing, memory must be released by native platform.
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformInputStreamImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformInputStreamImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformInputStreamImpl.java
deleted file mode 100644
index 03a166e..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformInputStreamImpl.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.memory;
-
-import org.apache.ignite.IgniteException;
-
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.BOOLEAN_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.BYTE_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.CHAR_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.DOUBLE_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.FLOAT_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.INT_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.LONG_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.SHORT_ARR_OFF;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.UNSAFE;
-
-/**
- * Interop input stream implementation.
- */
-public class PlatformInputStreamImpl implements PlatformInputStream {
-    /** Underlying memory. */
-    private final PlatformMemory mem;
-
-    /** Real data pointer */
-    private long data;
-
-    /** Amount of available data. */
-    private int len;
-
-    /** Current position. */
-    private int pos;
-
-    /** Heap-copied data. */
-    private byte[] dataCopy;
-
-    /**
-     * Constructor.
-     *
-     * @param mem Underlying memory chunk.
-     */
-    public PlatformInputStreamImpl(PlatformMemory mem) {
-        this.mem = mem;
-
-        data = mem.data();
-        len = mem.length();
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte readByte() {
-        ensureEnoughData(1);
-
-        return UNSAFE.getByte(data + pos++);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] readByteArray(int cnt) {
-        byte[] res = new byte[cnt];
-
-        copyAndShift(res, BYTE_ARR_OFF, cnt);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readBoolean() {
-        return readByte() == 1;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean[] readBooleanArray(int cnt) {
-        boolean[] res = new boolean[cnt];
-
-        copyAndShift(res, BOOLEAN_ARR_OFF, cnt);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public short readShort() {
-        ensureEnoughData(2);
-
-        short res = UNSAFE.getShort(data + pos);
-
-        shift(2);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public short[] readShortArray(int cnt) {
-        int len = cnt << 1;
-
-        short[] res = new short[cnt];
-
-        copyAndShift(res, SHORT_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public char readChar() {
-        ensureEnoughData(2);
-
-        char res = UNSAFE.getChar(data + pos);
-
-        shift(2);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public char[] readCharArray(int cnt) {
-        int len = cnt << 1;
-
-        char[] res = new char[cnt];
-
-        copyAndShift(res, CHAR_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int readInt() {
-        ensureEnoughData(4);
-
-        int res = UNSAFE.getInt(data + pos);
-
-        shift(4);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int readInt(int pos) {
-        int delta = pos + 4 - this.pos;
-
-        if (delta > 0)
-            ensureEnoughData(delta);
-
-        return UNSAFE.getInt(data + pos);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int[] readIntArray(int cnt) {
-        int len = cnt << 2;
-
-        int[] res = new int[cnt];
-
-        copyAndShift(res, INT_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float readFloat() {
-        ensureEnoughData(4);
-
-        float res = UNSAFE.getFloat(data + pos);
-
-        shift(4);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float[] readFloatArray(int cnt) {
-        int len = cnt << 2;
-
-        float[] res = new float[cnt];
-
-        copyAndShift(res, FLOAT_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long readLong() {
-        ensureEnoughData(8);
-
-        long res = UNSAFE.getLong(data + pos);
-
-        shift(8);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long[] readLongArray(int cnt) {
-        int len = cnt << 3;
-
-        long[] res = new long[cnt];
-
-        copyAndShift(res, LONG_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double readDouble() {
-        ensureEnoughData(8);
-
-        double res = UNSAFE.getDouble(data + pos);
-
-        shift(8);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public double[] readDoubleArray(int cnt) {
-        int len = cnt << 3;
-
-        double[] res = new double[cnt];
-
-        copyAndShift(res, DOUBLE_ARR_OFF, len);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int read(byte[] arr, int off, int len) {
-        if (len > remaining())
-            len = remaining();
-
-        copyAndShift(arr, BYTE_ARR_OFF + off, len);
-
-        return len;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int remaining() {
-        return len - pos;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int position() {
-        return pos;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void position(int pos) {
-        if (pos > len)
-            throw new IgniteException("Position is out of bounds: " + pos);
-        else
-            this.pos = pos;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] array() {
-        return arrayCopy();
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] arrayCopy() {
-        if (dataCopy == null) {
-            dataCopy = new byte[len];
-
-            UNSAFE.copyMemory(null, data, dataCopy, BYTE_ARR_OFF, 
dataCopy.length);
-        }
-
-        return dataCopy;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long offheapPointer() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean hasArray() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void synchronize() {
-        data = mem.data();
-        len = mem.length();
-    }
-
-    /**
-     * Ensure there is enough data in the stream.
-     *
-     * @param cnt Amount of byte expected to be available.
-     */
-    private void ensureEnoughData(int cnt) {
-        if (remaining() < cnt)
-            throw new IgniteException("Not enough data to read the value 
[position=" + pos +
-                ", requiredBytes=" + cnt + ", remainingBytes=" + remaining() + 
']');
-    }
-
-    /**
-     * Copy required amount of data and shift position.
-     *
-     * @param target Target to copy data to.
-     * @param off Offset.
-     * @param cnt Count.
-     */
-    private void copyAndShift(Object target, long off, int cnt) {
-        ensureEnoughData(cnt);
-
-        UNSAFE.copyMemory(null, data + pos, target, off, cnt);
-
-        shift(cnt);
-    }
-
-    /**
-     * Shift position to the right.
-     *
-     * @param cnt Amount of bytes.
-     */
-    private void shift(int cnt) {
-        pos += cnt;
-
-        assert pos <= len;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8045c820/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformMemoryManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformMemoryManagerImpl.java
 
b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformMemoryManagerImpl.java
deleted file mode 100644
index 036e5c0..0000000
--- 
a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformMemoryManagerImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ignite.internal.processors.platform.memory;
-
-import 
org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway;
-import org.jetbrains.annotations.Nullable;
-
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.flags;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.isExternal;
-import static 
org.apache.ignite.internal.processors.platform.memory.PlatformMemoryUtils.isPooled;
-
-/**
- * Interop memory manager implementation.
- */
-public class PlatformMemoryManagerImpl implements PlatformMemoryManager {
-    /** Native gateway. */
-    private final PlatformCallbackGateway gate;
-
-    /** Default allocation capacity. */
-    private final int dfltCap;
-
-    /** Thread-local pool. */
-    private final ThreadLocal<PlatformMemoryPool> threadLocPool = new 
ThreadLocal<>();
-
-    /**
-     * Constructor.
-     *
-     * @param gate Native gateway.
-     * @param dfltCap Default memory chunk capacity.
-     */
-    public PlatformMemoryManagerImpl(@Nullable PlatformCallbackGateway gate, 
int dfltCap) {
-        this.gate = gate;
-        this.dfltCap = dfltCap;
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformMemory allocate() {
-        return allocate(dfltCap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformMemory allocate(int cap) {
-        return pool().allocate(cap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public PlatformMemory get(long memPtr) {
-        int flags = flags(memPtr);
-
-        return isExternal(flags) ? new PlatformExternalMemory(gate, memPtr) :
-            isPooled(flags) ? pool().get(memPtr) : new 
PlatformUnpooledMemory(memPtr);
-    }
-
-    /**
-     * Gets or creates thread-local memory pool.
-     *
-     * @return Memory pool.
-     */
-    private PlatformMemoryPool pool() {
-        PlatformMemoryPool pool = threadLocPool.get();
-
-        if (pool == null) {
-            pool = new PlatformMemoryPool();
-
-            threadLocPool.set(pool);
-        }
-
-        return pool;
-    }
-}
\ No newline at end of file

Reply via email to