http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlagException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlagException.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlagException.java deleted file mode 100644 index 2c7e29a..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlagException.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.gridgain.grid.cache; - -import org.apache.ignite.*; -import org.gridgain.grid.util.typedef.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Exception thrown when projection flags check fails. - */ -public class GridCacheFlagException extends IgniteException { - /** */ - private static final long serialVersionUID = 0L; - - /** Flags that caused this exception. */ - private Collection<GridCacheFlag> flags; - - /** - * @param flags Cause flags. - */ - public GridCacheFlagException(@Nullable GridCacheFlag... flags) { - this(F.asList(flags)); - } - - /** - * @param flags Cause flags. - */ - public GridCacheFlagException(@Nullable Collection<GridCacheFlag> flags) { - super(message(flags)); - - this.flags = flags; - } - - /** - * @return Cause flags. - */ - public Collection<GridCacheFlag> flags() { - return flags; - } - - /** - * @param flags Flags. - * @return String information about cause flags. - */ - private static String message(Collection<GridCacheFlag> 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/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java deleted file mode 100644 index f4ea728..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.gridgain.grid.cache; - -import org.apache.ignite.cache.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -/** - * Cache interceptor. Cache interceptor can be used for getting callbacks before - * and after cache {@code get(...)}, {@code put(...)}, and {@code remove(...)} - * operations. The {@code onBefore} callbacks can also be used to change the values - * stored in cache or preventing entries from being removed from cache. - * <p> - * Cache interceptor is configured via {@link CacheConfiguration#getInterceptor()} - * configuration property. - * <p> - * Any grid resource from {@code org.gridgain.grid.resources} package can be injected - * into implementation of this interface. - */ -public interface GridCacheInterceptor<K, V> { - /** - * This method is called within {@link GridCacheProjection#get(Object)} - * and similar operations to provide control over returned value. - * <p> - * If this method returns {@code null}, then {@code get()} operation - * results in {@code null} as well. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Value mapped to {@code key} at the moment of {@code get()} operation. - * @return The new value to be returned as result of {@code get()} operation. - * @see GridCacheProjection#get(Object) - */ - @Nullable public V onGet(K key, @Nullable V val); - - /** - * This method is called within {@link GridCacheProjection#put(Object, Object, IgnitePredicate[])} - * and similar operations before new value is stored in cache. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param oldVal Old value. - * @param newVal New value. - * @return Value to be put to cache. Returning {@code null} cancels the update. - * @see GridCacheProjection#put(Object, Object, IgnitePredicate[]) - */ - @Nullable public V onBeforePut(K key, @Nullable V oldVal, V newVal); - - /** - * This method is called after new value has been stored. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Current value. - */ - public void onAfterPut(K key, V val); - - /** - * This method is called within {@link GridCacheProjection#remove(Object, IgnitePredicate[])} - * and similar operations to provide control over returned value. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Old value. - * @return Tuple. The first value is the flag whether remove should be cancelled or not. - * The second is the value to be returned as result of {@code remove()} operation, - * may be {@code null}. - * @see GridCacheProjection#remove(Object, IgnitePredicate[]) - */ - @Nullable public IgniteBiTuple<Boolean, V> onBeforeRemove(K key, @Nullable V val); - - /** - * This method is called after value has been removed. - * <p> - * Implementations should not execute any complex logic, - * including locking, networking or cache operations, - * as it may lead to deadlock, since this method is called - * from sensitive synchronization blocks. - * <p> - * This method should not throw any exception. - * - * @param key Key. - * @param val Removed value. - */ - public void onAfterRemove(K key, V val); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptorAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptorAdapter.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptorAdapter.java deleted file mode 100644 index 6c86a37..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptorAdapter.java +++ /dev/null @@ -1,52 +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.gridgain.grid.cache; - -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -/** - * Cache interceptor convenience adapter. It provides no-op implementations for all - * interceptor callbacks. - */ -public class GridCacheInterceptorAdapter<K, V> implements GridCacheInterceptor<K, V> { - /** {@inheritDoc} */ - @Nullable @Override public V onGet(K key, V val) { - return val; - } - - /** {@inheritDoc} */ - @Nullable @Override public V onBeforePut(K key, @Nullable V oldVal, V newVal) { - return newVal; - } - - /** {@inheritDoc} */ - @Override public void onAfterPut(K key, V val) { - // No-op. - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteBiTuple<Boolean, V> onBeforeRemove(K key, @Nullable V val) { - return new IgniteBiTuple<>(false, val); - } - - /** {@inheritDoc} */ - @Override public void onAfterRemove(K key, V val) { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java deleted file mode 100644 index 43cc089..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java +++ /dev/null @@ -1,296 +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.gridgain.grid.cache; - -import org.apache.ignite.cache.CacheConfiguration; -import org.apache.ignite.mbean.*; - -/** - * This interface defines JMX view on {@link GridCache}. - */ -@IgniteMBeanDescription("MBean that provides access to cache descriptor.") -public interface GridCacheMBean { - /** - * Gets name of this cache. - * - * @return Cache name. - */ - @IgniteMBeanDescription("Cache name.") - public String name(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - @IgniteMBeanDescription("Formatted cache metrics.") - public String metricsFormatted(); - - /** - * Gets number of entries that was swapped to disk. - * - * @return Number of entries that was swapped to disk. - */ - @IgniteMBeanDescription("Number of entries that was swapped to disk.") - public long getOverflowSize(); - - /** - * Gets number of entries stored in off-heap memory. - * - * @return Number of entries stored in off-heap memory. - */ - @IgniteMBeanDescription("Number of entries stored in off-heap memory.") - public long getOffHeapEntriesCount(); - - /** - * Gets memory size allocated in off-heap. - * - * @return Memory size allocated in off-heap. - */ - @IgniteMBeanDescription("Memory size allocated in off-heap.") - public long getOffHeapAllocatedSize(); - - /** - * Returns number of non-{@code null} values in the cache. - * - * @return Number of non-{@code null} values in the cache. - */ - @IgniteMBeanDescription("Number of non-null values in the cache.") - public int getSize(); - - /** - * Gets number of keys in the cache, possibly with {@code null} values. - * - * @return Number of keys in the cache. - */ - @IgniteMBeanDescription("Number of keys in the cache (possibly with null values).") - public int getKeySize(); - - /** - * Returns {@code true} if this cache is empty. - * - * @return {@code true} if this cache is empty. - */ - @IgniteMBeanDescription("True if cache is empty.") - public boolean isEmpty(); - - /** - * Gets current size of evict queue used to batch up evictions. - * - * @return Current size of evict queue. - */ - @IgniteMBeanDescription("Current size of evict queue.") - public int getDhtEvictQueueCurrentSize(); - - /** - * Gets transaction per-thread map size. - * - * @return Thread map size. - */ - @IgniteMBeanDescription("Transaction per-thread map size.") - public int getTxThreadMapSize(); - - /** - * Gets transaction per-Xid map size. - * - * @return Transaction per-Xid map size. - */ - @IgniteMBeanDescription("Transaction per-Xid map size.") - public int getTxXidMapSize(); - - /** - * Gets committed transaction queue size. - * - * @return Committed transaction queue size. - */ - @IgniteMBeanDescription("Transaction committed queue size.") - public int getTxCommitQueueSize(); - - /** - * Gets prepared transaction queue size. - * - * @return Prepared transaction queue size. - */ - @IgniteMBeanDescription("Transaction prepared queue size.") - public int getTxPrepareQueueSize(); - - /** - * Gets start version counts map size. - * - * @return Start version counts map size. - */ - @IgniteMBeanDescription("Transaction start version counts map size.") - public int getTxStartVersionCountsSize(); - - /** - * Gets number of cached committed transaction IDs. - * - * @return Number of cached committed transaction IDs. - */ - @IgniteMBeanDescription("Transaction committed ID map size.") - public int getTxCommittedVersionsSize(); - - /** - * Gets number of cached rolled back transaction IDs. - * - * @return Number of cached rolled back transaction IDs. - */ - @IgniteMBeanDescription("Transaction rolled back ID map size.") - public int getTxRolledbackVersionsSize(); - - /** - * Gets transaction DHT per-thread map size. - * - * @return DHT thread map size. - */ - @IgniteMBeanDescription("Transaction DHT per-thread map size.") - public int getTxDhtThreadMapSize(); - - /** - * Gets transaction DHT per-Xid map size. - * - * @return Transaction DHT per-Xid map size. - */ - @IgniteMBeanDescription("Transaction DHT per-Xid map size.") - public int getTxDhtXidMapSize(); - - /** - * Gets committed DHT transaction queue size. - * - * @return Committed DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT committed queue size.") - public int getTxDhtCommitQueueSize(); - - /** - * Gets prepared DHT transaction queue size. - * - * @return Prepared DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT prepared queue size.") - public int getTxDhtPrepareQueueSize(); - - /** - * Gets DHT start version counts map size. - * - * @return DHT start version counts map size. - */ - @IgniteMBeanDescription("Transaction DHT start version counts map size.") - public int getTxDhtStartVersionCountsSize(); - - /** - * Gets number of cached committed DHT transaction IDs. - * - * @return Number of cached committed DHT transaction IDs. - */ - @IgniteMBeanDescription("Transaction DHT committed ID map size.") - public int getTxDhtCommittedVersionsSize(); - - /** - * Gets number of cached rolled back DHT transaction IDs. - * - * @return Number of cached rolled back DHT transaction IDs. - */ - @IgniteMBeanDescription("Transaction DHT rolled back ID map size.") - public int getTxDhtRolledbackVersionsSize(); - - /** - * Returns {@code True} if write-behind is enabled. - * - * @return {@code True} if write-behind is enabled. - */ - @IgniteMBeanDescription("True if write-behind is enabled for this cache.") - public boolean isWriteBehindEnabled(); - - /** - * Gets the maximum size of the write-behind buffer. When the count of unique keys - * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store. - * <p/> - * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However, - * when this value is {@code 0}, the cache critical size is set to - * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE} - * - * @return Buffer size that triggers flush procedure. - */ - @IgniteMBeanDescription("Size of internal buffer that triggers flush procedure.") - public int getWriteBehindFlushSize(); - - /** - * Gets the number of flush threads that will perform store update operations. - * - * @return Count of worker threads. - */ - @IgniteMBeanDescription("Count of flush threads.") - public int getWriteBehindFlushThreadCount(); - - /** - * Gets the cache flush frequency. All pending operations on the underlying store will be performed - * within time interval not less then this value. - * <p/> - * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size. - * - * @return Flush frequency in milliseconds. - */ - @IgniteMBeanDescription("Flush frequency interval in milliseconds.") - public long getWriteBehindFlushFrequency(); - - /** - * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch. - * - * @return Maximum size of batch. - */ - @IgniteMBeanDescription("Maximum size of batch for similar operations.") - public int getWriteBehindStoreBatchSize(); - - /** - * Gets count of write buffer overflow events since initialization. Each overflow event causes - * the ongoing flush operation to be performed synchronously. - * - * @return Count of cache overflow events since start. - */ - @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.") - public int getWriteBehindTotalCriticalOverflowCount(); - - /** - * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes - * the ongoing flush operation to be performed synchronously. - * - * @return Count of cache overflow events since start. - */ - @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.") - public int getWriteBehindCriticalOverflowCount(); - - /** - * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state - * when underlying store failed due some reason and cache has enough space to retain this entry till - * the next try. - * - * @return Count of entries in store-retry state. - */ - @IgniteMBeanDescription("Count of cache cache entries that are currently in retry state.") - public int getWriteBehindErrorRetryCount(); - - /** - * Gets count of entries that were processed by the write-behind store and have not been - * flushed to the underlying store yet. - * - * @return Total count of entries in cache store internal buffer. - */ - @IgniteMBeanDescription("Count of cache entries that are waiting to be flushed.") - public int getWriteBehindBufferSize(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMemoryMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMemoryMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMemoryMode.java deleted file mode 100644 index 031ee0e..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMemoryMode.java +++ /dev/null @@ -1,61 +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.gridgain.grid.cache; - -import org.gridgain.grid.cache.eviction.*; - -/** - * Defines set of memory modes. Memory modes help control whether cache entries are - * stored on heap memory, offheap memory, or in swap space. - */ -public enum GridCacheMemoryMode { - /** - * Entries will be stored on-heap first. The onheap tiered storage works as follows: - * <nl> - * <li>Entries are cached on heap memory first.</li> - * <li> - * If offheap memory is enabled and eviction policy evicts an entry from heap memory, entry will - * be moved to offheap memory. If offheap memory is disabled, then entry is simply discarded. - * </li> - * <li> - * If swap space is enabled and offheap memory fills up, then entry will be evicted into swap space. - * If swap space is disabled, then entry will be discarded. If swap is enabled and offheap memory - * is disabled, then entry will be evicted directly from heap memory into swap. - * </li> - * </nl> - * <p> - * <b>Note</b> that heap memory evictions are handled by configured {@link GridCacheEvictionPolicy} - * implementation. By default, no eviction policy is enabled, so entries never leave heap - * memory space unless explicitly removed. - */ - ONHEAP_TIERED, - - /** - * Works the same as {@link #ONHEAP_TIERED}, except that entries never end up in heap memory and get - * stored in offheap memory right away. Entries get cached in offheap memory first and then - * get evicted to swap, if one is configured. - */ - OFFHEAP_TIERED, - - /** - * Entry keys will be stored on heap memory, and values will be stored in offheap memory. Note - * that in this mode entries can be evicted only to swap. The evictions will happen according - * to configured {@link GridCacheEvictionPolicy}. - */ - OFFHEAP_VALUES, -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java deleted file mode 100644 index c6a5302..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java +++ /dev/null @@ -1,103 +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.gridgain.grid.cache; - -import java.io.*; - -/** - * Cache metrics used to obtain statistics on cache itself. - * Use {@link GridCache#metrics()} to obtain metrics for a cache. - */ -public interface GridCacheMetrics extends Serializable { - /** - * Gets create time of the owning entity (either cache or entry). - * - * @return Create time. - */ - public long createTime(); - - /** - * Gets last write time of the owning entity (either cache or entry). - * - * @return Last write time. - */ - public long writeTime(); - - /** - * Gets last read time of the owning entity (either cache or entry). - * - * @return Last read time. - */ - public long readTime(); - - /** - * Gets last time transaction was committed. - * - * @return Last commit time. - */ - public long commitTime(); - - /** - * Gets last time transaction was rollback. - * - * @return Last rollback time. - */ - public long rollbackTime(); - - /** - * Gets total number of reads of the owning entity (either cache or entry). - * - * @return Total number of reads. - */ - public int reads(); - - /** - * Gets total number of writes of the owning entity (either cache or entry). - * - * @return Total number of writes. - */ - public int writes(); - - /** - * Gets total number of hits for the owning entity (either cache or entry). - * - * @return Number of hits. - */ - public int hits(); - - /** - * Gets total number of misses for the owning entity (either cache or entry). - * - * @return Number of misses. - */ - public int misses(); - - /** - * Gets total number of transaction commits. - * - * @return Number of transaction commits. - */ - public int txCommits(); - - /** - * Gets total number of transaction rollbacks. - * - * @return Number of transaction rollbacks. - */ - public int txRollbacks(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMode.java deleted file mode 100644 index db15d43..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMode.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.gridgain.grid.cache; - -import org.apache.ignite.cache.*; -import org.gridgain.grid.cache.affinity.*; -import org.jetbrains.annotations.*; - -/** - * Enumeration of all supported caching modes. Cache mode is specified in {@link CacheConfiguration} - * and cannot be changed after cache has started. - */ -public enum GridCacheMode { - /** - * Specifies local-only cache behaviour. In this mode caches residing on - * different grid nodes will not know about each other. - * <p> - * Other than distribution, {@code local} caches still have all - * the caching features, such as eviction, expiration, swapping, - * querying, etc... This mode is very useful when caching read-only data - * or data that automatically expires at a certain interval and - * then automatically reloaded from persistence store. - */ - LOCAL, - - /** - * Specifies fully replicated cache behavior. In this mode all the keys are distributed - * to all participating nodes. User still has affinity control - * over subset of nodes for any given key via {@link GridCacheAffinityFunction} - * configuration. - */ - REPLICATED, - - /** - * Specifies partitioned cache behaviour. In this mode the overall - * key set will be divided into partitions and all partitions will be split - * equally between participating nodes. User has affinity - * control over key assignment via {@link GridCacheAffinityFunction} - * configuration. - * <p> - * Note that partitioned cache is always fronted by local - * {@code 'near'} cache which stores most recent data. You - * can configure the size of near cache via {@link CacheConfiguration#getNearEvictionPolicy()} - * configuration property. - */ - PARTITIONED; - - /** Enumerated values. */ - private static final GridCacheMode[] 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 GridCacheMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheName.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheName.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheName.java deleted file mode 100644 index 9044363..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheName.java +++ /dev/null @@ -1,43 +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.gridgain.grid.cache; - -import org.gridgain.grid.cache.affinity.*; - -import java.lang.annotation.*; -import java.util.concurrent.*; - -/** - * Allows to specify cache name from grid computations. It is used to provide cache name - * for affinity routing of grid computations, such as {@link org.apache.ignite.compute.ComputeJob}, {@link Runnable}, - * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be used only in conjunction with - * {@link GridCacheAffinityKeyMapped @GridCacheAffinityKeyMapped} annotation, and should be attached to a method or field - * that provides cache name for the computation. Only one annotation per class - * is allowed. In the absence of this annotation, the default no-name cache - * will be used for providing key-to-node affinity. - * <p> - * Refer to {@link GridCacheAffinityKeyMapped @GridCacheAffinityKeyMapped} documentation for more information - * and examples about this annotation. - * @see GridCacheAffinityKeyMapped - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.METHOD}) -public @interface GridCacheName { - // No-op. -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePartialUpdateException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePartialUpdateException.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePartialUpdateException.java deleted file mode 100644 index f1f2731..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePartialUpdateException.java +++ /dev/null @@ -1,64 +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.gridgain.grid.cache; - -import org.apache.ignite.*; - -import java.util.*; - -/** - * Exception thrown from non-transactional cache in case when update succeeded only partially. - * One can get list of keys for which update failed with method {@link #failedKeys()}. - */ -public class GridCachePartialUpdateException extends IgniteCheckedException { - /** */ - private static final long serialVersionUID = 0L; - - /** Failed keys. */ - private final Collection<Object> failedKeys = new ArrayList<>(); - - /** - * @param msg Error message. - */ - public GridCachePartialUpdateException(String msg) { - super(msg); - } - - /** - * Gets collection of failed keys. - * @return Collection of failed keys. - */ - public <K> Collection<K> failedKeys() { - return (Collection<K>)failedKeys; - } - - /** - * @param failedKeys Failed keys. - * @param err Error. - */ - public void add(Collection<?> failedKeys, Throwable err) { - this.failedKeys.addAll(failedKeys); - - addSuppressed(err); - } - - /** {@inheritDoc} */ - @Override public String getMessage() { - return super.getMessage() + ": " + failedKeys; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePeekMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePeekMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePeekMode.java deleted file mode 100644 index e86ae2e..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePeekMode.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.gridgain.grid.cache; - -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Enumeration of all supported cache peek modes. Peek modes can be passed into various - * {@code 'GridCacheProjection.peek(..)'} and {@code GridCacheEntry.peek(..)} methods, - * such as {@link GridCacheProjection#peek(Object, Collection)}, - * {@link GridCacheEntry#peek()}, and others. - * <p> - * The following modes are supported: - * <ul> - * <li>{@link #TX}</li> - * <li>{@link #GLOBAL}</li> - * <li>{@link #SMART}</li> - * <li>{@link #SWAP}</li> - * <li>{@link #DB}</li> - * </ul> - */ -public enum GridCachePeekMode { - /** Peeks value only from in-transaction memory of an ongoing transaction, if any. */ - TX, - - /** Peeks at cache global (not in-transaction) memory. */ - GLOBAL, - - /** - * In this mode value is peeked from in-transaction memory first using {@link #TX} - * mode and then, if it has not been found there, {@link #GLOBAL} mode is used to - * search in committed cached values. - */ - SMART, - - /** Peeks value only from off-heap or cache swap storage without loading swapped value into cache. */ - SWAP, - - /** Peek value from the underlying persistent storage without loading this value into cache. */ - DB, - - /** - * Peek value from near cache only (don't peek from partitioned cache). - * In case of {@link GridCacheMode#LOCAL} or {@link GridCacheMode#REPLICATED} cache, - * behaves as {@link #GLOBAL} mode. - */ - NEAR_ONLY, - - /** - * Peek value from partitioned cache only (skip near cache). - * In case of {@link GridCacheMode#LOCAL} or {@link GridCacheMode#REPLICATED} cache, - * behaves as {@link #GLOBAL} mode. - */ - PARTITIONED_ONLY; - - /** Enumerated values. */ - private static final GridCachePeekMode[] 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 GridCachePeekMode fromOrdinal(byte ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b1a738d/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePreloadMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePreloadMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePreloadMode.java deleted file mode 100644 index 3c36ff0..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCachePreloadMode.java +++ /dev/null @@ -1,69 +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.gridgain.grid.cache; - -import org.apache.ignite.cache.*; -import org.gridgain.grid.cache.affinity.*; -import org.jetbrains.annotations.*; - -/** - * Cache preload mode. When preloading is enabled (i.e. has value other than {@link #NONE}), distributed caches - * will attempt to preload all necessary values from other grid nodes. This enumeration is used to configure - * preloading via {@link CacheConfiguration#getPreloadMode()} configuration property. If not configured - * explicitly, then {@link CacheConfiguration#DFLT_PRELOAD_MODE} is used. - * <p> - * Replicated caches will try to load the full set of cache entries from other nodes (or as defined by - * pluggable {@link GridCacheAffinityFunction}), while partitioned caches will only load the entries for which - * current node is primary or back up. - * <p> - * Note that preload mode only makes sense for {@link GridCacheMode#REPLICATED} and {@link GridCacheMode#PARTITIONED} - * caches. Caches with {@link GridCacheMode#LOCAL} mode are local by definition and therefore cannot preload - * any values from neighboring nodes. - */ -public enum GridCachePreloadMode { - /** - * Synchronous preload mode. Distributed caches will not start until all necessary data - * is loaded from other available grid nodes. - */ - SYNC, - - /** - * Asynchronous preload mode. Distributed caches will start immediately and will load all necessary - * data from other available grid nodes in the background. - */ - ASYNC, - - /** - * In this mode no preloading will take place which means that caches will be either loaded on - * demand from persistent store whenever data is accessed, or will be populated explicitly. - */ - NONE; - - /** Enumerated values. */ - private static final GridCachePreloadMode[] 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 GridCachePreloadMode fromOrdinal(int ord) { - return ord >= 0 && ord < VALS.length ? VALS[ord] : null; - } -}