ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [05/16] incubator-ignite git commit: # ignite-60
Date Mon, 26 Jan 2015 14:18:55 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueProxy.java
new file mode 100644
index 0000000..2350355
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueProxy.java
@@ -0,0 +1,745 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Cache queue proxy.
+ */
+public class GridCacheQueueProxy<T> implements IgniteQueue<T>, Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Deserialization stash. */
+    private static final ThreadLocal<IgniteBiTuple<GridCacheContext, String>> stash =
+        new ThreadLocal<IgniteBiTuple<GridCacheContext, String>>() {
+            @Override protected IgniteBiTuple<GridCacheContext, String> initialValue() {
+                return F.t2();
+            }
+        };
+
+    /** Delegate queue. */
+    private GridCacheQueueAdapter<T> delegate;
+
+    /** Cache context. */
+    private GridCacheContext cctx;
+
+    /** Cache gateway. */
+    private GridCacheGateway gate;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridCacheQueueProxy() {
+        // No-op.
+    }
+
+    /**
+     * @param cctx Cache context.
+     * @param delegate Delegate queue.
+     */
+    public GridCacheQueueProxy(GridCacheContext cctx, GridCacheQueueAdapter<T> delegate) {
+        this.cctx = cctx;
+        this.delegate = delegate;
+
+        gate = cctx.gate();
+    }
+
+    /**
+     * @return Delegate queue.
+     */
+    public GridCacheQueueAdapter<T> delegate() {
+        return delegate;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean add(final T item) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.add(item);
+                    }
+                }, cctx);
+
+            return delegate.add(item);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean offer(final T item) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.offer(item);
+                    }
+                }, cctx);
+
+            return delegate.offer(item);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addAll(final Collection<? extends T> items) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.addAll(items);
+                    }
+                }, cctx);
+
+            return delegate.addAll(items);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("SuspiciousMethodCalls")
+    @Override public boolean contains(final Object item) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.contains(item);
+                    }
+                }, cctx);
+
+            return delegate.contains(item);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean containsAll(final Collection<?> items) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.containsAll(items);
+                    }
+                }, cctx);
+
+            return delegate.containsAll(items);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional()) {
+                CU.outTx(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        delegate.clear();
+
+                        return null;
+                    }
+                }, cctx);
+            }
+            else
+                delegate.clear();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("SuspiciousMethodCalls")
+    @Override public boolean remove(final Object item) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.remove(item);
+                    }
+                }, cctx);
+
+            return delegate.remove(item);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removeAll(final Collection<?> items) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.removeAll(items);
+                    }
+                }, cctx);
+
+            return delegate.removeAll(items);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.isEmpty();
+                    }
+                }, cctx);
+
+            return delegate.isEmpty();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterator<T> iterator() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Iterator<T>>() {
+                    @Override public Iterator<T> call() throws Exception {
+                        return delegate.iterator();
+                    }
+                }, cctx);
+
+            return delegate.iterator();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object[] toArray() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Object[]>() {
+                    @Override public Object[] call() throws Exception {
+                        return delegate.toArray();
+                    }
+                }, cctx);
+
+            return delegate.toArray();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("SuspiciousToArrayCall")
+    @Override public <T1> T1[] toArray(final T1[] a) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T1[]>() {
+                    @Override public T1[] call() throws Exception {
+                        return delegate.toArray(a);
+                    }
+                }, cctx);
+
+            return delegate.toArray(a);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean retainAll(final Collection<?> items) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.retainAll(items);
+                    }
+                }, cctx);
+
+            return delegate.retainAll(items);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Integer>() {
+                    @Override public Integer call() throws Exception {
+                        return delegate.size();
+                    }
+                }, cctx);
+
+            return delegate.size();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public T poll() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.poll();
+                    }
+                }, cctx);
+
+            return delegate.poll();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public T peek() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.peek();
+                    }
+                }, cctx);
+
+            return delegate.peek();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear(final int batchSize) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional()) {
+                CU.outTx(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        delegate.clear(batchSize);
+
+                        return null;
+                    }
+                }, cctx);
+            }
+            else
+                delegate.clear(batchSize);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int remainingCapacity() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Integer>() {
+                    @Override public Integer call() throws Exception {
+                        return delegate.remainingCapacity();
+                    }
+                }, cctx);
+
+            return delegate.remainingCapacity();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int drainTo(final Collection<? super T> c) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Integer>() {
+                    @Override public Integer call() throws Exception {
+                        return delegate.drainTo(c);
+                    }
+                }, cctx);
+
+            return delegate.drainTo(c);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int drainTo(final Collection<? super T> c, final int maxElements) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Integer>() {
+                    @Override public Integer call() throws Exception {
+                        return delegate.drainTo(c, maxElements);
+                    }
+                }, cctx);
+
+            return delegate.drainTo(c, maxElements);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public T remove() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.remove();
+                    }
+                }, cctx);
+
+            return delegate.remove();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public T element() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.element();
+                    }
+                }, cctx);
+
+            return delegate.element();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void put(final T item) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional()) {
+                CU.outTx(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        delegate.put(item);
+
+                        return null;
+                    }
+                }, cctx);
+            }
+            else
+                delegate.put(item);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean offer(final T item, final long timeout, final TimeUnit unit) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<Boolean>() {
+                    @Override public Boolean call() throws Exception {
+                        return delegate.offer(item, timeout, unit);
+                    }
+                }, cctx);
+
+            return delegate.offer(item, timeout, unit);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public T take() {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.take();
+                    }
+                }, cctx);
+
+            return delegate.take();
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public T poll(final long timeout, final TimeUnit unit) {
+        gate.enter();
+
+        try {
+            if (cctx.transactional())
+                return CU.outTx(new Callable<T>() {
+                    @Override public T call() throws Exception {
+                        return delegate.poll(timeout, unit);
+                    }
+                }, cctx);
+
+            return delegate.poll(timeout, unit);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+        finally {
+            gate.leave();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return delegate.name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int capacity() throws IgniteCheckedException {
+        return delegate.capacity();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean bounded() throws IgniteCheckedException {
+        return delegate.bounded();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean collocated() throws IgniteCheckedException {
+        return delegate.collocated();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removed() {
+        return delegate.removed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return delegate.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridCacheQueueProxy that = (GridCacheQueueProxy)o;
+
+        return delegate.equals(that.delegate);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(cctx);
+        U.writeString(out, name());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        IgniteBiTuple<GridCacheContext, String> t = stash.get();
+
+        t.set1((GridCacheContext)in.readObject());
+        t.set2(U.readString(in));
+    }
+
+    /**
+     * Reconstructs object on unmarshalling.
+     *
+     * @return Reconstructed object.
+     * @throws ObjectStreamException Thrown in case of unmarshalling error.
+     */
+    protected Object readResolve() throws ObjectStreamException {
+        try {
+            IgniteBiTuple<GridCacheContext, String> t = stash.get();
+
+            return t.get1().dataStructures().queue(t.get2(), 0, false, false);
+        }
+        catch (IgniteCheckedException e) {
+            throw U.withCause(new InvalidObjectException(e.getMessage()), e);
+        }
+        finally {
+            stash.remove();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return delegate.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheRemovable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheRemovable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheRemovable.java
new file mode 100644
index 0000000..48d8644
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheRemovable.java
@@ -0,0 +1,37 @@
+/*
+ * 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.datastructures;
+
+import org.jetbrains.annotations.*;
+
+/**
+ * Provides callback for marking object as removed.
+ */
+public interface GridCacheRemovable {
+    /**
+     * Set status of data structure as removed.
+     *
+     * @return Current status.
+     */
+    public boolean onRemoved();
+
+    /**
+     * @param err Error which cause data structure to become invalid.
+     */
+    public void onInvalid(@Nullable Exception err);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeader.java
new file mode 100644
index 0000000..c77fe7f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeader.java
@@ -0,0 +1,85 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Cache set header.
+ */
+public class GridCacheSetHeader implements GridCacheInternal, Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private IgniteUuid id;
+
+    /** */
+    private boolean collocated;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridCacheSetHeader() {
+        // No-op.
+    }
+
+    /**
+     * @param id Set UUID.
+     * @param collocated Collocation flag.
+     */
+    public GridCacheSetHeader(IgniteUuid id, boolean collocated) {
+        this.id = id;
+        this.collocated = collocated;
+    }
+
+    /**
+     * @return Set unique ID.
+     */
+    public IgniteUuid id() {
+        return id;
+    }
+
+    /**
+     * @return Collocation flag.
+     */
+    public boolean collocated() {
+        return collocated;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeGridUuid(out, id);
+        out.writeBoolean(collocated);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        id = U.readGridUuid(in);
+        collocated = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheSetHeader.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeaderKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeaderKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeaderKey.java
new file mode 100644
index 0000000..fd82e67
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetHeaderKey.java
@@ -0,0 +1,88 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Set header key.
+ */
+public class GridCacheSetHeaderKey implements Externalizable, GridCacheInternal {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String name;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridCacheSetHeaderKey() {
+        // No-op.
+    }
+
+    /**
+     * @param name Set name.
+     */
+    public GridCacheSetHeaderKey(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return Set name.
+     */
+    public String name() {
+        return name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridCacheSetHeaderKey setKey = (GridCacheSetHeaderKey)o;
+
+        return name.equals(setKey.name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return name.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheSetHeaderKey.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
new file mode 100644
index 0000000..05c96f1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
@@ -0,0 +1,576 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.datastructures.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.*;
+
+/**
+ * Cache set implementation.
+ */
+public class GridCacheSetImpl<T> extends AbstractCollection<T> implements IgniteSet<T> {
+    /** */
+    private static final int BATCH_SIZE = 100;
+
+    /** Cache context. */
+    private final GridCacheContext ctx;
+
+    /** Cache. */
+    private final GridCache<GridCacheSetItemKey, Boolean> cache;
+
+    /** Set name. */
+    private final String name;
+
+    /** Set unique ID. */
+    private final IgniteUuid id;
+
+    /** Collocation flag. */
+    private final boolean collocated;
+
+    /** Queue header partition. */
+    private final int hdrPart;
+
+    /** Removed flag. */
+    private volatile boolean rmvd;
+
+    /**
+     * @param ctx Cache context.
+     * @param name Set name.
+     * @param hdr Set header.
+     */
+    @SuppressWarnings("unchecked")
+    public GridCacheSetImpl(GridCacheContext ctx, String name, GridCacheSetHeader hdr) {
+        this.ctx = ctx;
+        this.name = name;
+        id = hdr.id();
+        collocated = hdr.collocated();
+
+        cache = ctx.cache();
+
+        hdrPart = ctx.affinity().partition(new GridCacheSetHeaderKey(name));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean collocated() {
+        return collocated;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removed() {
+        return rmvd;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public int size() {
+        try {
+            onAccess();
+
+            if (ctx.isLocal() || ctx.isReplicated()) {
+                GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id);
+
+                return set != null ? set.size() : 0;
+            }
+
+            CacheQuery qry = new GridCacheQueryAdapter<>(ctx, SET, null, null, null,
+                new GridSetQueryPredicate<>(id, collocated), false, false);
+
+            Collection<ClusterNode> nodes = dataNodes(ctx.affinity().affinityTopologyVersion());
+
+            qry.projection(ctx.grid().forNodes(nodes));
+
+            Iterable<Integer> col = (Iterable<Integer>) qry.execute(new SumReducer()).get();
+
+            int sum = 0;
+
+            for (Integer val : col)
+                sum += val;
+
+            return sum;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public boolean isEmpty() {
+        onAccess();
+
+        GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id);
+
+        return (set == null || set.isEmpty()) && size() == 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean contains(Object o) {
+        onAccess();
+
+        final GridCacheSetItemKey key = itemKey(o);
+
+        return retry(new Callable<Boolean>() {
+            @Override public Boolean call() throws Exception {
+                return cache.get(key) != null;
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean add(T o) {
+        onAccess();
+
+        final GridCacheSetItemKey key = itemKey(o);
+
+        return retry(new Callable<Boolean>() {
+            @Override public Boolean call() throws Exception {
+                return cache.putxIfAbsent(key, true);
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean remove(Object o) {
+        onAccess();
+
+        final GridCacheSetItemKey key = itemKey(o);
+
+        return retry(new Callable<Boolean>() {
+            @Override public Boolean call() throws Exception {
+                return cache.removex(key);
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean containsAll(Collection<?> c) {
+        for (Object obj : c) {
+            if (!contains(obj))
+                return false;
+        }
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addAll(Collection<? extends T> c) {
+        onAccess();
+
+        boolean add = false;
+
+        Map<GridCacheSetItemKey, Boolean> addKeys = null;
+
+        for (T obj : c) {
+            if (add) {
+                if (addKeys == null)
+                    addKeys = U.newHashMap(BATCH_SIZE);
+
+                addKeys.put(itemKey(obj), true);
+
+                if (addKeys.size() == BATCH_SIZE) {
+                    retryPutAll(addKeys);
+
+                    addKeys.clear();
+                }
+            }
+            else
+                add |= add(obj);
+        }
+
+        if (!F.isEmpty(addKeys))
+            retryPutAll(addKeys);
+
+        return add;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removeAll(Collection<?> c) {
+        onAccess();
+
+        boolean rmv = false;
+
+        Set<GridCacheSetItemKey> rmvKeys = null;
+
+        for (Object obj : c) {
+            if (rmv) {
+                if (rmvKeys == null)
+                    rmvKeys = U.newHashSet(BATCH_SIZE);
+
+                rmvKeys.add(itemKey(obj));
+
+                if (rmvKeys.size() == BATCH_SIZE) {
+                    retryRemoveAll(rmvKeys);
+
+                    rmvKeys.clear();
+                }
+            }
+            else
+                rmv |= remove(obj);
+        }
+
+        if (!F.isEmpty(rmvKeys))
+            retryRemoveAll(rmvKeys);
+
+        return rmv;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean retainAll(Collection<?> c) {
+        try {
+            onAccess();
+
+            try (GridCloseableIterator<T> iter = iterator0()) {
+                boolean rmv = false;
+
+                Set<GridCacheSetItemKey> rmvKeys = null;
+
+                for (T val : iter) {
+                    if (!c.contains(val)) {
+                        rmv = true;
+
+                        if (rmvKeys == null)
+                            rmvKeys = U.newHashSet(BATCH_SIZE);
+
+                        rmvKeys.add(itemKey(val));
+
+                        if (rmvKeys.size() == BATCH_SIZE) {
+                            retryRemoveAll(rmvKeys);
+
+                            rmvKeys.clear();
+                        }
+                    }
+                }
+
+                if (!F.isEmpty(rmvKeys))
+                    retryRemoveAll(rmvKeys);
+
+                return rmv;
+            }
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() {
+        try {
+            onAccess();
+
+            try (GridCloseableIterator<T> iter = iterator0()) {
+                Collection<GridCacheSetItemKey> rmvKeys = new ArrayList<>(BATCH_SIZE);
+
+                for (T val : iter) {
+                    rmvKeys.add(itemKey(val));
+
+                    if (rmvKeys.size() == BATCH_SIZE) {
+                        retryRemoveAll(rmvKeys);
+
+                        rmvKeys.clear();
+                    }
+                }
+
+                if (!rmvKeys.isEmpty())
+                    retryRemoveAll(rmvKeys);
+            }
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterator<T> iterator() {
+        onAccess();
+
+        return iterator0();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    private GridCloseableIterator<T> iterator0() {
+        try {
+            CacheQuery qry = new GridCacheQueryAdapter<>(ctx, SET, null, null, null,
+                new GridSetQueryPredicate<>(id, collocated), false, false);
+
+            Collection<ClusterNode> nodes = dataNodes(ctx.affinity().affinityTopologyVersion());
+
+            qry.projection(ctx.grid().forNodes(nodes));
+
+            CacheQueryFuture<Map.Entry<T, ?>> fut = qry.execute();
+
+            CacheWeakQueryIteratorsHolder.WeakQueryFutureIterator it =
+                ctx.itHolder().iterator(fut, new CacheIteratorConverter<T, Map.Entry<T, ?>>() {
+                    @Override protected T convert(Map.Entry<T, ?> e) {
+                        return e.getKey();
+                    }
+
+                    @Override protected void remove(T item) {
+                        GridCacheSetImpl.this.remove(item);
+                    }
+                });
+
+            if (rmvd) {
+                ctx.itHolder().removeIterator(it);
+
+                checkRemoved();
+            }
+
+            return it;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+    /**
+     * @param call Callable.
+     * @return Callable result.
+     */
+    private <R> R retry(Callable<R> call) {
+        try {
+            return (R)ctx.dataStructures().retry(call);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /**
+     * @param keys Keys to remove.
+     */
+    private void retryRemoveAll(final Collection<GridCacheSetItemKey> keys) {
+        retry(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                cache.removeAll(keys);
+
+                return null;
+            }
+        });
+    }
+
+    /**
+     * @param keys Keys to remove.
+     */
+    private void retryPutAll(final Map<GridCacheSetItemKey, Boolean> keys) {
+        retry(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                cache.putAll(keys);
+
+                return null;
+            }
+        });
+    }
+
+    /**
+     * @param topVer Topology version.
+     * @return Nodes where set data request should be sent.
+     * @throws IgniteCheckedException If all cache nodes left grid.
+     */
+    @SuppressWarnings("unchecked")
+    private Collection<ClusterNode> dataNodes(long topVer) throws IgniteCheckedException {
+        if (ctx.isLocal() || ctx.isReplicated())
+            return Collections.singleton(ctx.localNode());
+
+        Collection<ClusterNode> nodes;
+
+        if (collocated) {
+            List<ClusterNode> nodes0 = ctx.affinity().nodes(hdrPart, topVer);
+
+            nodes = !nodes0.isEmpty() ?
+                Collections.singleton(nodes0.contains(ctx.localNode()) ? ctx.localNode() : F.first(nodes0)) : nodes0;
+        }
+        else
+            nodes = CU.affinityNodes(ctx, topVer);
+
+        if (nodes.isEmpty())
+            throw new IgniteCheckedException("Failed to get set data, all cache nodes left grid.");
+
+        return nodes;
+    }
+
+    /**
+     * @param rmvd Removed flag.
+     */
+    void removed(boolean rmvd) {
+        if (this.rmvd)
+            return;
+
+        this.rmvd = rmvd;
+
+        if (rmvd)
+            ctx.itHolder().clearQueries();
+    }
+
+    /**
+     * Throws {@link org.apache.ignite.cache.datastructures.CacheDataStructureRemovedRuntimeException} if set was removed.
+     */
+    private void checkRemoved() {
+        if (rmvd)
+            throw new CacheDataStructureRemovedRuntimeException("Set has been removed from cache: " + this);
+    }
+
+    /**
+     * Checks if set was removed and handles iterators weak reference queue.
+     */
+    private void onAccess() {
+        ctx.itHolder().checkWeakQueue();
+
+        checkRemoved();
+    }
+
+    /**
+     * @return Set ID.
+     */
+    IgniteUuid id() {
+        return id;
+    }
+
+    /**
+     * @return Cache context.
+     */
+    GridCacheContext context() {
+        return ctx;
+    }
+
+    /**
+     * @param item Set item.
+     * @return Item key.
+     */
+    private GridCacheSetItemKey itemKey(Object item) {
+        return collocated ? new CollocatedItemKey(name, id, item) : new GridCacheSetItemKey(id, item);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheSetImpl.class, this);
+    }
+
+    /**
+     *
+     */
+    private static class SumReducer implements IgniteReducer<Object, Integer>, Externalizable {
+        /** */
+        private static final long serialVersionUID = -3436987759126521204L;
+
+        /** */
+        private int cntr;
+
+        /**
+         * Required by {@link Externalizable}.
+         */
+        public SumReducer() {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean collect(@Nullable Object o) {
+            cntr++;
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer reduce() {
+            return cntr;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            // No-op.
+        }
+    }
+
+    /**
+     * Item key for collocated set.
+     */
+    private static class CollocatedItemKey extends GridCacheSetItemKey {
+        /** */
+        private static final long serialVersionUID = -1400701398705953750L;
+
+        /** */
+        private String setName;
+
+        /**
+         * Required by {@link Externalizable}.
+         */
+        public CollocatedItemKey() {
+            // No-op.
+        }
+
+        /**
+         * @param setName Set name.
+         * @param setId Set unique ID.
+         * @param item Set item.
+         */
+        private CollocatedItemKey(String setName, IgniteUuid setId, Object item) {
+            super(setId, item);
+
+            this.setName = setName;
+        }
+
+        /**
+         * @return Item affinity key.
+         */
+        @CacheAffinityKeyMapped
+        public Object affinityKey() {
+            return setName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            super.writeExternal(out);
+
+            U.writeString(out, setName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            super.readExternal(in);
+
+            setName = U.readString(in);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
new file mode 100644
index 0000000..6cfa70c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetItemKey.java
@@ -0,0 +1,109 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Set item key.
+ */
+public class GridCacheSetItemKey implements GridCacheInternal, Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private IgniteUuid setId;
+
+    /** */
+    @GridToStringInclude
+    private Object item;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridCacheSetItemKey() {
+        // No-op.
+    }
+
+    /**
+     * @param setId Set unique ID.
+     * @param item Set item.
+     */
+    GridCacheSetItemKey(IgniteUuid setId, Object item) {
+        this.setId = setId;
+        this.item = item;
+    }
+
+    /**
+     * @return Set UUID.
+     */
+    public IgniteUuid setId() {
+        return setId;
+    }
+
+    /**
+     * @return Set item.
+     */
+    public Object item() {
+        return item;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int result = setId.hashCode();
+
+        result = 31 * result + item.hashCode();
+
+        return result;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridCacheSetItemKey that = (GridCacheSetItemKey)o;
+
+        return setId.equals(that.setId) && item.equals(that.item);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeGridUuid(out, setId);
+        out.writeObject(item);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        setId = U.readGridUuid(in);
+        item = in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridCacheSetItemKey.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
new file mode 100644
index 0000000..9093f4c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetProxy.java
@@ -0,0 +1,537 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.datastructures.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Cache set proxy.
+ */
+public class GridCacheSetProxy<T> implements IgniteSet<T>, Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Deserialization stash. */
+    private static final ThreadLocal<IgniteBiTuple<GridCacheContext, String>> stash =
+        new ThreadLocal<IgniteBiTuple<GridCacheContext, String>>() {
+            @Override protected IgniteBiTuple<GridCacheContext, String> initialValue() {
+                return F.t2();
+            }
+        };
+
+    /** Delegate set. */
+    private GridCacheSetImpl<T> delegate;
+
+    /** Cache context. */
+    private GridCacheContext cctx;
+
+    /** Cache gateway. */
+    private GridCacheGateway gate;
+
+    /** Busy lock. */
+    private GridSpinBusyLock busyLock;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridCacheSetProxy() {
+        // No-op.
+    }
+
+    /**
+     * @param cctx Cache context.
+     * @param delegate Delegate set.
+     */
+    public GridCacheSetProxy(GridCacheContext cctx, GridCacheSetImpl<T> delegate) {
+        this.cctx = cctx;
+        this.delegate = delegate;
+
+        gate = cctx.gate();
+
+        busyLock = new GridSpinBusyLock();
+    }
+
+    /**
+     * Remove callback.
+     */
+    void blockOnRemove() {
+        delegate.removed(true);
+
+        busyLock.block();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Integer>() {
+                        @Override public Integer call() throws Exception {
+                            return delegate.size();
+                        }
+                    }, cctx);
+
+                return delegate.size();
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.isEmpty();
+                        }
+                    }, cctx);
+
+                return delegate.isEmpty();
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean contains(final Object o) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.contains(o);
+                        }
+                    }, cctx);
+
+                return delegate.contains(o);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @NotNull @Override public Object[] toArray() {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Object[]>() {
+                        @Override public Object[] call() throws Exception {
+                            return delegate.toArray();
+                        }
+                    }, cctx);
+
+                return delegate.toArray();
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @NotNull @Override public <T1> T1[] toArray(final T1[] a) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<T1[]>() {
+                        @Override public T1[] call() throws Exception {
+                            return delegate.toArray(a);
+                        }
+                    }, cctx);
+
+                return delegate.toArray(a);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean add(final T t) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.add(t);
+                        }
+                    }, cctx);
+
+                return delegate.add(t);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean remove(final Object o) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.remove(o);
+                        }
+                    }, cctx);
+
+                return delegate.remove(o);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean containsAll(final Collection<?> c) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.containsAll(c);
+                        }
+                    }, cctx);
+
+                return delegate.containsAll(c);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addAll(final Collection<? extends T> c) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.addAll(c);
+                        }
+                    }, cctx);
+
+                return delegate.addAll(c);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean retainAll(final Collection<?> c) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.retainAll(c);
+                        }
+                    }, cctx);
+
+                return delegate.retainAll(c);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removeAll(final Collection<?> c) {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Boolean>() {
+                        @Override public Boolean call() throws Exception {
+                            return delegate.removeAll(c);
+                        }
+                    }, cctx);
+
+                return delegate.removeAll(c);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional()) {
+                    CU.outTx(new Callable<Void>() {
+                        @Override public Void call() throws Exception {
+                            delegate.clear();
+
+                            return null;
+                        }
+                    }, cctx);
+                }
+                else
+                    delegate.clear();
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterator<T> iterator() {
+        enterBusy();
+
+        try {
+            gate.enter();
+
+            try {
+                if (cctx.transactional())
+                    return CU.outTx(new Callable<Iterator<T>>() {
+                        @Override public Iterator<T> call() throws Exception {
+                            return delegate.iterator();
+                        }
+                    }, cctx);
+
+                return delegate.iterator();
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+            finally {
+                gate.leave();
+            }
+        }
+        finally {
+            leaveBusy();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return delegate.name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean collocated() throws IgniteCheckedException {
+        return delegate.collocated();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean removed() {
+        return delegate.removed();
+    }
+
+    /**
+     * Enters busy state.
+     */
+    private void enterBusy() {
+        if (!busyLock.enterBusy())
+            throw new CacheDataStructureRemovedRuntimeException("Set has been removed from cache: " + delegate);
+    }
+
+    /**
+     * Leaves busy state.
+     */
+    private void leaveBusy() {
+        busyLock.leaveBusy();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(cctx);
+        U.writeString(out, name());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        IgniteBiTuple<GridCacheContext, String> t = stash.get();
+
+        t.set1((GridCacheContext)in.readObject());
+        t.set2(U.readString(in));
+    }
+
+    /**
+     * Reconstructs object on unmarshalling.
+     *
+     * @return Reconstructed object.
+     * @throws ObjectStreamException Thrown in case of unmarshalling error.
+     */
+    protected Object readResolve() throws ObjectStreamException {
+        try {
+            IgniteBiTuple<GridCacheContext, String> t = stash.get();
+
+            return t.get1().dataStructures().set(t.get2(), false, false);
+        }
+        catch (IgniteCheckedException e) {
+            throw U.withCause(new InvalidObjectException(e.getMessage()), e);
+        }
+        finally {
+            stash.remove();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return delegate.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridSetQueryPredicate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridSetQueryPredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridSetQueryPredicate.java
new file mode 100644
index 0000000..f6d9f36
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridSetQueryPredicate.java
@@ -0,0 +1,115 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Predicate for query over {@link org.apache.ignite.IgniteSet} items.
+ */
+public class GridSetQueryPredicate<K, V> implements IgniteBiPredicate<K, V>, Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private IgniteUuid setId;
+
+    /** */
+    private boolean collocated;
+
+    /** */
+    private GridCacheContext ctx;
+
+    /** */
+    private boolean filter;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public GridSetQueryPredicate() {
+        // No-op.
+    }
+
+    /**
+     * @param setId Set ID.
+     * @param collocated Collocation flag.
+     */
+    public GridSetQueryPredicate(IgniteUuid setId, boolean collocated) {
+        this.setId = setId;
+        this.collocated = collocated;
+    }
+
+    /**
+     * @param ctx Cache context.
+     */
+    public void init(GridCacheContext ctx) {
+        this.ctx = ctx;
+
+        filter = filterKeys();
+    }
+
+    /**
+     *
+     * @return Collocation flag.
+     */
+    public boolean collocated() {
+        return collocated;
+    }
+
+    /**
+     * @return Set ID.
+     */
+    public IgniteUuid setId() {
+        return setId;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public boolean apply(K k, V v) {
+        return !filter || ctx.affinity().primary(ctx.localNode(), k, ctx.affinity().affinityTopologyVersion());
+    }
+
+    /**
+     * @return {@code True} if need to filter out non-primary keys during processing of set data query.
+     */
+    private boolean filterKeys() {
+        return !collocated && !(ctx.isLocal() || ctx.isReplicated()) &&
+            (ctx.config().getBackups() > 0 || CU.isNearEnabled(ctx));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeGridUuid(out, setId);
+        out.writeBoolean(collocated);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        setId = U.readGridUuid(in);
+        collocated = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridSetQueryPredicate.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
new file mode 100644
index 0000000..c2b0e8c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
@@ -0,0 +1,262 @@
+/*
+ * 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.datastructures;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.transactions.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.*;
+import java.util.*;
+
+import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
+import static org.apache.ignite.transactions.IgniteTxIsolation.*;
+
+/**
+ * {@link org.apache.ignite.IgniteQueue} implementation using transactional cache.
+ */
+public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> {
+    /** */
+    private final IgniteTransactions txs;
+
+    /**
+     * @param queueName Queue name.
+     * @param hdr Queue header.
+     * @param cctx Cache context.
+     */
+    public GridTransactionalCacheQueueImpl(String queueName, GridCacheQueueHeader hdr, GridCacheContext<?, ?> cctx) {
+        super(queueName, hdr, cctx);
+
+        txs = cctx.kernalContext().grid().transactions();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public boolean offer(final T item) throws IgniteException {
+        A.notNull(item, "item");
+
+        try {
+            boolean retVal;
+
+            int cnt = 0;
+
+            while (true) {
+                try {
+                    try (IgniteTx tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                        Long idx = (Long)cache.invoke(queueKey, new AddProcessor(id, 1));
+
+                        if (idx != null) {
+                            checkRemoved(idx);
+
+                            cache.put(itemKey(idx), item);
+
+                            retVal = true;
+                        }
+                        else
+                            retVal = false;
+
+                        tx.commit();
+
+                        break;
+                    }
+                }
+                catch (CacheException e) {
+                    if (e.getCause() instanceof ClusterGroupEmptyException)
+                        throw e;
+
+                    if (e.getCause() instanceof ClusterTopologyException) {
+                        if (cnt++ == MAX_UPDATE_RETRIES)
+                            throw e;
+                        else {
+                            U.warn(log, "Failed to add item, will retry [err=" + e + ']');
+
+                            U.sleep(RETRY_DELAY);
+                        }
+                    }
+                    else
+                        throw e;
+                }
+            }
+
+            return retVal;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Nullable @Override public T poll() throws IgniteException {
+        try {
+            int cnt = 0;
+
+            T retVal;
+
+            while (true) {
+                try (IgniteTx tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                    Long idx = (Long)cache.invoke(queueKey, new PollProcessor(id));
+
+                    if (idx != null) {
+                        checkRemoved(idx);
+
+                        retVal = (T)cache.getAndRemove(itemKey(idx));
+
+                        assert retVal != null;
+                    }
+                    else
+                        retVal = null;
+
+                    tx.commit();
+
+                    break;
+                }
+                catch (CacheException e) {
+                    if (e.getCause() instanceof ClusterGroupEmptyException)
+                        throw e;
+
+                    if (e.getCause() instanceof ClusterTopologyException) {
+                        if (cnt++ == MAX_UPDATE_RETRIES)
+                            throw e;
+                        else {
+                            U.warn(log, "Failed to add item, will retry [err=" + e + ']');
+
+                            U.sleep(RETRY_DELAY);
+                        }
+                    }
+                    else
+                        throw e;
+                }
+            }
+
+            return retVal;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public boolean addAll(final Collection<? extends T> items) {
+        A.notNull(items, "items");
+
+        try {
+            boolean retVal;
+
+            int cnt = 0;
+
+            while (true) {
+                try (IgniteTx tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                    Long idx = (Long)cache.invoke(queueKey, new AddProcessor(id, items.size()));
+
+                    if (idx != null) {
+                        checkRemoved(idx);
+
+                        Map<GridCacheQueueItemKey, T> putMap = new HashMap<>();
+
+                        for (T item : items) {
+                            putMap.put(itemKey(idx), item);
+
+                            idx++;
+                        }
+
+                        cache.putAll(putMap);
+
+                        retVal = true;
+                    }
+                    else
+                        retVal = false;
+
+                    tx.commit();
+
+                    break;
+                }
+                catch (CacheException e) {
+                    if (e.getCause() instanceof ClusterGroupEmptyException)
+                        throw e;
+
+                    if (e.getCause() instanceof ClusterTopologyException) {
+                        if (cnt++ == MAX_UPDATE_RETRIES)
+                            throw e;
+                        else {
+                            U.warn(log, "Failed to add item, will retry [err=" + e + ']');
+
+                            U.sleep(RETRY_DELAY);
+                        }
+                    }
+                    else
+                        throw e;
+                }
+            }
+
+            return retVal;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected void removeItem(final long rmvIdx) throws IgniteCheckedException {
+        try {
+            int cnt = 0;
+
+            while (true) {
+                try (IgniteTx tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                    Long idx = (Long)cache.invoke(queueKey, new RemoveProcessor(id, rmvIdx));
+
+                    if (idx != null) {
+                        checkRemoved(idx);
+
+                        boolean rmv = cache.remove(itemKey(idx));
+
+                        assert rmv;
+                    }
+
+                    tx.commit();
+
+                    break;
+                }
+                catch (CacheException e) {
+                    if (e.getCause() instanceof ClusterGroupEmptyException)
+                        throw e;
+
+                    if (e.getCause() instanceof ClusterTopologyException) {
+                        if (cnt++ == MAX_UPDATE_RETRIES)
+                            throw e;
+                        else {
+                            U.warn(log, "Failed to add item, will retry [err=" + e + ']');
+
+                            U.sleep(RETRY_DELAY);
+                        }
+                    }
+                    else
+                        throw e;
+                }
+            }
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index fd18982..b516410 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.rest.handlers.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
index 4785639..68fe3d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.cache.eviction.lru.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cluster.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
index 10e60c2..5f11190 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
@@ -21,8 +21,8 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.datastructures.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.datastructures.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.jetbrains.annotations.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index 4012c74..c5d9b22 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.datastructures;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.lang.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
index b64b0ca..e3c3ddb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractQueueFailoverDataConsistencySelfTest.java
@@ -17,13 +17,14 @@
 
 package org.apache.ignite.internal.processors.cache.datastructures;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.datastructures.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.testframework.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicLongApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicLongApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicLongApiSelfTest.java
index d0ecff1..4018068 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicLongApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicLongApiSelfTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.datastructures;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
index 52a9b36..75c8f46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.datastructures;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.GridCache;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.cache.store.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c10a6c7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java
index 9e82a55..4103944 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceMultiNodeAbstractTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.datastructures;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.datastructures.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.discovery.tcp.*;


Mime
View raw message