Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 451E517EB1 for ; Wed, 1 Apr 2015 09:12:56 +0000 (UTC) Received: (qmail 6497 invoked by uid 500); 1 Apr 2015 09:12:34 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 6426 invoked by uid 500); 1 Apr 2015 09:12:34 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 6371 invoked by uid 99); 1 Apr 2015 09:12:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Apr 2015 09:12:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 01 Apr 2015 09:12:28 +0000 Received: (qmail 4357 invoked by uid 99); 1 Apr 2015 09:12:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Apr 2015 09:12:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5922BE2F1C; Wed, 1 Apr 2015 09:12:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 01 Apr 2015 09:12:16 -0000 Message-Id: <60d4a34ece7f40fea4940dbf75aa2f88@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [09/50] incubator-ignite git commit: #ignite-629: remove CacheFlag SKIP_STORE. X-Virus-Checked: Checked by ClamAV on apache.org #ignite-629: remove CacheFlag SKIP_STORE. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aa3864dd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aa3864dd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aa3864dd Branch: refs/heads/ignite-gg-9950 Commit: aa3864dd0ede52d643f5bfb7f3f060c72b97d3d7 Parents: 5d5e8a3 Author: ivasilinets Authored: Mon Mar 30 00:52:47 2015 +0300 Committer: ivasilinets Committed: Mon Mar 30 00:52:47 2015 +0300 ---------------------------------------------------------------------- .../client/impl/ClientCacheFlagsCodecTest.java | 17 ++-- .../internal/processors/cache/CacheFlag.java | 50 ------------ .../processors/cache/CacheFlagException.java | 67 ---------------- .../processors/cache/CacheProjection.java | 64 ++-------------- .../processors/cache/GridCacheAdapter.java | 46 +++++------ .../processors/cache/GridCacheContext.java | 18 ++--- .../processors/cache/GridCacheMapEntry.java | 1 - .../processors/cache/GridCacheProjectionEx.java | 8 -- .../cache/GridCacheProjectionImpl.java | 81 ++++++-------------- .../processors/cache/GridCacheProxyImpl.java | 41 +++++----- .../cache/GridCacheSharedContext.java | 15 ---- .../processors/cache/IgniteCacheProxy.java | 26 ++----- .../dht/atomic/GridNearAtomicUpdateFuture.java | 1 - .../dht/colocated/GridDhtColocatedCache.java | 1 - .../distributed/near/GridNearAtomicCache.java | 1 - .../distributed/near/GridNearCacheAdapter.java | 1 - .../near/GridNearTransactionalCache.java | 1 - .../local/atomic/GridLocalAtomicCache.java | 1 - .../handlers/cache/GridCacheCommandHandler.java | 56 +++++++------- .../GridCacheReturnValueTransferSelfTest.java | 1 - .../cache/IgniteCacheInvokeAbstractTest.java | 1 - ...GridCacheValueConsistencyAtomicSelfTest.java | 1 - .../OptimizedObjectStreamSelfTest.java | 4 - .../ignite/scalar/pimps/ScalarCachePimp.scala | 36 --------- 24 files changed, 115 insertions(+), 424 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java index 1117cd6..973a0a3 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java @@ -20,7 +20,6 @@ package org.apache.ignite.internal.client.impl; import junit.framework.*; import org.apache.ignite.internal.client.*; import org.apache.ignite.internal.client.impl.connection.*; -import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.rest.handlers.cache.*; import org.apache.ignite.internal.util.typedef.*; @@ -29,7 +28,7 @@ import java.util.*; import static org.apache.ignite.internal.client.GridClientCacheFlag.*; /** - * Tests conversions between GridClientCacheFlag and CacheFlag. + * Tests conversions between GridClientCacheFlag. */ public class ClientCacheFlagsCodecTest extends TestCase { /** @@ -44,10 +43,8 @@ public class ClientCacheFlagsCodecTest extends TestCase { assertTrue(bits != 0); - CacheFlag[] out = GridCacheCommandHandler.parseCacheFlags(bits); - assertEquals(1, out.length); - - assertEquals(f.name(), out[0].name()); + boolean out = GridCacheCommandHandler.parseCacheFlags(bits); + assertEquals(out, true); } } @@ -70,12 +67,10 @@ public class ClientCacheFlagsCodecTest extends TestCase { int bits = GridClientConnection.encodeCacheFlags(flagSet); - CacheFlag[] out = GridCacheCommandHandler.parseCacheFlags(bits); + boolean out = GridCacheCommandHandler.parseCacheFlags(bits); - assertEquals(flagSet.contains(KEEP_PORTABLES) ? flagSet.size() - 1 : flagSet.size(), out.length); + int length = flagSet.contains(KEEP_PORTABLES) ? flagSet.size() - 1 : flagSet.size(); - for (CacheFlag f : out) { - assertTrue(flagSet.contains(GridClientCacheFlag.valueOf(f.name()))); - } + assertEquals(length > 0, out); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java deleted file mode 100644 index f403a53..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import javax.cache.processor.*; - -/** - * Cache projection flags that specify projection behaviour. This flags can be explicitly passed into - * the following methods on {@link CacheProjection}: - *
    - *
  • {@link CacheProjection#flagsOn(CacheFlag...)}
  • - *
  • {@link CacheProjection#flagsOff(CacheFlag...)}
  • - *
- */ -public enum CacheFlag { - /** Skips store, i.e. no read-through and no write-through behavior. */ - SKIP_STORE; - - /** */ - private static final CacheFlag[] VALS = values(); - - /** - * Efficiently gets enumerated value from its ordinal. - * - * @param ord Ordinal value. - * @return Enumerated value or {@code null} if ordinal out of range. - */ - @Nullable public static CacheFlag fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlagException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlagException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlagException.java deleted file mode 100644 index feac108..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlagException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.*; -import org.apache.ignite.internal.util.typedef.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Exception thrown when projection flags check fails. - */ -public class CacheFlagException extends IgniteException { - /** */ - private static final long serialVersionUID = 0L; - - /** Flags that caused this exception. */ - private Collection flags; - - /** - * @param flags Cause flags. - */ - public CacheFlagException(@Nullable CacheFlag... flags) { - this(F.asList(flags)); - } - - /** - * @param flags Cause flags. - */ - public CacheFlagException(@Nullable Collection flags) { - super(message(flags)); - - this.flags = flags; - } - - /** - * @return Cause flags. - */ - public Collection flags() { - return flags; - } - - /** - * @param flags Flags. - * @return String information about cause flags. - */ - private static String message(Collection flags) { - return "Cache projection flag violation (if flag is LOCAL, make sure to use peek(..) " + - "instead of get(..) methods)" + (F.isEmpty(flags) ? "." : " [flags=" + flags + ']'); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java index 9fd1285..fb51620 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java @@ -205,11 +205,9 @@ public interface CacheProjection extends Iterable> { public GridCache cache(); /** - * Gets cache flags enabled on this projection. - * - * @return Flags for this projection (empty set if no flags have been set). + * @return Skip store. */ - public Set flags(); + public boolean skipStore(); /** * Returns queries facade responsible for creating various SQL, TEXT, or SCAN queries. @@ -243,25 +241,10 @@ public interface CacheProjection extends Iterable> { public CacheProjection projection(@Nullable CacheEntryPredicate filter); /** - * Gets cache projection base on this one, but with the specified flags turned on. - *

Cache Flags

- * The resulting projection will inherit all the flags from this projection. - * - * @param flags Flags to turn on (if empty, then no-op). - * @return New projection based on this one, but with the specified flags turned on. - */ - public CacheProjection flagsOn(@Nullable CacheFlag... flags); - - /** - * Gets cache projection base on this but with the specified flags turned off. - *

Cache Flags

- * The resulting projection will inherit all the flags from this projection except for - * the ones that were turned off. - * - * @param flags Flags to turn off (if empty, then all flags will be turned off). - * @return New projection based on this one, but with the specified flags turned off. + * @param skipStore Skip store. + * @retur New projection based on this one, but with skip store. */ - public CacheProjection flagsOff(@Nullable CacheFlag... flags); + public CacheProjection setSkipStore(boolean skipStore); /** * Creates projection that will operate with portable objects. @@ -447,7 +430,6 @@ public interface CacheProjection extends Iterable> { * @param key Key to retrieve the value for. * @return Value for the given key. * @throws IgniteCheckedException If get operation failed. - * @throws CacheFlagException If failed projection flags validation. * @throws NullPointerException if the key is {@code null}. */ @Nullable public V get(K key) throws IgniteCheckedException; @@ -470,7 +452,6 @@ public interface CacheProjection extends Iterable> { * @param key Key for the value to get. * @return Future for the get operation. * @throws NullPointerException if the key is {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture getAsync(K key); @@ -492,7 +473,6 @@ public interface CacheProjection extends Iterable> { * @param keys Keys to get. * @return Map of key-value pairs. * @throws IgniteCheckedException If get operation failed. - * @throws CacheFlagException If failed projection flags validation. */ public Map getAll(@Nullable Collection keys) throws IgniteCheckedException; @@ -513,7 +493,6 @@ public interface CacheProjection extends Iterable> { * * @param keys Key for the value to get. * @return Future for the get operation. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture> getAllAsync(@Nullable Collection keys); @@ -546,7 +525,6 @@ public interface CacheProjection extends Iterable> { * or in persistent storage. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ @Nullable public V put(K key, V val, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -579,7 +557,6 @@ public interface CacheProjection extends Iterable> { * that filter check is atomic with put operation. * @return Future for the put operation. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putAsync(K key, V val, @Nullable CacheEntryPredicate... filter); @@ -608,7 +585,6 @@ public interface CacheProjection extends Iterable> { * specified. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean putx(K key, V val, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -637,7 +613,6 @@ public interface CacheProjection extends Iterable> { * passed and value was stored in cache, {@code false} otherwise. Note that future will * return {@code true} if filter is not specified. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putxAsync(K key, V val, @Nullable CacheEntryPredicate... filter); @@ -665,7 +640,6 @@ public interface CacheProjection extends Iterable> { * @return Previously contained value regardless of whether put happened or not. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ @Nullable public V putIfAbsent(K key, V val) throws IgniteCheckedException; @@ -693,7 +667,6 @@ public interface CacheProjection extends Iterable> { * @return Future of put operation which will provide previously contained value * regardless of whether put happened or not. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putIfAbsentAsync(K key, V val); @@ -716,7 +689,6 @@ public interface CacheProjection extends Iterable> { * @return {@code true} if value is stored in cache and {@code false} otherwise. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean putxIfAbsent(K key, V val) throws IgniteCheckedException; @@ -738,7 +710,6 @@ public interface CacheProjection extends Iterable> { * @param val Value to be associated with the given key. * @return Future for this put operation. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putxIfAbsentAsync(K key, V val); @@ -765,7 +736,6 @@ public interface CacheProjection extends Iterable> { * @return Previously contained value regardless of whether replace happened or not. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. - * @throws CacheFlagException If projection flags validation failed. */ @Nullable public V replace(K key, V val) throws IgniteCheckedException; @@ -791,7 +761,6 @@ public interface CacheProjection extends Iterable> { * @param val Value to be associated with the given key. * @return Future for replace operation. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture replaceAsync(K key, V val); @@ -814,7 +783,6 @@ public interface CacheProjection extends Iterable> { * @return {@code True} if replace happened, {@code false} otherwise. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean replacex(K key, V val) throws IgniteCheckedException; @@ -836,7 +804,6 @@ public interface CacheProjection extends Iterable> { * @param val Value to be associated with the given key. * @return Future for the replace operation. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture replacexAsync(K key, V val); @@ -858,7 +825,6 @@ public interface CacheProjection extends Iterable> { * @return {@code True} if replace happened, {@code false} otherwise. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException; @@ -879,7 +845,6 @@ public interface CacheProjection extends Iterable> { * @param newVal Value to be associated with the given key. * @return Future for the replace operation. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture replaceAsync(K key, V oldVal, V newVal); @@ -898,7 +863,6 @@ public interface CacheProjection extends Iterable> { * @param filter Optional entry filter. If provided, then entry will * be stored only if the filter returned {@code true}. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public void putAll(@Nullable Map m, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -918,7 +882,6 @@ public interface CacheProjection extends Iterable> { * @param filter Optional entry filter. If provided, then entry will * be stored only if the filter returned {@code true}. * @return Future for putAll operation. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putAllAsync(@Nullable Map m, @Nullable CacheEntryPredicate... filter); @@ -1287,7 +1250,6 @@ public interface CacheProjection extends Iterable> { * if there was no value for this key. * @throws NullPointerException If key is {@code null}. * @throws IgniteCheckedException If remove operation failed. - * @throws CacheFlagException If projection flags validation failed. */ @Nullable public V remove(K key, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1315,7 +1277,6 @@ public interface CacheProjection extends Iterable> { * that filter is checked atomically together with remove operation. * @return Future for the remove operation. * @throws NullPointerException if the key is {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture removeAsync(K key, CacheEntryPredicate... filter); @@ -1338,7 +1299,6 @@ public interface CacheProjection extends Iterable> { * Note that if filter is not specified, this method will return {@code true}. * @throws NullPointerException if the key is {@code null}. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean removex(K key, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1362,7 +1322,6 @@ public interface CacheProjection extends Iterable> { * if optional filters passed validation and remove did occur, {@code false} otherwise. * Note that if filter is not specified, this method will return {@code true}. * @throws NullPointerException if the key is {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture removexAsync(K key, @Nullable CacheEntryPredicate... filter); @@ -1382,7 +1341,6 @@ public interface CacheProjection extends Iterable> { * {@code false} otherwise. * @throws NullPointerException if the key or value is {@code null}. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If projection flags validation failed. */ public boolean remove(K key, V val) throws IgniteCheckedException; @@ -1403,7 +1361,6 @@ public interface CacheProjection extends Iterable> { * @return Future for the remove operation. The future will return {@code true} * if currently cached value will match the passed in one. * @throws NullPointerException if the key or value is {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture removeAsync(K key, V val); @@ -1421,7 +1378,6 @@ public interface CacheProjection extends Iterable> { * @param filter Optional filter to check prior to removing value form cache. Note * that filter is checked atomically together with remove operation. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If flags validation failed. */ public void removeAll(@Nullable Collection keys, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1441,7 +1397,6 @@ public interface CacheProjection extends Iterable> { * that filter is checked atomically together with remove operation. * @return Future for the remove operation. The future will complete whenever * remove operation completes. - * @throws CacheFlagException If flags validation failed. */ public IgniteInternalFuture removeAllAsync(@Nullable Collection keys, @Nullable CacheEntryPredicate... filter); @@ -1463,7 +1418,6 @@ public interface CacheProjection extends Iterable> { * if there is one. * * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If flags validation failed. */ public void removeAll() throws IgniteCheckedException; @@ -1495,7 +1449,6 @@ public interface CacheProjection extends Iterable> { * @return {@code True} if all filters passed and lock was acquired, * {@code false} otherwise. * @throws IgniteCheckedException If lock acquisition resulted in error. - * @throws CacheFlagException If flags validation failed. */ public boolean lock(K key, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1518,7 +1471,6 @@ public interface CacheProjection extends Iterable> { * @return Future for the lock operation. The future will return {@code true} * whenever all filters pass and locks are acquired before timeout is expired, * {@code false} otherwise. - * @throws CacheFlagException If flags validation failed. */ public IgniteInternalFuture lockAsync(K key, long timeout, @Nullable CacheEntryPredicate... filter); @@ -1541,7 +1493,6 @@ public interface CacheProjection extends Iterable> { * @return {@code True} if all filters passed and locks were acquired before * timeout has expired, {@code false} otherwise. * @throws IgniteCheckedException If lock acquisition resulted in error. - * @throws CacheFlagException If flags validation failed. */ public boolean lockAll(@Nullable Collection keys, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1564,7 +1515,6 @@ public interface CacheProjection extends Iterable> { * @return Future for the collection of locks. The future will return * {@code true} if all filters passed and locks were acquired before * timeout has expired, {@code false} otherwise. - * @throws CacheFlagException If flags validation failed. */ public IgniteInternalFuture lockAllAsync(@Nullable Collection keys, long timeout, @Nullable CacheEntryPredicate... filter); @@ -1582,7 +1532,6 @@ public interface CacheProjection extends Iterable> { * @param key Key to unlock. * @param filter Optional filter that needs to pass prior to unlock taking effect. * @throws IgniteCheckedException If unlock execution resulted in error. - * @throws CacheFlagException If flags validation failed. */ public void unlock(K key, CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1601,7 +1550,6 @@ public interface CacheProjection extends Iterable> { * @param filter Optional filter which needs to pass for individual entries * to be unlocked. * @throws IgniteCheckedException If unlock execution resulted in error. - * @throws CacheFlagException If flags validation failed. */ public void unlockAll(@Nullable Collection keys, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException; @@ -1710,7 +1658,6 @@ public interface CacheProjection extends Iterable> { * @param key Key to promote entry for. * @return Unswapped entry value or {@code null} for non-existing key. * @throws IgniteCheckedException If promote failed. - * @throws CacheFlagException If flags validation failed. */ @Nullable public V promote(K key) throws IgniteCheckedException; @@ -1722,7 +1669,6 @@ public interface CacheProjection extends Iterable> { * * @param keys Keys to promote entries for. * @throws IgniteCheckedException If promote failed. - * @throws CacheFlagException If flags validation failed. */ public void promoteAll(@Nullable Collection keys) throws IgniteCheckedException; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 177b9b2..864d6b2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -63,7 +63,6 @@ import static java.util.Collections.*; import static org.apache.ignite.IgniteSystemProperties.*; import static org.apache.ignite.events.EventType.*; import static org.apache.ignite.internal.GridClosureCallMode.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; import static org.apache.ignite.internal.processors.dr.GridDrType.*; import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.*; @@ -380,11 +379,6 @@ public abstract class GridCacheAdapter implements GridCache, } /** {@inheritDoc} */ - @Override public Set flags() { - return new HashSet<>(); - } - - /** {@inheritDoc} */ @Override public CacheEntryPredicate predicate() { return null; } @@ -394,7 +388,7 @@ public abstract class GridCacheAdapter implements GridCache, GridCacheProjectionImpl prj = new GridCacheProjectionImpl<>(this, ctx, null, - null, + false, subjId, false, null); @@ -403,27 +397,27 @@ public abstract class GridCacheAdapter implements GridCache, } /** {@inheritDoc} */ - @Override public CacheProjection flagsOn(@Nullable CacheFlag[] flags) { - if (F.isEmpty(flags)) + @Override public boolean skipStore() { + return false; + } + + /** {@inheritDoc} */ + @Override public CacheProjection setSkipStore(boolean skipStore) { + if (!skipStore) return this; GridCacheProjectionImpl prj = new GridCacheProjectionImpl<>(this, - ctx, - null, - EnumSet.copyOf(F.asList(flags)), - null, - false, - null); + ctx, + null, + skipStore, + null, + false, + null); return new GridCacheProxyImpl<>(ctx, prj, prj); } /** {@inheritDoc} */ - @Override public CacheProjection flagsOff(@Nullable CacheFlag[] flags) { - return this; - } - - /** {@inheritDoc} */ @Override public CacheProjection keepPortable() { GridCacheProjectionImpl prj = keepPortable0(); @@ -440,7 +434,7 @@ public abstract class GridCacheAdapter implements GridCache, (CacheProjection)this, (GridCacheContext)ctx, null, - null, + false, null, true, null @@ -458,7 +452,7 @@ public abstract class GridCacheAdapter implements GridCache, this, ctx, null, - null, + false, null, false, plc); @@ -482,7 +476,7 @@ public abstract class GridCacheAdapter implements GridCache, GridCacheProjectionImpl prj = new GridCacheProjectionImpl<>((CacheProjection)this, (GridCacheContext)ctx, CU.typeFilter0(keyType, valType), - /*flags*/null, + false, /*clientId*/null, false, null); @@ -508,7 +502,7 @@ public abstract class GridCacheAdapter implements GridCache, this, ctx, filter, - null, + false, null, false, null); @@ -4442,7 +4436,7 @@ public abstract class GridCacheAdapter implements GridCache, OPTIMISTIC, READ_COMMITTED, tCfg.getDefaultTxTimeout(), - !ctx.hasFlag(SKIP_STORE), + !skipStore(), 0, /** group lock keys */null, /** partition lock */false @@ -4513,7 +4507,7 @@ public abstract class GridCacheAdapter implements GridCache, OPTIMISTIC, READ_COMMITTED, ctx.kernalContext().config().getTransactionConfiguration().getDefaultTxTimeout(), - !ctx.hasFlag(SKIP_STORE), + !ctx.skipStore(), 0, null, false); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 5e07337..4f1267d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -67,7 +67,6 @@ import static org.apache.ignite.cache.CacheMemoryMode.*; import static org.apache.ignite.cache.CacheRebalanceMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; /** * Cache context. @@ -1238,22 +1237,19 @@ public class GridCacheContext implements Externalizable { } /** - * - * @param flag Flag to check. - * @return {@code true} if the given flag is set. + * @return {@code true} if the skip store is set. */ - public boolean hasFlag(CacheFlag flag) { - assert flag != null; - + public boolean skipStore() { if (nearContext()) - return dht().near().context().hasFlag(flag); + return dht().near().context().skipStore(); GridCacheProjectionImpl prj = prjPerCall.get(); - return (prj != null && prj.flags().contains(flag)); + return (prj != null && prj.skipStore()); } + /** * @return {@code True} if need check near cache context. */ @@ -1356,7 +1352,7 @@ public class GridCacheContext implements Externalizable { * @return {@code True} if store read-through mode is enabled. */ public boolean readThrough() { - return cacheCfg.isReadThrough() && !hasFlag(SKIP_STORE); + return cacheCfg.isReadThrough() && !skipStore(); } /** @@ -1370,7 +1366,7 @@ public class GridCacheContext implements Externalizable { * @return {@code True} if store write-through is enabled. */ public boolean writeThrough() { - return cacheCfg.isWriteThrough() && !hasFlag(SKIP_STORE); + return cacheCfg.isWriteThrough() && !skipStore(); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index d32eb21..6e2dcbd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -46,7 +46,6 @@ import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.events.EventType.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.dr.GridDrType.*; import static org.apache.ignite.transactions.TransactionState.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java index b435d88..30ba66e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java @@ -110,7 +110,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * * @param drMap DR map. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public void putAllConflict(Map drMap) throws IgniteCheckedException; @@ -120,7 +119,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @param drMap DR map. * @return Future. * @throws IgniteCheckedException If put operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture putAllConflictAsync(Map drMap) throws IgniteCheckedException; @@ -153,7 +151,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * * @param drMap DR map. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If projection flags validation failed. */ public void removeAllConflict(Map drMap) throws IgniteCheckedException; @@ -163,7 +160,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @param drMap DR map. * @return Future. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture removeAllConflictAsync(Map drMap) throws IgniteCheckedException; @@ -208,7 +204,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @return Future for the replace operation. The future will return object containing actual old value and success * flag. * @throws NullPointerException If either key or value are {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture replacexAsync(K key, V oldVal, V newVal); @@ -230,7 +225,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @return Object containing actual old value and success flag. * @throws NullPointerException If either key or value are {@code null}. * @throws IgniteCheckedException If replace operation failed. - * @throws CacheFlagException If projection flags validation failed. */ public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException; @@ -248,7 +242,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @return Object containing actual old value and success flag. * @throws NullPointerException if the key or value is {@code null}. * @throws IgniteCheckedException If remove failed. - * @throws CacheFlagException If projection flags validation failed. */ public GridCacheReturn removex(K key, V val) throws IgniteCheckedException; @@ -269,7 +262,6 @@ public interface GridCacheProjectionEx extends CacheProjection { * @return Future for the remove operation. The future will return object containing actual old value and success * flag. * @throws NullPointerException if the key or value is {@code null}. - * @throws CacheFlagException If projection flags validation failed. */ public IgniteInternalFuture removexAsync(K key, V val); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java index 051c532..b3367ca 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java @@ -65,9 +65,9 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx qry; - /** Flags. */ + /** Skip store. */ @GridToStringInclude - private Set flags; + private boolean skipStore; /** Client ID which operates over this projection, if any, */ private UUID subjId; @@ -89,30 +89,23 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx parent, GridCacheContext cctx, @Nullable CacheEntryPredicate entryFilter, - @Nullable Set flags, + boolean skipStore, @Nullable UUID subjId, boolean keepPortable, @Nullable ExpiryPolicy expiryPlc) { assert parent != null; assert cctx != null; - // Check if projection flags are conflicting with an ongoing transaction, if any. - cctx.shared().checkTxFlags(flags); - this.cctx = cctx; - this.flags = !F.isEmpty(flags) ? EnumSet.copyOf(flags) : EnumSet.noneOf(CacheFlag.class); - - Set f = this.flags; - - this.flags = Collections.unmodifiableSet(f); + this.skipStore = skipStore; this.filter = entryFilter; @@ -261,7 +254,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx prj = new GridCacheProjectionImpl<>(this, cctx, filter, - flags, + skipStore, subjId, keepPortable, expiryPlc); @@ -299,7 +292,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx)this, (GridCacheContext)cctx, CU.typeFilter0(keyType, valType), - flags, + skipStore, subjId, keepPortable, expiryPlc); @@ -328,7 +321,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx prj = new GridCacheProjectionImpl<>(this, cctx, filter, - flags, + skipStore, subjId, keepPortable, expiryPlc); @@ -338,47 +331,17 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx flagsOn(@Nullable CacheFlag[] flags) { - if (F.isEmpty(flags)) + @Override public CacheProjection setSkipStore(boolean skipStore) { + if (this.skipStore == skipStore) return new GridCacheProxyImpl<>(cctx, this, this); - Set res = EnumSet.noneOf(CacheFlag.class); - - if (!F.isEmpty(this.flags)) - res.addAll(this.flags); - - res.addAll(EnumSet.copyOf(F.asList(flags))); - GridCacheProjectionImpl prj = new GridCacheProjectionImpl<>(this, - cctx, - filter, - res, - subjId, - keepPortable, - expiryPlc); - - return new GridCacheProxyImpl<>(cctx, prj, prj); - } - - /** {@inheritDoc} */ - @Override public CacheProjection flagsOff(@Nullable CacheFlag[] flags) { - if (F.isEmpty(flags)) - return new GridCacheProxyImpl<>(cctx, this, this); - - Set res = EnumSet.noneOf(CacheFlag.class); - - if (!F.isEmpty(this.flags)) - res.addAll(this.flags); - - res.removeAll(EnumSet.copyOf(F.asList(flags))); - - GridCacheProjectionImpl prj = new GridCacheProjectionImpl<>(this, - cctx, - filter, - res, - subjId, - keepPortable, - expiryPlc); + cctx, + filter, + skipStore, + subjId, + keepPortable, + expiryPlc); return new GridCacheProxyImpl<>(cctx, prj, prj); } @@ -389,7 +352,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx)this, (GridCacheContext)cctx, filter, - flags, + skipStore, subjId, true, expiryPlc); @@ -782,8 +745,8 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx flags() { - return flags; + @Override public boolean skipStore() { + return false; } /** {@inheritDoc} */ @@ -1147,7 +1110,7 @@ public class GridCacheProjectionImpl implements GridCacheProjectionEx implements GridCacheProjectionEx implements GridCacheProjectionEx implements GridCacheProxy, Externali } /** {@inheritDoc} */ + @Override public boolean skipStore() { + GridCacheProjectionImpl prev = gate.enter(prj); + + try { + return delegate.skipStore(); + } + finally { + gate.leave(prev); + } + } + + /** {@inheritDoc} */ @Override public CacheQueries queries() { return qry; } @@ -278,20 +290,7 @@ public class GridCacheProxyImpl implements GridCacheProxy, Externali try { return cache.toMap(); - } - finally { - gate.leave(prev); - } - } - - /** {@inheritDoc} */ - @Override public Set flags() { - GridCacheProjectionImpl prev = gate.enter(prj); - - try { - return delegate.flags(); - } - finally { + } finally { gate.leave(prev); } } @@ -321,13 +320,15 @@ public class GridCacheProxyImpl implements GridCacheProxy, Externali } /** {@inheritDoc} */ - @Override public CacheProjection flagsOn(@Nullable CacheFlag[] flags) { - return delegate.flagsOn(flags); - } + @Override public CacheProjection setSkipStore(boolean skipStore) { + GridCacheProjectionImpl prev = gate.enter(prj); - /** {@inheritDoc} */ - @Override public CacheProjection flagsOff(@Nullable CacheFlag[] flags) { - return delegate.flagsOff(flags); + try { + return delegate.setSkipStore(skipStore); + } + finally { + gate.leave(prev); + } } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java index 449dc63..af38faf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java @@ -38,8 +38,6 @@ import org.jetbrains.annotations.*; import java.util.*; import java.util.concurrent.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; - /** * Shared context. */ @@ -453,19 +451,6 @@ public class GridCacheSharedContext { } /** - * @param flags Flags to turn on. - * @throws CacheFlagException If given flags are conflicting with given transaction. - */ - public void checkTxFlags(@Nullable Collection flags) throws CacheFlagException { - IgniteInternalTx tx = tm().userTxx(); - - if (tx == null || F.isEmpty(flags)) - return; - - assert flags != null; - } - - /** * Nulling references to potentially leak-prone objects. */ public void cleanup() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 2e1deaa..2196fba 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -189,7 +189,7 @@ public class IgniteCacheProxy extends AsyncSupportAdapter withSkipStore() { - return flagOn(CacheFlag.SKIP_STORE); + return skipStore(); } /** {@inheritDoc} */ @@ -1385,7 +1385,7 @@ public class IgniteCacheProxy extends AsyncSupportAdapter)(prj != null ? prj : delegate), (GridCacheContext)ctx, null, - prj != null ? prj.flags() : null, + prj != null ? prj.skipStore() : false, prj != null ? prj.subjectId() : null, true, prj != null ? prj.expiry() : null); @@ -1401,33 +1401,23 @@ public class IgniteCacheProxy extends AsyncSupportAdapter flagOn(CacheFlag flag) { + public IgniteCache skipStore() { GridCacheProjectionImpl prev = gate.enter(prj); try { - Set res; - Set flags0 = prj != null ? prj.flags() : null; + boolean skip = prj != null ? prj.skipStore() : false; - if (flags0 != null) { - if (flags0.contains(flag)) - return this; - - res = EnumSet.copyOf(flags0); - } - else - res = EnumSet.noneOf(CacheFlag.class); - - res.add(flag); + if (skip) + return this; GridCacheProjectionImpl prj0 = new GridCacheProjectionImpl<>( (prj != null ? prj : delegate), ctx, null, - res, + skip, prj != null ? prj.subjectId() : null, true, prj != null ? prj.expiry() : null); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java index 50051fe..ac4ae2c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java @@ -44,7 +44,6 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index 279cac6..eb6d9a6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -39,7 +39,6 @@ import javax.cache.*; import java.io.*; import java.util.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index 4f949a1..e677403 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -39,7 +39,6 @@ import java.io.*; import java.util.*; import static org.apache.ignite.IgniteSystemProperties.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; import static org.apache.ignite.internal.processors.dr.GridDrType.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java index c986926..75c8978 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java @@ -38,7 +38,6 @@ import javax.cache.expiry.*; import java.io.*; import java.util.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index eb602aa..5f982e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -37,7 +37,6 @@ import org.jetbrains.annotations.*; import java.io.*; import java.util.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.transactions.TransactionConcurrency.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java index 626bd99..80ef55c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java @@ -40,7 +40,6 @@ import java.io.*; import java.util.*; import java.util.concurrent.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/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 0724605..549662e 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 @@ -81,9 +81,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PREPEND ); - /** */ - private static final CacheFlag[] EMPTY_FLAGS = new CacheFlag[0]; - /** * @param ctx Context. */ @@ -102,16 +99,14 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { * @param cacheFlagsBits Integer representation of cache flags bit set. * @return Array of cache flags. */ - public static CacheFlag[] parseCacheFlags(int cacheFlagsBits) { + public static boolean parseCacheFlags(int cacheFlagsBits) { if (cacheFlagsBits == 0) - return EMPTY_FLAGS; - - EnumSet flagSet = EnumSet.noneOf(CacheFlag.class); + return false; if ((cacheFlagsBits & 1) != 0) - flagSet.add(CacheFlag.SKIP_STORE); + return true; - return flagSet.toArray(new CacheFlag[flagSet.size()]); + return false; } /** {@inheritDoc} */ @@ -129,7 +124,8 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { final Object key = req0.key(); - final CacheFlag[] flags = parseCacheFlags(req0.cacheFlags()); + final boolean skip= parseCacheFlags(req0.cacheFlags()); + try { GridRestCommand cmd = req0.command(); @@ -143,7 +139,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { switch (cmd) { case CACHE_GET: { - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new GetCommand(key)); break; @@ -165,7 +161,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { keys0.add(getKey); } - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new GetAllCommand(keys0)); break; @@ -177,7 +173,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { if (val == null) throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, new + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new PutCommand(key, ttl, val)); break; @@ -189,7 +185,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { if (val == null) throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new AddCommand(key, ttl, val)); break; @@ -212,14 +208,14 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { // HashMap wrapping for correct serialization map = new HashMap<>(map); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new PutAllCommand(map)); break; } case CACHE_REMOVE: { - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new RemoveCommand(key)); break; @@ -231,7 +227,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { // HashSet wrapping for correct serialization Set keys = map == null ? null : new HashSet<>(map.keySet()); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new RemoveAllCommand(keys)); break; @@ -243,7 +239,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { if (val == null) throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new ReplaceCommand(key, ttl, val)); break; @@ -253,21 +249,21 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { final Object val1 = req0.value(); final Object val2 = req0.value2(); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new CasCommand(val2, val1, key)); break; } case CACHE_APPEND: { - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new AppendCommand(key, req0)); break; } case CACHE_PREPEND: { - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, flags, key, + fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip, key, new PrependCommand(key, req0)); break; @@ -309,7 +305,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { * If {@code null} - operation could be executed anywhere. * @param clientId Client ID. * @param cacheName Cache name. - * @param flags Cache flags. + * @param skipStore Skip store. * @param key Key to set affinity mapping in the response. * @param op Operation to perform. * @return Operation result in future. @@ -319,7 +315,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { @Nullable UUID destId, UUID clientId, final String cacheName, - final CacheFlag[] flags, + final boolean skipStore, final Object key, final CacheProjectionCommand op) throws IgniteCheckedException { @@ -327,7 +323,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { destId == null || destId.equals(ctx.localNodeId()) || replicatedCacheAvailable(cacheName); if (locExec) { - CacheProjection prj = localCache(cacheName).forSubjectId(clientId).flagsOn(flags); + CacheProjection prj = localCache(cacheName).forSubjectId(clientId).setSkipStore(skipStore); return op.apply((CacheProjection)prj, ctx). chain(resultWrapper((CacheProjection)prj, key)); @@ -338,7 +334,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { ctx.task().setThreadContext(TC_NO_FAILOVER, true); return ctx.closure().callAsync(BALANCE, - new FlaggedCacheOperationCallable(clientId, cacheName, flags, op, key), + new FlaggedCacheOperationCallable(clientId, cacheName, skipStore, op, key), prj.nodes()); } } @@ -615,7 +611,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { private final String cacheName; /** */ - private final CacheFlag[] flags; + private final boolean skipStore; /** */ private final CacheProjectionCommand op; @@ -630,25 +626,25 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { /** * @param clientId Client ID. * @param cacheName Cache name. - * @param flags Flags. + * @param skipStore Skip store. * @param op Operation. * @param key Key. */ private FlaggedCacheOperationCallable(UUID clientId, String cacheName, - CacheFlag[] flags, + boolean skipStore, CacheProjectionCommand op, Object key) { this.clientId = clientId; this.cacheName = cacheName; - this.flags = flags; + this.skipStore = skipStore; this.op = op; this.key = key; } /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { - CacheProjection prj = cache(g, cacheName).forSubjectId(clientId).flagsOn(flags); + CacheProjection prj = cache(g, cacheName).forSubjectId(clientId).setSkipStore(skipStore); // Need to apply both operation and response transformation remotely // as cache could be inaccessible on local node and http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java index 9771376..5b3e19d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java @@ -30,7 +30,6 @@ import java.util.*; import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; /** * Tests transform for extra traffic. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java index b5af288..6cbb287 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java @@ -32,7 +32,6 @@ import java.util.concurrent.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; import static org.apache.ignite.transactions.TransactionConcurrency.*; import static org.apache.ignite.transactions.TransactionIsolation.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java index a77e78c..4166369 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java @@ -29,7 +29,6 @@ import java.io.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.internal.processors.cache.CacheFlag.*; /** * Tests cache value consistency for ATOMIC mode. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java index dbed25e..3988357 100644 --- a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamSelfTest.java @@ -1006,10 +1006,6 @@ public class OptimizedObjectStreamSelfTest extends GridCommonAbstractTest { Throwable t = new Throwable("Throwable"); assertEquals(t.getMessage(), ((Throwable)marshalUnmarshal(t)).getMessage()); - - CacheFlagException flagEx = new CacheFlagException(CacheFlag.SKIP_STORE); - - assertEquals(flagEx.flags(), ((CacheFlagException)marshalUnmarshal(flagEx)).flags()); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aa3864dd/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCachePimp.scala ---------------------------------------------------------------------- diff --git a/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCachePimp.scala b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCachePimp.scala index e9e6de7..95916dd 100644 --- a/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCachePimp.scala +++ b/modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/ScalarCachePimp.scala @@ -213,10 +213,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param kv Key-Value pair to store in cache. * @return `True` if value was stored in cache, `false` otherwise. * @see `IgniteCache#putx(...)` @@ -235,10 +231,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param kv Key-Value pair to store in cache. * @return Previous value associated with specified key, or `null` * if entry did not pass the filter, or if there was no mapping for the key in swap @@ -259,10 +251,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param kv Key-Value pair to store in cache. * @return Previous value associated with specified key as an option. * @see `IgniteCache#put(...)` @@ -289,10 +277,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param kv1 Key-value pair to store in cache. * @param kv2 Key-value pair to store in cache. * @param kvs Optional key-value pairs to store in cache. @@ -319,10 +303,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param kvs Key-value pairs to store in cache. If `null` this function is no-op. * @see `IgniteCache#putAll(...)` */ @@ -341,10 +321,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param ks Sequence of additional keys to remove. If `null` - this function is no-op. * @see `IgniteCache#removeAll(...)` */ @@ -386,10 +362,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param k Key whose mapping is to be removed from cache. * @return Previous value associated with specified key, or `null` * if there was no value for this key. @@ -418,10 +390,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param k Key whose mapping is to be removed from cache. * @return Previous value associated with specified key as an option. * @see `IgniteCache#remove(...)` @@ -449,10 +417,6 @@ with Iterable[Cache.Entry[K, V]] with Ordered[IgniteCache[K, V]] { * This method is transactional and will enlist the entry into ongoing transaction * if there is one. * - * ===Cache Flags=== - * This method is not available if any of the following flags are set on projection: - * `CacheFlag#READ`. - * * @param k1 1st key to remove. * @param k2 2nd key to remove. * @param ks Optional sequence of additional keys to remove.