public interface GridCacheCloner
GridCacheFlag.CLONE flag is set
on projection which the user is working with (this flag is disabled
by default).
This behaviour is useful, as a an example, when we need to get some object from cache, change some of its properties and put it back into cache. In such a scenario it would be wrong to change properties of cached value itself without creating a copy first, since it would break cache integrity, and will affect the cached values returned to other threads even before the transaction commits.
Cache cloner can be set in cache configuration via GridCacheConfiguration.getCloner()
method. By default, cache uses GridCacheBasicCloner implementation
which will clone only objects implementing Cloneable interface. You
can also configure cache to use GridCacheDeepCloner which will perform
deep-cloning of all objects returned from cache, regardless of the
Cloneable interface. If none of the above cloners fit your logic, you
can also provide your own implementation of this interface.
| Modifier and Type | Method and Description |
|---|---|
<T> T |
cloneValue(T val) |
@Nullable <T> T cloneValue(T val) throws GridException
val - Object to make a clone for.GridException - If failed to clone given object.Copyright © 2014. All rights reserved.