ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [42/56] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1' into ignite-188
Date Sat, 07 Feb 2015 00:47:10 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
index 8fd7202,0000000..ff1f043
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@@ -1,839 -1,0 +1,839 @@@
 +/*
 + * 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.marshaller.optimized;
 +
 +import org.apache.ignite.internal.util.*;
 +import org.apache.ignite.internal.util.io.*;
 +import org.apache.ignite.internal.util.typedef.*;
 +import org.apache.ignite.lang.*;
 +
 +import java.io.*;
 +import java.lang.reflect.*;
 +import java.util.*;
 +
 +import static org.apache.ignite.marshaller.optimized.OptimizedMarshallerUtils.*;
 +
 +/**
 + * Optimized object output stream.
 + */
 +class OptimizedObjectOutputStream extends ObjectOutputStream {
 +    /** */
 +    private static final Collection<String> CONVERTED_ERR = F.asList(
 +        "weblogic/management/ManagementException",
 +        "Externalizable class doesn't have default constructor: class " +
-             "org.gridgain.grid.kernal.processors.email.GridEmailProcessor$2"
++            "org.apache.ignite.internal.processors.email.IgniteEmailProcessor$2"
 +    );
 +
 +    /** */
 +    private final GridHandleTable handles = new GridHandleTable(10, 3.00f);
 +
 +    /** */
 +    private boolean requireSer;
 +
 +    /** */
 +    private GridDataOutput out;
 +
 +    /** */
 +    private Object curObj;
 +
 +    /** */
 +    private List<T2<OptimizedFieldType, Long>> curFields;
 +
 +    /** */
 +    private Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> curFieldInfoMap;
 +
 +    /** */
 +    private PutFieldImpl curPut;
 +
 +
 +    /**
 +     * @throws IOException In case of error.
 +     */
 +    OptimizedObjectOutputStream() throws IOException {
 +        // No-op.
 +    }
 +
 +    /**
 +     * @param out Output.
 +     * @throws IOException In case of error.
 +     */
 +    OptimizedObjectOutputStream(GridDataOutput out) throws IOException {
 +        this.out = out;
 +    }
 +
 +    /**
 +     * @param requireSer Require {@link Serializable} flag.
 +     */
 +    void requireSerializable(boolean requireSer) {
 +        this.requireSer = requireSer;
 +    }
 +
 +    /**
 +     * @return Require {@link Serializable} flag.
 +     */
 +    boolean requireSerializable() {
 +        return requireSer;
 +    }
 +
 +    /**
 +     * @param out Output.
 +     */
 +    public void out(GridDataOutput out) {
 +        this.out = out;
 +    }
 +
 +    /**
 +     * @return Output.
 +     */
 +    public GridDataOutput out() {
 +        return out;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void close() throws IOException {
 +        reset();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void write(byte[] b) throws IOException {
 +        out.write(b);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void write(byte[] b, int off, int len) throws IOException {
 +        out.write(b, off, len);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override protected void writeObjectOverride(Object obj) throws IOException {
 +        try {
 +            writeObject0(obj);
 +        }
 +        catch (IOException e) {
 +            Throwable t = e;
 +
 +            do {
 +                if (CONVERTED_ERR.contains(t.getMessage()))
 +                    throw new IOException("You are trying to serialize internal classes that are not supposed " +
 +                        "to be serialized. Check that all non-serializable fields are transient. Consider using " +
 +                        "static inner classes instead of non-static inner classes and anonymous classes.", e);
 +            }
 +            while ((t = t.getCause()) != null);
 +
 +            throw e;
 +        }
 +    }
 +
 +    /**
 +     * Writes object to stream.
 +     *
 +     * @param obj Object.
 +     * @throws IOException In case of error.
 +     */
 +    private void writeObject0(Object obj) throws IOException {
 +        curObj = null;
 +        curFields = null;
 +        curPut = null;
 +        curFieldInfoMap = null;
 +
 +        if (obj == null)
 +            writeByte(NULL);
 +        else {
 +            Class<?> cls = obj.getClass();
 +
 +            OptimizedClassDescriptor desc = classDescriptor(cls, obj);
 +
 +            if (desc.excluded()) {
 +                writeByte(NULL);
 +
 +                return;
 +            }
 +
 +            Object obj0 = desc.replace(obj);
 +
 +            if (obj0 == null) {
 +                writeByte(NULL);
 +
 +                return;
 +            }
 +
 +            int handle = -1;
 +
 +            if (!desc.isPrimitive() && !desc.isEnum() && !desc.isClass())
 +                handle = handles.lookup(obj);
 +
 +            if (obj0 != obj) {
 +                obj = obj0;
 +
 +                desc = classDescriptor(obj.getClass(), obj);
 +            }
 +
 +            if (handle >= 0) {
 +                writeByte(HANDLE);
 +                writeInt(handle);
 +            }
 +            else {
 +                writeByte(OBJECT);
 +
 +                OptimizedClassResolver.writeClass(this, desc);
 +
 +                desc.write(this, obj);
 +            }
 +        }
 +    }
 +
 +    /**
 +     * Writes array to this stream.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("ForLoopReplaceableByForEach")
 +    void writeArray(Object[] arr) throws IOException {
 +        int len = arr.length;
 +
 +        writeInt(len);
 +
 +        for (int i = 0; i < len; i++) {
 +            Object obj = arr[i];
 +
 +            writeObject0(obj);
 +        }
 +    }
 +
 +    /**
 +     * Writes {@link UUID} to this stream.
 +     *
 +     * @param uuid UUID.
 +     * @throws IOException In case of error.
 +     */
 +    void writeUuid(UUID uuid) throws IOException {
 +        writeLong(uuid.getMostSignificantBits());
 +        writeLong(uuid.getLeastSignificantBits());
 +    }
 +
 +    /**
 +     * Writes {@link Properties} to this stream.
 +     *
 +     * @param props Properties.
 +     * @param dfltsFieldOff Defaults field offset.
 +     * @throws IOException In case of error.
 +     */
 +    void writeProperties(Properties props, long dfltsFieldOff) throws IOException {
 +        Properties dflts = (Properties)getObject(props, dfltsFieldOff);
 +
 +        if (dflts == null)
 +            writeBoolean(true);
 +        else {
 +            writeBoolean(false);
 +
 +            writeObject0(dflts);
 +        }
 +
 +        Set<String> names = props.stringPropertyNames();
 +
 +        writeInt(names.size());
 +
 +        for (String name : names) {
 +            writeUTF(name);
 +            writeUTF(props.getProperty(name));
 +        }
 +    }
 +
 +    /**
 +     * Writes externalizable object.
 +     *
 +     * @param obj Object.
 +     * @throws IOException In case of error.
 +     */
 +    void writeExternalizable(Object obj) throws IOException {
 +        Externalizable extObj = (Externalizable)obj;
 +
 +        extObj.writeExternal(this);
 +    }
 +
 +    /**
 +     * Writes serializable object.
 +     *
 +     * @param obj Object.
 +     * @param mtds {@code writeObject} methods.
 +     * @param fields class fields details.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("ForLoopReplaceableByForEach")
 +    void writeSerializable(Object obj, List<Method> mtds, OptimizedClassDescriptor.Fields fields)
 +        throws IOException {
 +        for (int i = 0; i < mtds.size(); i++) {
 +            Method mtd = mtds.get(i);
 +
 +            if (mtd != null) {
 +                curObj = obj;
 +                curFields = fields.fieldOffs(i);
 +                curFieldInfoMap = fields.fieldInfoMap(i);
 +
 +                try {
 +                    mtd.invoke(obj, this);
 +                }
 +                catch (IllegalAccessException e) {
 +                    throw new IOException(e);
 +                }
 +                catch (InvocationTargetException e) {
 +                    throw new IOException(e.getCause());
 +                }
 +            }
 +            else
 +                writeFields(obj, fields.fieldOffs(i));
 +        }
 +    }
 +
 +    /**
 +     * Writes {@link ArrayList}.
 +     *
 +     * @param list List.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings({"ForLoopReplaceableByForEach", "TypeMayBeWeakened"})
 +    void writeArrayList(ArrayList<?> list) throws IOException {
 +        int size = list.size();
 +
 +        writeInt(size);
 +
 +        for (int i = 0; i < size; i++)
 +            writeObject0(list.get(i));
 +    }
 +
 +    /**
 +     * Writes {@link HashMap}.
 +     *
 +     * @param map Map.
 +     * @param loadFactorFieldOff Load factor field offset.
 +     * @param set Whether writing underlying map from {@link HashSet}.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("TypeMayBeWeakened")
 +    void writeHashMap(HashMap<?, ?> map, long loadFactorFieldOff, boolean set) throws IOException {
 +        int size = map.size();
 +
 +        writeInt(size);
 +        writeFloat(getFloat(map, loadFactorFieldOff));
 +
 +        for (Map.Entry<?, ?> e : map.entrySet()) {
 +            writeObject0(e.getKey());
 +
 +            if (!set)
 +                writeObject0(e.getValue());
 +        }
 +    }
 +
 +    /**
 +     * Writes {@link HashSet}.
 +     *
 +     * @param set Set.
 +     * @param mapFieldOff Map field offset.
 +     * @param loadFactorFieldOff Load factor field offset.
 +     * @throws IOException In case of error.
 +     */
 +    void writeHashSet(HashSet<?> set, long mapFieldOff, long loadFactorFieldOff) throws IOException {
 +        writeHashMap((HashMap<?, ?>)getObject(set, mapFieldOff), loadFactorFieldOff, true);
 +    }
 +
 +    /**
 +     * Writes {@link LinkedList}.
 +     *
 +     * @param list List.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("TypeMayBeWeakened")
 +    void writeLinkedList(LinkedList<?> list) throws IOException {
 +        int size = list.size();
 +
 +        writeInt(size);
 +
 +        for (Object obj : list)
 +            writeObject0(obj);
 +    }
 +
 +    /**
 +     * Writes {@link LinkedHashMap}.
 +     *
 +     * @param map Map.
 +     * @param loadFactorFieldOff Load factor field offset.
 +     * @param accessOrderFieldOff access order field offset.
 +     * @param set Whether writing underlying map from {@link LinkedHashSet}.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("TypeMayBeWeakened")
 +    void writeLinkedHashMap(LinkedHashMap<?, ?> map, long loadFactorFieldOff, long accessOrderFieldOff, boolean set)
 +        throws IOException {
 +        int size = map.size();
 +
 +        writeInt(size);
 +        writeFloat(getFloat(map, loadFactorFieldOff));
 +
 +        if (accessOrderFieldOff >= 0)
 +            writeBoolean(getBoolean(map, accessOrderFieldOff));
 +        else
 +            writeBoolean(false);
 +
 +        for (Map.Entry<?, ?> e : map.entrySet()) {
 +            writeObject0(e.getKey());
 +
 +            if (!set)
 +                writeObject0(e.getValue());
 +        }
 +    }
 +
 +    /**
 +     * Writes {@link LinkedHashSet}.
 +     *
 +     * @param set Set.
 +     * @param mapFieldOff Map field offset.
 +     * @param loadFactorFieldOff Load factor field offset.
 +     * @throws IOException In case of error.
 +     */
 +    void writeLinkedHashSet(LinkedHashSet<?> set, long mapFieldOff, long loadFactorFieldOff) throws IOException {
 +        LinkedHashMap<?, ?> map = (LinkedHashMap<?, ?>)getObject(set, mapFieldOff);
 +
 +        writeLinkedHashMap(map, loadFactorFieldOff, -1, true);
 +    }
 +
 +    /**
 +     * Writes {@link Date}.
 +     *
 +     * @param date Date.
 +     * @throws IOException In case of error.
 +     */
 +    void writeDate(Date date) throws IOException {
 +        writeLong(date.getTime());
 +    }
 +
 +    /**
 +     * Writes all non-static and non-transient field values to this stream.
 +     *
 +     * @param obj Object.
 +     * @param fieldOffs Field offsets.
 +     * @throws IOException In case of error.
 +     */
 +    @SuppressWarnings("ForLoopReplaceableByForEach")
 +    private void writeFields(Object obj, List<T2<OptimizedFieldType, Long>> fieldOffs) throws IOException {
 +        for (int i = 0; i < fieldOffs.size(); i++) {
 +            T2<OptimizedFieldType, Long> t = fieldOffs.get(i);
 +
 +            switch (t.get1()) {
 +                case BYTE:
 +                    writeByte(getByte(obj, t.get2()));
 +
 +                    break;
 +
 +                case SHORT:
 +                    writeShort(getShort(obj, t.get2()));
 +
 +                    break;
 +
 +                case INT:
 +                    writeInt(getInt(obj, t.get2()));
 +
 +                    break;
 +
 +                case LONG:
 +                    writeLong(getLong(obj, t.get2()));
 +
 +                    break;
 +
 +                case FLOAT:
 +                    writeFloat(getFloat(obj, t.get2()));
 +
 +                    break;
 +
 +                case DOUBLE:
 +                    writeDouble(getDouble(obj, t.get2()));
 +
 +                    break;
 +
 +                case CHAR:
 +                    writeChar(getChar(obj, t.get2()));
 +
 +                    break;
 +
 +                case BOOLEAN:
 +                    writeBoolean(getBoolean(obj, t.get2()));
 +
 +                    break;
 +
 +                case OTHER:
 +                    writeObject0(getObject(obj, t.get2()));
 +            }
 +        }
 +    }
 +
 +    /**
 +     * Writes array of {@code byte}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeByteArray(byte[] arr) throws IOException {
 +        out.writeByteArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code short}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeShortArray(short[] arr) throws IOException {
 +        out.writeShortArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code int}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeIntArray(int[] arr) throws IOException {
 +        out.writeIntArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code long}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeLongArray(long[] arr) throws IOException {
 +        out.writeLongArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code float}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeFloatArray(float[] arr) throws IOException {
 +        out.writeFloatArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code double}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeDoubleArray(double[] arr) throws IOException {
 +        out.writeDoubleArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code char}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeCharArray(char[] arr) throws IOException {
 +        out.writeCharArray(arr);
 +    }
 +
 +    /**
 +     * Writes array of {@code boolean}s.
 +     *
 +     * @param arr Array.
 +     * @throws IOException In case of error.
 +     */
 +    void writeBooleanArray(boolean[] arr) throws IOException {
 +        out.writeBooleanArray(arr);
 +    }
 +
 +    /**
 +     * Writes {@link String}.
 +     *
 +     * @param str String.
 +     * @throws IOException In case of error.
 +     */
 +    void writeString(String str) throws IOException {
 +        out.writeUTF(str);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeBoolean(boolean v) throws IOException {
 +        out.writeBoolean(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeByte(int v) throws IOException {
 +        out.writeByte(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeShort(int v) throws IOException {
 +        out.writeShort(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeChar(int v) throws IOException {
 +        out.writeChar(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeInt(int v) throws IOException {
 +        out.writeInt(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeLong(long v) throws IOException {
 +        out.writeLong(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeFloat(float v) throws IOException {
 +        out.writeFloat(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeDouble(double v) throws IOException {
 +        out.writeDouble(v);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void write(int b) throws IOException {
 +        writeByte(b);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeBytes(String s) throws IOException {
 +        out.writeBytes(s);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeChars(String s) throws IOException {
 +        out.writeChars(s);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeUTF(String s) throws IOException {
 +        out.writeUTF(s);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void useProtocolVersion(int ver) throws IOException {
 +        // No-op.
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeUnshared(Object obj) throws IOException {
 +        writeObject0(obj);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void defaultWriteObject() throws IOException {
 +        if (curObj == null)
 +            throw new NotActiveException("Not in writeObject() call.");
 +
 +        writeFields(curObj, curFields);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public ObjectOutputStream.PutField putFields() throws IOException {
 +        if (curObj == null)
 +            throw new NotActiveException("Not in writeObject() call or fields already written.");
 +
 +        if (curPut == null)
 +            curPut = new PutFieldImpl(this);
 +
 +        return curPut;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeFields() throws IOException {
 +        if (curObj == null)
 +            throw new NotActiveException("Not in writeObject() call.");
 +
 +        if (curPut == null)
 +            throw new NotActiveException("putFields() was not called.");
 +
 +        for (IgniteBiTuple<OptimizedFieldType, Object> t : curPut.objs) {
 +            switch (t.get1()) {
 +                case BYTE:
 +                    writeByte((Byte)t.get2());
 +
 +                    break;
 +
 +                case SHORT:
 +                    writeShort((Short)t.get2());
 +
 +                    break;
 +
 +                case INT:
 +                    writeInt((Integer)t.get2());
 +
 +                    break;
 +
 +                case LONG:
 +                    writeLong((Long)t.get2());
 +
 +                    break;
 +
 +                case FLOAT:
 +                    writeFloat((Float)t.get2());
 +
 +                    break;
 +
 +                case DOUBLE:
 +                    writeDouble((Double)t.get2());
 +
 +                    break;
 +
 +                case CHAR:
 +                    writeChar((Character)t.get2());
 +
 +                    break;
 +
 +                case BOOLEAN:
 +                    writeBoolean((Boolean)t.get2());
 +
 +                    break;
 +
 +                case OTHER:
 +                    writeObject0(t.get2());
 +            }
 +        }
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void reset() throws IOException {
 +        out.reset();
 +        handles.clear();
 +
 +        curObj = null;
 +        curFields = null;
 +        curPut = null;
 +        curFieldInfoMap = null;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void flush() throws IOException {
 +        // No-op.
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void drain() throws IOException {
 +        // No-op.
 +    }
 +
 +    /**
 +     * Returns objects that were added to handles table.
 +     * Used ONLY for test purposes.
 +     *
 +     * @return Handled objects.
 +     */
 +    Object[] handledObjects() {
 +        return handles.objects();
 +    }
 +
 +    /**
 +     * {@link PutField} implementation.
 +     */
 +    private static class PutFieldImpl extends PutField {
 +        /** Stream. */
 +        private final OptimizedObjectOutputStream out;
 +
 +        /** Field info map. */
 +        private final Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> fieldInfoMap;
 +
 +        /** Values. */
 +        private final IgniteBiTuple<OptimizedFieldType, Object>[] objs;
 +
 +        /**
 +         * @param out Output stream.
 +         * @throws IOException In case of error.
 +         */
 +        @SuppressWarnings("unchecked")
 +        private PutFieldImpl(OptimizedObjectOutputStream out) {
 +            this.out = out;
 +
 +            fieldInfoMap = out.curFieldInfoMap;
 +
 +            objs = new IgniteBiTuple[fieldInfoMap.size()];
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, boolean val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, byte val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, char val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, short val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, int val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, long val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, float val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, double val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void put(String name, Object val) {
 +            value(name, val);
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void write(ObjectOutput out) throws IOException {
 +            if (out != this.out)
 +                throw new IllegalArgumentException("Wrong stream.");
 +
 +            this.out.writeFields();
 +        }
 +
 +        /**
 +         * @param name Field name.
 +         * @param val Value.
 +         */
 +        private void value(String name, Object val) {
 +            IgniteBiTuple<Integer, OptimizedFieldType> info = fieldInfoMap.get(name);
 +
 +            objs[info.get1()] = F.t(info.get2(), val);
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
index e35ad3f,5580d52..408e9e0
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
@@@ -42,11 -42,11 +42,11 @@@ public interface IgniteMXBean 
      public String getFullVersion();
  
      /**
-      * Gets copyright statement for GridGain product.
+      * Gets copyright statement for Ignite product.
       *
-      * @return Copyright statement for GridGain product.
+      * @return Copyright statement for Ignite product.
       */
-     @MXBeanDescription("Copyright statement for GridGain product.")
 -    @IgniteMXBeanDescription("Copyright statement for Ignite product.")
++    @MXBeanDescription("Copyright statement for Ignite product.")
      public String getCopyright();
  
      /**
@@@ -110,12 -110,12 +110,12 @@@
      public String getExecutorServiceFormatted();
  
      /**
-      * Gets GridGain installation home folder.
+      * Gets Ignite installation home folder.
       *
-      * @return GridGain installation home.
+      * @return Ignite installation home.
       */
-     @MXBeanDescription("GridGain installation home folder.")
 -    @IgniteMXBeanDescription("Ignite installation home folder.")
 -    public String getIgniteHome();
++    @MXBeanDescription("Ignite installation home folder.")
 +    public String getGridGainHome();
  
      /**
       * Gets a formatted instance of MBean server instance.
@@@ -150,12 -150,12 +150,12 @@@
  
      /**
       * Gets {@code toString()} representation of of lifecycle beans configured
-      * with GridGain.
+      * with Ignite.
       *
       * @return {@code toString()} representation of all lifecycle beans configured
-      *      with GridGain.
+      *      with Ignite.
       */
 -    @IgniteMXBeanDescription("String representation of lifecycle beans.")
 +    @MXBeanDescription("String representation of lifecycle beans.")
      public Collection<String> getLifecycleBeansFormatted();
  
      /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
index f1f59b2,00c7e95..c43d00c
--- a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/GridSegmentationPolicy.java
@@@ -25,8 -25,8 +25,8 @@@ package org.apache.ignite.plugin.segmen
  public enum GridSegmentationPolicy {
      /**
       * When segmentation policy is {@code RESTART_JVM}, all listeners will receive
 -     * {@link org.apache.ignite.events.IgniteEventType#EVT_NODE_SEGMENTED} event and then JVM will be restarted.
 +     * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and then JVM will be restarted.
-      * Note, that this will work <b>only</b> if GridGain is started with {@link org.apache.ignite.startup.cmdline.CommandLineStartup}
+      * Note, that this will work <b>only</b> if Ignite is started with {@link org.apache.ignite.startup.cmdline.CommandLineStartup}
       * via standard {@code ignite.{sh|bat}} shell script.
       */
      RESTART_JVM,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/resources/ServiceResource.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/resources/ServiceResource.java
index a32bcc8,0000000..7c22728
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/ServiceResource.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/ServiceResource.java
@@@ -1,87 -1,0 +1,87 @@@
 +/*
 + * 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.resources;
 +
 +import java.lang.annotation.*;
 +
 +/**
-  * Annotates a field or a setter method for injection of GridGain service(s) by specified service name.
++ * Annotates a field or a setter method for injection of Ignite service(s) by specified service name.
 + * If more than one service is deployed on a server, then the first available instance will be returned.
 + * <p>
 + * Here is how injection would typically happen:
 + * <pre name="code" class="java">
 + * public class MyGridJob implements ComputeJob {
 + *      ...
 + *      // Inject single instance of 'myService'. If there is
 + *      // more than one, first deployed instance will be picked.
 + *      &#64;IgniteServiceResource(serviceName = "myService", proxyInterface = MyService.class)
 + *      private MyService svc;
 + *      ...
 + *  }
 + * </pre>
 + * or attach the same annotations to methods:
 + * <pre name="code" class="java">
 + * public class MyGridJob implements ComputeJob {
 + *     ...
 + *     private MyService svc;
 + *     ...
 + *      // Inject all locally deployed instances of 'myService'.
 + *     &#64;IgniteServiceResource(serviceName = "myService")
 + *     public void setMyService(MyService svc) {
 + *          this.svc = svc;
 + *     }
 + *     ...
 + * }
 + * </pre>
 + * <p>
 + */
 +@Documented
 +@Retention(RetentionPolicy.RUNTIME)
 +@Target({ElementType.METHOD, ElementType.FIELD})
 +public @interface ServiceResource {
 +    /**
 +     * Service name.
 +     *
 +     * @return Name of the injected services.
 +     */
 +    public String serviceName();
 +
 +    /**
 +     * In case if an instance of the service is not available locally,
 +     * an instance of the service proxy for a remote service instance
 +     * may be returned. If you wish to return only locally deployed
 +     * instance, then leave this property as {@code null}.
 +     * <p>
 +     * For more information about service proxies, see
 +     * {@link org.apache.ignite.IgniteServices#serviceProxy(String, Class, boolean)} documentation.
 +     *
 +     * @return Interface class for remote service proxy.
 +     */
 +    public Class<?> proxyInterface() default Void.class;
 +
 +    /**
 +     * Flag indicating if a sticky instance of a service proxy should be returned.
 +     * This flag is only valid if {@link #proxyInterface()} is not {@code null}.
 +     * <p>
 +     * For information about sticky flag, see {@link org.apache.ignite.IgniteServices#serviceProxy(String, Class, boolean)}
 +     * documentation.
 +     *
 +     * @return {@code True} if a sticky instance of a service proxy should be injected.
 +     */
 +    public boolean proxySticky() default false;
 +}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/resources/SpringApplicationContextResource.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/resources/SpringApplicationContextResource.java
index eee2266,0000000..8b8f9b9
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/SpringApplicationContextResource.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/SpringApplicationContextResource.java
@@@ -1,68 -1,0 +1,68 @@@
 +/*
 + * 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.resources;
 +
 +import java.lang.annotation.*;
 +
 +/**
 + * Annotates a field or a setter method for injection of Spring ApplicationContext resource.
-  * When GridGain starts using Spring configuration, the Application Context for Spring
++ * When Ignite starts using Spring configuration, the Application Context for Spring
 + * Configuration is injected as this resource.
 + * method.
 + * <p>
 + * Spring Application Context can be injected into instances of following classes:
 + * <ul>
 + * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
 + * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
 + * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
 + * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
 + * </ul>
 + * <p>
 + * Here is how injection would typically happen:
 + * <pre name="code" class="java">
 + * public class MyGridJob implements ComputeJob {
 + *      ...
 + *      &#64;IgniteSpringApplicationContextResource
 + *      private ApplicationContext springCtx;
 + *      ...
 + *  }
 + * </pre>
 + * or
 + * <pre name="code" class="java">
 + * public class MyGridJob implements ComputeJob {
 + *     ...
 + *     private ApplicationContext springCtx;
 + *     ...
 + *     &#64;IgniteSpringApplicationContextResource
 + *     public void setApplicationContext(MBeanServer springCtx) {
 + *          this.springCtx = springCtx;
 + *     }
 + *     ...
 + * }
 + * </pre>
 + * <p>
 + * <img src="http://www.gridgain.com/images/spring-small.png">
 + * <br>
 + * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
 + */
 +@Documented
 +@Retention(RetentionPolicy.RUNTIME)
 +@Target({ElementType.METHOD, ElementType.FIELD})
 +public @interface SpringApplicationContextResource {
 +    // No-op.
 +}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/services/Service.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/services/Service.java
index b17a0be,0000000..9c57a7c
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/services/Service.java
+++ b/modules/core/src/main/java/org/apache/ignite/services/Service.java
@@@ -1,123 -1,0 +1,123 @@@
 +/*
 + * 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.services;
 +
 +import java.io.*;
 +
 +/**
 + * An instance of grid-managed service. Grid-managed services may be deployed from
 + * {@link org.apache.ignite.IgniteServices} facade or directly from grid configuration at startup.
 + * <h1 class="header">Deployment</h1>
-  * Whenever service is deployed, GridGain will automatically calculate how many
++ * Whenever service is deployed, Ignite will automatically calculate how many
 + * instances of this service should be deployed on each node within the cluster.
-  * Whenever service is deployed on a cluster node, GridGain will call
++ * Whenever service is deployed on a cluster node, Ignite will call
 + * {@link #execute(ServiceContext)} method on that service. It is up to the user
 + * to control whenever the service should exit from the {@code execute} method.
 + * For example, user may choose to implement service as follows:
 + * <pre name="code" class="java">
 + * public class MyIgniteService implements Service {
 + *      ...
 + *      // Example of ignite resource injection. All resources are optional.
 + *      // You should inject resources only as needed.
 + *      &#64;IgniteInstanceResource
 + *      private Ignite ignite;
 + *      ...
 + *      &#64;Override public void cancel(ServiceContext ctx) {
 + *          // No-op.
 + *      }
 + *
 + *      &#64;Override public void execute(ServiceContext ctx) {
 + *          // Loop until service is cancelled.
 + *          while (!ctx.isCancelled()) {
 + *              // Do something.
 + *              ...
 + *          }
 + *      }
 + *  }
 + * </pre>
 + * Consecutively, this service can be deployed as follows:
 + * <pre name="code" class="java">
 + * ...
 + * GridServices svcs = grid.services();
 + *
 + * GridFuture&lt;?&gt; fut = svcs.deployClusterSingleton("mySingleton", new MyGridService());
 + *
 + * // Wait for deployment to complete.
 + * fut.get();
 + * </pre>
 + * Or from grid configuration on startup:
 + * <pre name="code" class="java">
 + * GridConfiguration gridCfg = new GridConfiguration();
 + *
 + * GridServiceConfiguration svcCfg = new GridServiceConfiguration();
 + *
 + * // Configuration for cluster-singleton service.
 + * svcCfg.setName("mySingleton");
 + * svcCfg.setMaxPerNodeCount(1);
 + * svcCfg.setTotalCount(1);
 + * svcCfg.setService(new MyGridService());
 + *
 + * gridCfg.setServiceConfiguration(svcCfg);
 + * ...
-  * GridGain.start(gridCfg);
++ * Ignition.start(gridCfg);
 + * </pre>
 + * <h1 class="header">Cancellation</h1>
 + * Services can be cancelled by calling any of the {@code cancel} methods on {@link org.apache.ignite.IgniteServices} API.
-  * Whenever a deployed service is cancelled, GridGain will automatically call
++ * Whenever a deployed service is cancelled, Ignite will automatically call
 + * {@link Service#cancel(ServiceContext)} method on that service.
 + * <p>
-  * Note that GridGain cannot guarantee that the service exits from {@link Service#execute(ServiceContext)}
++ * Note that Ignite cannot guarantee that the service exits from {@link Service#execute(ServiceContext)}
 + * method whenever {@link #cancel(ServiceContext)} is called. It is up to the user to
 + * make sure that the service code properly reacts to cancellations.
 + */
 +public interface Service extends Serializable {
 +    /**
-      * Cancels this service. GridGain will automatically call this method whenever any of the
++     * Cancels this service. Ignite will automatically call this method whenever any of the
 +     * {@code cancel} methods on {@link org.apache.ignite.IgniteServices} API are called.
 +     * <p>
-      * Note that GridGain cannot guarantee that the service exits from {@link #execute(ServiceContext)}
++     * Note that Ignite cannot guarantee that the service exits from {@link #execute(ServiceContext)}
 +     * method whenever {@code cancel(GridServiceContext)} method is called. It is up to the user to
 +     * make sure that the service code properly reacts to cancellations.
 +     *
 +     * @param ctx Service execution context.
 +     */
 +    public void cancel(ServiceContext ctx);
 +
 +    /**
 +     * Pre-initializes service before execution. This method is guaranteed to be called before
 +     * service deployment is complete (this guarantees that this method will be called
 +     * before method {@link #execute(ServiceContext)} is called).
 +     *
 +     * @param ctx Service execution context.
 +     * @throws Exception If service initialization failed.
 +     */
 +    public void init(ServiceContext ctx) throws Exception;
 +
 +    /**
 +     * Starts execution of this service. This method is automatically invoked whenever an instance of the service
 +     * is deployed on a grid node. Note that service is considered deployed even after it exits the {@code execute}
 +     * method and can be cancelled (or undeployed) only by calling any of the {@code cancel} methods on
 +     * {@link org.apache.ignite.IgniteServices} API. Also note that service is not required to exit from {@code execute} method until
 +     * {@link #cancel(ServiceContext)} method was called.
 +     *
 +     * @param ctx Service execution context.
 +     * @throws Exception If service execution failed. Not that service will still remain deployed, until
 +     *      {@link org.apache.ignite.IgniteServices#cancel(String)} method will be called.
 +     */
 +    public void execute(ServiceContext ctx) throws Exception;
 +}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
index fedcfbf,0000000..04321a2
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
@@@ -1,305 -1,0 +1,305 @@@
 +/*
 + * 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.services;
 +
 +import org.apache.ignite.cluster.*;
 +import org.apache.ignite.internal.util.tostring.*;
 +import org.apache.ignite.internal.util.typedef.internal.*;
 +import org.apache.ignite.lang.*;
 +
 +import java.io.*;
 +
 +/**
 + * Managed service configuration. In addition to deploying managed services by
 + * calling any of the provided {@code deploy(...)} methods, managed services
 + * can also be automatically deployed on startup by specifying them in {@link org.apache.ignite.configuration.IgniteConfiguration}
 + * like so:
 + * <pre name="code" class="java">
 + * GridConfiguration gridCfg = new GridConfiguration();
 + *
 + * GridServiceConfiguration svcCfg1 = new GridServiceConfiguration();
 + *
 + * svcCfg1.setName("myClusterSingletonService");
 + * svcCfg1.setMaxPerNodeCount(1);
 + * svcCfg1.setTotalCount(1);
 + * svcCfg1.setService(new MyClusterSingletonService());
 + *
 + * GridServiceConfiguration svcCfg2 = new GridServiceConfiguration();
 + *
 + * svcCfg2.setName("myNodeSingletonService");
 + * svcCfg2.setMaxPerNodeCount(1);
 + * svcCfg2.setService(new MyNodeSingletonService());
 + *
 + * gridCfg.setServiceConfiguration(svcCfg1, svcCfg2);
 + * ...
-  * GridGain.start(gridCfg);
++ * Ignition.start(gridCfg);
 + * </pre>
 + * The above configuration can also be specified in a Spring configuration file.
 + */
 +public class ServiceConfiguration implements Serializable {
 +    /** */
 +    private static final long serialVersionUID = 0L;
 +
 +    /** Service name. */
 +    private String name;
 +
 +    /** Service instance. */
 +    @GridToStringExclude
 +    private Service svc;
 +
 +    /** Total count. */
 +    private int totalCnt;
 +
 +    /** Max per-node count. */
 +    private int maxPerNodeCnt;
 +
 +    /** Cache name. */
 +    private String cacheName;
 +
 +    /** Affinity key. */
 +    private Object affKey;
 +
 +    /** Node filter. */
 +    @GridToStringExclude
 +    private IgnitePredicate<ClusterNode> nodeFilter;
 +
 +    /**
 +     * Gets service name.
 +     * <p>
 +     * This parameter is mandatory when deploying a service.
 +     *
 +     * @return Service name.
 +     */
 +    public String getName() {
 +        return name;
 +    }
 +
 +    /**
 +     * Sets service name.
 +     * <p>
 +     * This parameter is mandatory when deploying a service.
 +     *
 +     * @param name Service name.
 +     */
 +    public void setName(String name) {
 +        this.name = name;
 +    }
 +
 +    /**
 +     * Gets service instance.
 +     * <p>
 +     * This parameter is mandatory when deploying a service.
 +     *
 +     * @return Service instance.
 +     */
 +    public Service getService() {
 +        return svc;
 +    }
 +
 +    /**
 +     * Sets service instance.
 +     * <p>
 +     * This parameter is mandatory when deploying a service.
 +     *
 +     * @param svc Service instance.
 +     */
 +    public void setService(Service svc) {
 +        this.svc = svc;
 +    }
 +
 +    /**
 +     * Gets total number of deployed service instances in the cluster, {@code 0} for unlimited.
 +     * <p>
 +     * At least one of {@code getTotalCount()} or {@link #getMaxPerNodeCount()} values must be positive.
 +     *
 +     * @return Total number of deployed service instances in the cluster, {@code 0} for unlimited.
 +     */
 +    public int getTotalCount() {
 +        return totalCnt;
 +    }
 +
 +    /**
 +     * Sets total number of deployed service instances in the cluster, {@code 0} for unlimited.
 +     * <p>
 +     * At least one of {@code getTotalCount()} or {@link #getMaxPerNodeCount()} values must be positive.
 +     *
 +     * @param totalCnt Total number of deployed service instances in the cluster, {@code 0} for unlimited.
 +     */
 +    public void setTotalCount(int totalCnt) {
 +        this.totalCnt = totalCnt;
 +    }
 +
 +    /**
 +     * Gets maximum number of deployed service instances on each node, {@code 0} for unlimited.
 +     * <p>
 +     * At least one of {@code getMaxPerNodeCount()} or {@link #getTotalCount()} values must be positive.
 +     *
 +     * @return Maximum number of deployed service instances on each node, {@code 0} for unlimited.
 +     */
 +    public int getMaxPerNodeCount() {
 +        return maxPerNodeCnt;
 +    }
 +
 +    /**
 +     * Sets maximum number of deployed service instances on each node, {@code 0} for unlimited.
 +     * <p>
 +     * At least one of {@code getMaxPerNodeCount()} or {@link #getTotalCount()} values must be positive.
 +     *
 +     * @param maxPerNodeCnt Maximum number of deployed service instances on each node, {@code 0} for unlimited.
 +     */
 +    public void setMaxPerNodeCount(int maxPerNodeCnt) {
 +        this.maxPerNodeCnt = maxPerNodeCnt;
 +    }
 +
 +    /**
 +     * Gets cache name used for key-to-node affinity calculation.
 +     * <p>
 +     * This parameter is optional and is set only when deploying service based on key-affinity.
 +     *
 +     * @return Cache name, possibly {@code null}.
 +     */
 +    public String getCacheName() {
 +        return cacheName;
 +    }
 +
 +    /**
 +     * Sets cache name used for key-to-node affinity calculation.
 +     * <p>
 +     * This parameter is optional and is set only when deploying service based on key-affinity.
 +     *
 +     * @param cacheName Cache name, possibly {@code null}.
 +     */
 +    public void setCacheName(String cacheName) {
 +        this.cacheName = cacheName;
 +    }
 +
 +    /**
 +     * Gets affinity key used for key-to-node affinity calculation.
 +     * <p>
 +     * This parameter is optional and is set only when deploying service based on key-affinity.
 +     *
 +     * @return Affinity key, possibly {@code null}.
 +     */
 +    public Object getAffinityKey() {
 +        return affKey;
 +    }
 +
 +    /**
 +     * Sets affinity key used for key-to-node affinity calculation.
 +     * <p>
 +     * This parameter is optional and is set only when deploying service based on key-affinity.
 +     *
 +     * @param affKey Affinity key, possibly {@code null}.
 +     */
 +    public void setAffinityKey(Object affKey) {
 +        this.affKey = affKey;
 +    }
 +
 +    /**
 +     * Gets node filter used to filter nodes on which the service will be deployed.
 +     * <p>
 +     * This parameter is optional. If not provided service may be deployed on any or all
 +     * nodes in the grid, based on configuration.
 +     *
 +     * @return Node filter used to filter nodes on which the service will be deployed, possibly {@code null}.
 +     */
 +    public IgnitePredicate<ClusterNode> getNodeFilter() {
 +        return nodeFilter;
 +    }
 +
 +    /**
 +     * Sets node filter used to filter nodes on which the service will be deployed.
 +     * <p>
 +     * This parameter is optional. If not provided service may be deployed on any or all
 +     * nodes in the grid, based on configuration.
 +     *
 +     * @param nodeFilter Node filter used to filter nodes on which the service will be deployed, possibly {@code null}.
 +     */
 +    public void setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
 +        this.nodeFilter = nodeFilter;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings({"RedundantIfStatement", "EqualsWhichDoesntCheckParameterClass"})
 +    @Override public boolean equals(Object o) {
 +        if (!equalsIgnoreNodeFilter(o))
 +            return false;
 +
 +        ServiceConfiguration that = (ServiceConfiguration)o;
 +
 +        if (nodeFilter != null && that.nodeFilter != null) {
 +            if (!nodeFilter.getClass().equals(that.nodeFilter.getClass()))
 +                return false;
 +        }
 +        else if (nodeFilter != null || that.nodeFilter != null)
 +            return false;
 +
 +        return true;
 +    }
 +
 +    /**
 +     * Checks if configurations are equal ignoring the node filter. Node filters control on which
 +     * nodes the services are deployed and often can be ignored for equality checks.
 +     *
 +     * @param o Other configuration.
 +     * @return {@code True} if configurations are equal, {@code false} otherwise.
 +     */
 +    @SuppressWarnings("RedundantIfStatement")
 +    public boolean equalsIgnoreNodeFilter(Object o) {
 +        if (this == o)
 +            return true;
 +
 +        if (o == null || getClass() != o.getClass())
 +            return false;
 +
 +        ServiceConfiguration that = (ServiceConfiguration)o;
 +
 +        if (maxPerNodeCnt != that.maxPerNodeCnt)
 +            return false;
 +
 +        if (totalCnt != that.totalCnt)
 +            return false;
 +
 +        if (affKey != null ? !affKey.equals(that.affKey) : that.affKey != null)
 +            return false;
 +
 +        if (cacheName != null ? !cacheName.equals(that.cacheName) : that.cacheName != null)
 +            return false;
 +
 +        if (name != null ? !name.equals(that.name) : that.name != null)
 +            return false;
 +
 +        if (svc != null ? !svc.getClass().equals(that.svc.getClass()) : that.svc != null)
 +            return false;
 +
 +        return true;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int hashCode() {
 +        return name == null ? 0 : name.hashCode();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public String toString() {
 +        String svcCls = svc == null ? "" : svc.getClass().getSimpleName();
 +        String nodeFilterCls = nodeFilter == null ? "" : nodeFilter.getClass().getSimpleName();
 +
 +        return S.toString(ServiceConfiguration.class, this, "svcCls", svcCls, "nodeFilterCls", nodeFilterCls);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/services/package.html
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/services/package.html
index fe62d60,0000000..1cbdc38
mode 100644,000000..100644
--- a/modules/core/src/main/java/org/apache/ignite/services/package.html
+++ b/modules/core/src/main/java/org/apache/ignite/services/package.html
@@@ -1,23 -1,0 +1,23 @@@
 +<!--
 +  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.
-   -->
++-->
 +
 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 +<html>
 +<body>
 +    Contains main <b>Managed Services APIs.</b>
 +</body>
 +</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiManagementMBean.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiManagementMBean.java
index a311cd40,f58aae8..59a2d12
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiManagementMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiManagementMBean.java
@@@ -60,12 -60,12 +60,12 @@@ public interface IgniteSpiManagementMBe
      public long getUpTime();
  
      /**
-      * Gets Gridgain installation home folder (i.e. ${IGNITE_HOME});
+      * Gets Ignite installation home folder (i.e. ${IGNITE_HOME});
       *
-      * @return Gridgain installation home folder.
+      * @return Ignite installation home folder.
       */
-     @MXBeanDescription("Gridgain installation home folder.")
 -    @IgniteMXBeanDescription("Ignite installation home folder.")
 -    public String getIgniteHome();
++    @MXBeanDescription("Ignite installation home folder.")
 +    public String getGridGainHome();
  
      /**
       * Gets ID of the local node.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/authentication/noop/NoopAuthenticationSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
index e3d9ec9,b80eef1..168ae52
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
@@@ -84,10 -84,10 +84,10 @@@ public interface DiscoverySpi extends I
  
      /**
       * Sets a listener for discovery events. Refer to
 -     * {@link org.apache.ignite.events.IgniteDiscoveryEvent} for a set of all possible
 +     * {@link org.apache.ignite.events.DiscoveryEvent} for a set of all possible
       * discovery events.
       * <p>
-      * Note that as of GridGain 3.0.2 this method is called <b>before</b>
+      * Note that as of Ignite 3.0.2 this method is called <b>before</b>
       * method {@link #spiStart(String)} is called. This is done to
       * avoid potential window when SPI is started but the listener is
       * not registered yet.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/EventStorageSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/LoadBalancingSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/securesession/noop/NoopSecureSessionSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/startup/cmdline/CommandLineStartup.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-1.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-2.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-3.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/discovery-stress.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/example-cache.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/ggfs-loopback.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/ggfs-shmem.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/hadoop/core-site-loopback-secondary.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/hadoop/core-site-loopback.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/hadoop/core-site-secondary.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/hadoop/core-site.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/io-manager-benchmark.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/jobs-load-base.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/cache-benchmark.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/cache-client-benchmark.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/dsi-49-server-production.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/dsi-load-base.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/dsi-load-client.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/load/dsi-load-server.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-cache-load.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-cache-put-remove-load.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-cache-swap.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-cache-teststore.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-multicache.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-start-nodes-attr.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/spring-start-nodes.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/websession/spring-cache-1.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/websession/spring-cache-2.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/config/websession/spring-cache-3.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/GridTaskCancelSingleNodeSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 5e60363,620c4d5..6818801
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@@ -3770,85 -2498,53 +2498,53 @@@ public abstract class GridCacheAbstract
       * @throws Exception In case of error.
       */
      @SuppressWarnings("BusyWait")
-     public void testLockFilteredEntry() throws Exception {
+     public void testLockUnlock() throws Exception {
          if (lockingEnabled()) {
-             cache().put("key1", 1);
-             cache().put("key2", 100);
- 
-             for (int i = 0; i < gridCount(); i++) {
-                 assert !cache(i).entry("key1").isLocked();
-                 assert !cache(i).entry("key2").isLocked();
-             }
- 
-             cache().projection(F.<CacheEntry<String, Integer>>alwaysFalse()).entry("key1").lock(0);
-             cache().projection(F.<CacheEntry<String, Integer>>alwaysTrue()).entry("key2").lock(0);
- 
-             boolean passed = false;
- 
-             for (int i = 0; i < gridCount(); i++) {
-                 assert !cache(i).entry("key1").isLocked();
- 
-                 if (cache(i).entry("key2").isLocked())
-                     passed = true;
-             }
- 
-             assert passed;
- 
-             cache().unlockAll(F.asList("key1", "key2"), F.<CacheEntry<String, Integer>>alwaysTrue());
+             final CountDownLatch lockCnt = new CountDownLatch(1);
+             final CountDownLatch unlockCnt = new CountDownLatch(1);
  
-             for (int i = 0; i < 100; i++) {
-                 boolean sleep = false;
 -            grid(0).events().localListen(new IgnitePredicate<IgniteEvent>() {
 -                @Override public boolean apply(IgniteEvent evt) {
++            grid(0).events().localListen(new IgnitePredicate<Event>() {
++                @Override public boolean apply(Event evt) {
+                     switch (evt.type()) {
+                         case EVT_CACHE_OBJECT_LOCKED:
+                             lockCnt.countDown();
  
-                 for (int j = 0; j < gridCount(); j++) {
-                     if (cache(j).entry("key1").isLocked() || cache(j).entry("key2").isLocked()) {
-                         sleep = true;
+                             break;
+                         case EVT_CACHE_OBJECT_UNLOCKED:
+                             unlockCnt.countDown();
  
-                         break;
+                             break;
                      }
+ 
+                     return true;
                  }
+             }, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
  
-                 if (sleep)
-                     Thread.sleep(10);
-                 else
-                     break;
-             }
+             IgniteCache<String, Integer> cache = jcache();
  
-             for (int i = 0; i < gridCount(); i++) {
-                 assert !cache(i).entry("key1").isLocked();
-                 assert !cache(i).entry("key2").isLocked();
-             }
-         }
-     }
+             String key = primaryKeysForCache(cache, 1).get(0);
  
-     /**
-      * @throws Exception In case of error.
-      */
-     @SuppressWarnings("BusyWait")
-     public void testUnlockFilteredEntry() throws Exception {
-         if (lockingEnabled()) {
-             cache().put("key1", 1);
-             cache().put("key2", 100);
+             cache.put(key, 1);
  
-             CacheEntry<String, Integer> e1 = cache().entry("key1");
-             CacheEntry<String, Integer> e2 = cache().entry("key2");
+             assert !cache.isLocalLocked(key, false);
  
-             assert e1 != null;
-             assert e2 != null;
+             Lock lock = cache.lock(key);
  
-             assert !e1.isLocked();
-             assert !e2.isLocked();
+             lock.lock();
  
-             e1.lock(0);
-             e2.lock(0);
+             try {
+                 lockCnt.await();
  
-             assert e1.isLocked();
-             assert e2.isLocked();
+                 assert cache.isLocalLocked(key, false);
+             }
+             finally {
+                 lock.unlock();
+             }
  
-             e1.unlock(F.<CacheEntry<String, Integer>>alwaysFalse());
-             e2.unlock(F.<CacheEntry<String, Integer>>alwaysTrue());
+             unlockCnt.await();
  
              for (int i = 0; i < 100; i++)
-                 if (e2.isLocked())
+                 if (cache.isLocalLocked(key, false))
                      Thread.sleep(10);
                  else
                      break;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
index d134597,3555060..da5bf61
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
@@@ -17,10 -17,11 +17,11 @@@
  
  package org.apache.ignite.internal.processors.cache;
  
 -import org.apache.ignite.*;
 -import org.apache.ignite.cache.*;
 +import org.apache.ignite.configuration.*;
 +import org.apache.ignite.internal.*;
  import org.apache.ignite.internal.util.*;
  import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.lang.*;
  
  import java.util.concurrent.atomic.*;
  

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapReloadSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
index 326c462,6d429d8..6433e0a
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
@@@ -17,10 -17,11 +17,12 @@@
  
  package org.apache.ignite.internal.processors.cache.distributed;
  
+ import org.apache.ignite.*;
  import org.apache.ignite.cache.*;
 +import org.apache.ignite.configuration.*;
  import org.apache.ignite.internal.processors.cache.*;
  
+ import javax.cache.*;
  import java.util.*;
  
  /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
index f9293c6,52e75f1..0b4f048
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
@@@ -17,10 -17,9 +17,10 @@@
  
  package org.apache.ignite.internal.processors.cache.distributed.dht;
  
+ import com.google.common.collect.*;
  import org.apache.ignite.cache.*;
 +import org.apache.ignite.configuration.*;
  import org.apache.ignite.internal.processors.cache.distributed.near.*;
- import org.apache.ignite.internal.util.typedef.*;
  import org.apache.ignite.testframework.*;
  
  import java.util.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index c3b2c70,27903da..5bf323f
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@@ -17,8 -17,9 +17,10 @@@
  
  package org.apache.ignite.internal.processors.cache.distributed.near;
  
+ import com.google.common.collect.*;
+ import org.apache.ignite.*;
  import org.apache.ignite.cache.*;
 +import org.apache.ignite.configuration.*;
  import org.apache.ignite.events.*;
  import org.apache.ignite.internal.util.typedef.*;
  import org.apache.ignite.internal.util.typedef.internal.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index afb7e3f,ced64ac..528e0c8
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@@ -17,9 -17,8 +17,10 @@@
  
  package org.apache.ignite.internal.processors.cache.distributed.near;
  
+ import org.apache.ignite.*;
  import org.apache.ignite.cache.*;
 +import org.apache.ignite.configuration.*;
 +import org.apache.ignite.internal.util.typedef.*;
  
  import javax.cache.expiry.*;
  import java.util.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheDistributedEvictionsSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
----------------------------------------------------------------------


Mime
View raw message