# ignite-51
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3b933a49 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3b933a49 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3b933a49 Branch: refs/heads/ignite-422 Commit: 3b933a49ec0af9764e8e39fa1588774064d76a8b Parents: ba579aa Author: sboikov <sboi...@gridgain.com> Authored: Tue Mar 10 17:40:27 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Mar 10 17:40:27 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/cache/IgniteImmutable.java | 17 ++++++++++++++++- .../ignite/configuration/CacheConfiguration.java | 10 ++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b933a49/modules/core/src/main/java/org/apache/ignite/cache/IgniteImmutable.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/IgniteImmutable.java b/modules/core/src/main/java/org/apache/ignite/cache/IgniteImmutable.java index 11eadaa..b6389ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/IgniteImmutable.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/IgniteImmutable.java @@ -17,10 +17,25 @@ package org.apache.ignite.cache; +import org.apache.ignite.configuration.*; + import java.lang.annotation.*; /** - * Annotation for immutable objects. + * If cache configuration flag {@link CacheConfiguration#isCopyOnGet()} is set + * then for each operation implying return value copy of the value stored in cache is created. + * Also if this flag is set copies are created for values passed to {@link CacheInterceptor} and + * to {@link org.apache.ignite.cache.IgniteEntryProcessor}. + * <p> + * Copies are not created for types marked with {@link IgniteImmutable} annotation and for known + * immutable types: + * <ul> + * <li>Boxed primitives ({@link Integer}, {@link Long}, ...)</li> + * <li>{@link String}</li> + * <li>{@link java.util.UUID}</li> + * <li>{@link java.math.BigDecimal}</li> + * <li>{@link org.apache.ignite.lang.IgniteUuid}</li> + * </ul> */ @Documented @Retention(RetentionPolicy.RUNTIME) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b933a49/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 10d22fe..32998f1 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -1600,14 +1600,24 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** + * Gets flag indicating whether copy of of the value stored in cache should be created + * for cache operation implying return value. Also if this flag is set copies are created for values + * passed to {@link CacheInterceptor} and to {@link org.apache.ignite.cache.IgniteEntryProcessor}. + * <p> + * Copies are not created for immutable types, see {@link IgniteImmutable}. + * * @return Copy on get flag. + * @see IgniteImmutable */ public boolean isCopyOnGet() { return cpOnGet; } /** + * Set copy on get flag. + * * @param cpOnGet Copy on get flag. + * @see #isCopyOnGet */ public void setCopyOnGet(boolean cpOnGet) { this.cpOnGet = cpOnGet;