Repository: incubator-ignite Updated Branches: refs/heads/ignite-51 [created] b7ea910fe
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccObsoleteTtlEntryExtras.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccObsoleteTtlEntryExtras.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccObsoleteTtlEntryExtras.java index bc68190..51dd029 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccObsoleteTtlEntryExtras.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccObsoleteTtlEntryExtras.java @@ -25,9 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.*; /** * Extras where MVCC, obsolete version and TTL are set. */ -public class GridCacheMvccObsoleteTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { +public class GridCacheMvccObsoleteTtlEntryExtras extends GridCacheEntryExtrasAdapter { /** MVCC. */ - private GridCacheMvcc<K> mvcc; + private GridCacheMvcc mvcc; /** Obsolete version. */ private GridCacheVersion obsoleteVer; @@ -46,7 +46,7 @@ public class GridCacheMvccObsoleteTtlEntryExtras<K> extends GridCacheEntryExtras * @param ttl TTL. * @param expireTime Expire time. */ - public GridCacheMvccObsoleteTtlEntryExtras(GridCacheMvcc<K> mvcc, GridCacheVersion obsoleteVer, long ttl, + public GridCacheMvccObsoleteTtlEntryExtras(GridCacheMvcc mvcc, GridCacheVersion obsoleteVer, long ttl, long expireTime) { assert mvcc != null; assert obsoleteVer != null; @@ -59,25 +59,25 @@ public class GridCacheMvccObsoleteTtlEntryExtras<K> extends GridCacheEntryExtras } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> attributesData(GridLeanMap<String, Object> attrData) { + @Override public GridCacheEntryExtras attributesData(GridLeanMap<String, Object> attrData) { return attrData != null ? new GridCacheAttributesMvccObsoleteTtlEntryExtras<>(attrData, mvcc, obsoleteVer, ttl, expireTime) : this; } /** {@inheritDoc} */ - @Override public GridCacheMvcc<K> mvcc() { + @Override public GridCacheMvcc mvcc() { return mvcc; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> mvcc(GridCacheMvcc<K> mvcc) { + @Override public GridCacheEntryExtras mvcc(GridCacheMvcc mvcc) { if (mvcc != null) { this.mvcc = mvcc; return this; } else - return new GridCacheObsoleteTtlEntryExtras<>(obsoleteVer, ttl, expireTime); + return new GridCacheObsoleteTtlEntryExtras(obsoleteVer, ttl, expireTime); } /** {@inheritDoc} */ @@ -86,7 +86,7 @@ public class GridCacheMvccObsoleteTtlEntryExtras<K> extends GridCacheEntryExtras } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> obsoleteVersion(GridCacheVersion obsoleteVer) { + @Override public GridCacheEntryExtras obsoleteVersion(GridCacheVersion obsoleteVer) { if (obsoleteVer != null) { this.obsoleteVer = obsoleteVer; @@ -107,7 +107,7 @@ public class GridCacheMvccObsoleteTtlEntryExtras<K> extends GridCacheEntryExtras } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> ttlAndExpireTime(long ttl, long expireTime) { + @Override public GridCacheEntryExtras ttlAndExpireTime(long ttl, long expireTime) { if (ttl != 0) { this.ttl = ttl; this.expireTime = expireTime; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccTtlEntryExtras.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccTtlEntryExtras.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccTtlEntryExtras.java index 47074ae..39568ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccTtlEntryExtras.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheMvccTtlEntryExtras.java @@ -25,9 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.*; /** * Extras where MVCC and TTL are set. */ -public class GridCacheMvccTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { +public class GridCacheMvccTtlEntryExtras extends GridCacheEntryExtrasAdapter { /** MVCC. */ - private GridCacheMvcc<K> mvcc; + private GridCacheMvcc mvcc; /** TTL. */ private long ttl; @@ -42,7 +42,7 @@ public class GridCacheMvccTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter< * @param ttl TTL. * @param expireTime Expire time. */ - public GridCacheMvccTtlEntryExtras(GridCacheMvcc<K> mvcc, long ttl, long expireTime) { + public GridCacheMvccTtlEntryExtras(GridCacheMvcc mvcc, long ttl, long expireTime) { assert mvcc != null; assert ttl != 0; @@ -52,29 +52,29 @@ public class GridCacheMvccTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter< } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> attributesData(GridLeanMap<String, Object> attrData) { - return attrData != null ? new GridCacheAttributesMvccTtlEntryExtras<>(attrData, mvcc, ttl, expireTime) : this; + @Override public GridCacheEntryExtras attributesData(GridLeanMap<String, Object> attrData) { + return attrData != null ? new GridCacheAttributesMvccTtlEntryExtras(attrData, mvcc, ttl, expireTime) : this; } /** {@inheritDoc} */ - @Override public GridCacheMvcc<K> mvcc() { + @Override public GridCacheMvcc mvcc() { return mvcc; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> mvcc(GridCacheMvcc<K> mvcc) { + @Override public GridCacheEntryExtras mvcc(GridCacheMvcc mvcc) { if (mvcc != null) { this.mvcc = mvcc; return this; } else - return new GridCacheTtlEntryExtras<>(ttl, expireTime); + return new GridCacheTtlEntryExtras(ttl, expireTime); } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> obsoleteVersion(GridCacheVersion obsoleteVer) { - return obsoleteVer != null ? new GridCacheMvccObsoleteTtlEntryExtras<>(mvcc, obsoleteVer, ttl, expireTime) : + @Override public GridCacheEntryExtras obsoleteVersion(GridCacheVersion obsoleteVer) { + return obsoleteVer != null ? new GridCacheMvccObsoleteTtlEntryExtras(mvcc, obsoleteVer, ttl, expireTime) : this; } @@ -89,7 +89,7 @@ public class GridCacheMvccTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter< } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> ttlAndExpireTime(long ttl, long expireTime) { + @Override public GridCacheEntryExtras ttlAndExpireTime(long ttl, long expireTime) { if (ttl != 0) { this.ttl = ttl; this.expireTime = expireTime; @@ -97,7 +97,7 @@ public class GridCacheMvccTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter< return this; } else - return new GridCacheMvccEntryExtras<>(mvcc); + return new GridCacheMvccEntryExtras(mvcc); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteEntryExtras.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteEntryExtras.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteEntryExtras.java index 9f8b4ba..003fad5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteEntryExtras.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteEntryExtras.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.*; /** * Extras where obsolete version is set. */ -public class GridCacheObsoleteEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { +public class GridCacheObsoleteEntryExtras extends GridCacheEntryExtrasAdapter { /** Obsolete version. */ private GridCacheVersion obsoleteVer; @@ -41,12 +41,12 @@ public class GridCacheObsoleteEntryExtras<K> extends GridCacheEntryExtrasAdapter } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> attributesData(GridLeanMap<String, Object> attrData) { - return attrData != null ? new GridCacheAttributesObsoleteEntryExtras<K>(attrData, obsoleteVer) : this; + @Override public GridCacheEntryExtras attributesData(GridLeanMap<String, Object> attrData) { + return attrData != null ? new GridCacheAttributesObsoleteEntryExtras(attrData, obsoleteVer) : this; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> mvcc(GridCacheMvcc<K> mvcc) { + @Override public GridCacheEntryExtras mvcc(GridCacheMvcc mvcc) { return mvcc != null ? new GridCacheMvccObsoleteEntryExtras<>(mvcc, obsoleteVer) : this; } @@ -56,7 +56,7 @@ public class GridCacheObsoleteEntryExtras<K> extends GridCacheEntryExtrasAdapter } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> obsoleteVersion(GridCacheVersion obsoleteVer) { + @Override public GridCacheEntryExtras obsoleteVersion(GridCacheVersion obsoleteVer) { if (obsoleteVer != null) { this.obsoleteVer = obsoleteVer; @@ -67,8 +67,8 @@ public class GridCacheObsoleteEntryExtras<K> extends GridCacheEntryExtrasAdapter } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> ttlAndExpireTime(long ttl, long expireTime) { - return ttl != 0 ? new GridCacheObsoleteTtlEntryExtras<K>(obsoleteVer, ttl, expireTime) : this; + @Override public GridCacheEntryExtras ttlAndExpireTime(long ttl, long expireTime) { + return ttl != 0 ? new GridCacheObsoleteTtlEntryExtras(obsoleteVer, ttl, expireTime) : this; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteTtlEntryExtras.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteTtlEntryExtras.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteTtlEntryExtras.java index 13affe6..8442d7c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteTtlEntryExtras.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheObsoleteTtlEntryExtras.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.*; /** * Extras where obsolete version and TTL are set. */ -public class GridCacheObsoleteTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { +public class GridCacheObsoleteTtlEntryExtras extends GridCacheEntryExtrasAdapter { /** Obsolete version. */ private GridCacheVersion obsoleteVer; @@ -52,13 +52,13 @@ public class GridCacheObsoleteTtlEntryExtras<K> extends GridCacheEntryExtrasAdap } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> attributesData(GridLeanMap<String, Object> attrData) { - return attrData != null ? new GridCacheAttributesObsoleteTtlEntryExtras<K>(attrData, obsoleteVer, ttl, + @Override public GridCacheEntryExtras attributesData(GridLeanMap<String, Object> attrData) { + return attrData != null ? new GridCacheAttributesObsoleteTtlEntryExtras(attrData, obsoleteVer, ttl, expireTime) : this; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> mvcc(GridCacheMvcc<K> mvcc) { + @Override public GridCacheEntryExtras mvcc(GridCacheMvcc mvcc) { return mvcc != null ? new GridCacheMvccObsoleteTtlEntryExtras<>(mvcc, obsoleteVer, ttl, expireTime) : this; } @@ -68,7 +68,7 @@ public class GridCacheObsoleteTtlEntryExtras<K> extends GridCacheEntryExtrasAdap } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> obsoleteVersion(GridCacheVersion obsoleteVer) { + @Override public GridCacheEntryExtras obsoleteVersion(GridCacheVersion obsoleteVer) { if (obsoleteVer != null) { this.obsoleteVer = obsoleteVer; @@ -89,7 +89,7 @@ public class GridCacheObsoleteTtlEntryExtras<K> extends GridCacheEntryExtrasAdap } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> ttlAndExpireTime(long ttl, long expireTime) { + @Override public GridCacheEntryExtras ttlAndExpireTime(long ttl, long expireTime) { if (ttl != 0) { this.ttl = ttl; this.expireTime = expireTime; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheTtlEntryExtras.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheTtlEntryExtras.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheTtlEntryExtras.java index 31bf4dc..130186a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheTtlEntryExtras.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/extras/GridCacheTtlEntryExtras.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.*; /** * Extras where TTL and expire time are set. */ -public class GridCacheTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { +public class GridCacheTtlEntryExtras extends GridCacheEntryExtrasAdapter { /** TTL. */ private long ttl; @@ -46,18 +46,18 @@ public class GridCacheTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> attributesData(GridLeanMap<String, Object> attrData) { - return attrData != null ? new GridCacheAttributesTtlEntryExtras<K>(attrData, ttl, expireTime) : this; + @Override public GridCacheEntryExtras attributesData(GridLeanMap<String, Object> attrData) { + return attrData != null ? new GridCacheAttributesTtlEntryExtras(attrData, ttl, expireTime) : this; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> mvcc(GridCacheMvcc<K> mvcc) { + @Override public GridCacheEntryExtras mvcc(GridCacheMvcc mvcc) { return mvcc != null ? new GridCacheMvccTtlEntryExtras<>(mvcc, ttl, expireTime) : this; } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> obsoleteVersion(GridCacheVersion obsoleteVer) { - return obsoleteVer != null ? new GridCacheObsoleteTtlEntryExtras<K>(obsoleteVer, ttl, expireTime) : this; + @Override public GridCacheEntryExtras obsoleteVersion(GridCacheVersion obsoleteVer) { + return obsoleteVer != null ? new GridCacheObsoleteTtlEntryExtras(obsoleteVer, ttl, expireTime) : this; } /** {@inheritDoc} */ @@ -71,7 +71,7 @@ public class GridCacheTtlEntryExtras<K> extends GridCacheEntryExtrasAdapter<K> { } /** {@inheritDoc} */ - @Override public GridCacheEntryExtras<K> ttlAndExpireTime(long ttl, long expireTime) { + @Override public GridCacheEntryExtras ttlAndExpireTime(long ttl, long expireTime) { if (ttl != 0) { this.ttl = ttl; this.expireTime = expireTime; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index 362077f..6081822 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -349,7 +349,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte * @throws IgniteCheckedException Thrown in case of any errors. */ @SuppressWarnings("SimplifiableIfStatement") - public void remove(K key, @Nullable byte[] keyBytes) throws IgniteCheckedException { + public void remove(KeyCacheObject key) throws IgniteCheckedException { assert key != null; if (!cctx.config().isQueryIndexEnabled() && !(key instanceof GridCacheInternal)) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java index eda408c..b04bf63 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java @@ -36,7 +36,7 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy /** * Query request. */ -public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable { +public class GridCacheQueryRequest extends GridCacheMessage implements GridCacheDeployable { /** */ private static final long serialVersionUID = 0L; @@ -235,7 +235,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen /** {@inheritDoc} * @param ctx*/ - @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { + @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (keyValFilter != null) { @@ -277,7 +277,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen } /** {@inheritDoc} */ - @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { + @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); Marshaller mrsh = ctx.marshaller(); @@ -302,7 +302,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen * @param ctx Context. * @throws IgniteCheckedException In case of error. */ - void beforeLocalExecution(GridCacheContext<K, V> ctx) throws IgniteCheckedException { + void beforeLocalExecution(GridCacheContext ctx) throws IgniteCheckedException { Marshaller marsh = ctx.marshaller(); rdc = rdc != null ? marsh.<IgniteReducer<Object, Object>>unmarshal(marsh.marshal(rdc), null) : null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java index a82a0a1..16f3dab 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java @@ -34,7 +34,7 @@ import java.util.*; /** * Query request. */ -public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable { +public class GridCacheQueryResponse extends GridCacheMessage implements GridCacheDeployable { /** */ private static final long serialVersionUID = 0L; @@ -105,7 +105,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme /** {@inheritDoc} * @param ctx*/ - @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException { + @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); if (err != null) @@ -127,7 +127,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme } /** {@inheritDoc} */ - @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException { + @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); if (errBytes != null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java index 0643c0e..ff6f190 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java @@ -122,7 +122,7 @@ public class CacheContinuousQueryManager<K, V> extends GridCacheManagerAdapter<K * @param preload Whether update happened during preloading. * @throws IgniteCheckedException In case of error. */ - public void onEntryUpdated(GridCacheEntryEx<K, V> e, K key, V newVal, GridCacheValueBytes newBytes, + public void onEntryUpdated(GridCacheEntryEx e, K key, V newVal, GridCacheValueBytes newBytes, V oldVal, GridCacheValueBytes oldBytes, boolean preload) throws IgniteCheckedException { assert e != null; assert key != null; @@ -190,7 +190,7 @@ public class CacheContinuousQueryManager<K, V> extends GridCacheManagerAdapter<K * @param oldBytes Old value bytes. * @throws IgniteCheckedException In case of error. */ - public void onEntryExpired(GridCacheEntryEx<K, V> e, K key, V oldVal, GridCacheValueBytes oldBytes) + public void onEntryExpired(GridCacheEntryEx e, K key, V oldVal, GridCacheValueBytes oldBytes) throws IgniteCheckedException { assert e != null; assert key != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java index a06a558..58d79f2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java @@ -35,7 +35,7 @@ import java.util.*; /** * Transaction managed by cache ({@code 'Ex'} stands for external). */ -public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject { +public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject { /** * */ @@ -298,7 +298,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param cacheCtx Cache context. * @param part Invalid partition. */ - public void addInvalidPartition(GridCacheContext<K, V> cacheCtx, int part); + public void addInvalidPartition(GridCacheContext<?, ?> cacheCtx, int part); /** * @return Invalid partitions. @@ -311,7 +311,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param key Key to get version for. * @return Owned version, if any. */ - @Nullable public GridCacheVersion ownedVersion(IgniteTxKey<K> key); + @Nullable public GridCacheVersion ownedVersion(IgniteTxKey key); /** * Gets ID of additional node involved. For example, in DHT case, other node is @@ -355,13 +355,13 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @return {@code True} if lock is owned. * @throws GridCacheEntryRemovedException If entry has been removed. */ - public boolean ownsLock(GridCacheEntryEx<K, V> entry) throws GridCacheEntryRemovedException; + public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException; /** * @param entry Entry to check. * @return {@code True} if lock is owned. */ - public boolean ownsLockUnsafe(GridCacheEntryEx<K, V> entry); + public boolean ownsLockUnsafe(GridCacheEntryEx entry); /** * For Partitioned caches, this flag is {@code false} for remote DHT and remote NEAR @@ -433,42 +433,42 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param key Key to check. * @return {@code True} if key is present. */ - public boolean hasWriteKey(IgniteTxKey<K> key); + public boolean hasWriteKey(IgniteTxKey key); /** * @return Read set. */ - public Set<IgniteTxKey<K>> readSet(); + public Set<IgniteTxKey> readSet(); /** * @return Write set. */ - public Set<IgniteTxKey<K>> writeSet(); + public Set<IgniteTxKey> writeSet(); /** * @return All transaction entries. */ - public Collection<IgniteTxEntry<K, V>> allEntries(); + public Collection<IgniteTxEntry> allEntries(); /** * @return Write entries. */ - public Collection<IgniteTxEntry<K, V>> writeEntries(); + public Collection<IgniteTxEntry> writeEntries(); /** * @return Read entries. */ - public Collection<IgniteTxEntry<K, V>> readEntries(); + public Collection<IgniteTxEntry> readEntries(); /** * @return Transaction write map. */ - public Map<IgniteTxKey<K>, IgniteTxEntry<K, V>> writeMap(); + public Map<IgniteTxKey, IgniteTxEntry> writeMap(); /** * @return Transaction read map. */ - public Map<IgniteTxKey<K>, IgniteTxEntry<K, V>> readMap(); + public Map<IgniteTxKey, IgniteTxEntry> readMap(); /** * Gets a list of entries that needs to be locked on the next step of prepare stage of @@ -476,7 +476,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * * @return List of tx entries for optimistic locking. */ - public Collection<IgniteTxEntry<K, V>> optimisticLockEntries(); + public Collection<IgniteTxEntry> optimisticLockEntries(); /** * Seals transaction for updates. @@ -487,7 +487,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param key Key for the entry. * @return Entry for the key (either from write set or read set). */ - @Nullable public IgniteTxEntry<K, V> entry(IgniteTxKey<K> key); + @Nullable public IgniteTxEntry entry(IgniteTxKey key); /** * @param ctx Cache context. @@ -497,10 +497,10 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @return Current value for the key within transaction. * @throws GridCacheFilterFailedException If filter failed and failFast is {@code true}. */ - @Nullable public GridTuple<V> peek( - GridCacheContext<K, V> ctx, + @Nullable public <K, V> GridTuple<CacheObject> peek( + GridCacheContext<?, ?> ctx, boolean failFast, - K key, + KeyCacheObject key, @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) throws GridCacheFilterFailedException; /** @@ -542,7 +542,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * * @return Future for prepare step. */ - public IgniteInternalFuture<IgniteInternalTx<K, V>> prepareAsync(); + public IgniteInternalFuture<IgniteInternalTx> prepareAsync(); /** * @param endVer End version (a.k.a. <tt>'tnc'</tt> or <tt>'transaction number counter'</tt>) @@ -611,7 +611,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param owner Lock candidate that won ownership of the lock. * @return {@code True} if transaction cared about notification. */ - public boolean onOwnerChanged(GridCacheEntryEx<K, V> entry, GridCacheMvccCandidate<K> owner); + public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner); /** * @return {@code True} if transaction timed out. @@ -654,7 +654,7 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable, GridTimeoutObject * @param key Key to check. * @return {@code True} if key has been removed. */ - public boolean removed(IgniteTxKey<K> key); + public boolean removed(IgniteTxKey key); /** * Gets allowed remaining time for this transaction. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index 93f4cf9..1f977b5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -35,6 +35,7 @@ import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; +import javax.cache.*; import javax.cache.expiry.*; import javax.cache.processor.*; import java.io.*; @@ -53,8 +54,8 @@ import static org.apache.ignite.transactions.TransactionState.*; /** * Managed transaction adapter. */ -public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter - implements IgniteInternalTx<K, V>, Externalizable { +public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter + implements IgniteInternalTx, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -102,7 +103,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** Cache registry. */ @GridToStringExclude - protected GridCacheSharedContext<K, V> cctx; + protected GridCacheSharedContext<?, ?> cctx; /** * End version (a.k.a. <tt>'tnc'</tt> or <tt>'transaction number counter'</tt>) @@ -232,7 +233,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @param grpLockKey Group lock key if this is group-lock transaction. */ protected IgniteTxAdapter( - GridCacheSharedContext<K, V> cctx, + GridCacheSharedContext<?, ?> cctx, GridCacheVersion xidVer, boolean implicit, boolean implicitSingle, @@ -290,7 +291,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @param grpLockKey Group lock key if this is group-lock transaction. */ protected IgniteTxAdapter( - GridCacheSharedContext<K, V> cctx, + GridCacheSharedContext<?, ?> cctx, UUID nodeId, GridCacheVersion xidVer, GridCacheVersion startVer, @@ -361,12 +362,12 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * * @return Flag indicating whether near cache should be updated. */ - protected boolean updateNearCache(GridCacheContext<K, V> cacheCtx, K key, long topVer) { + protected boolean updateNearCache(GridCacheContext<?, ?> cacheCtx, KeyCacheObject key, long topVer) { return false; } /** {@inheritDoc} */ - @Override public Collection<IgniteTxEntry<K, V>> optimisticLockEntries() { + @Override public Collection<IgniteTxEntry> optimisticLockEntries() { if (!groupLock()) return writeEntries(); else { @@ -381,14 +382,14 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter return Collections.emptyList(); } - IgniteTxEntry<K, V> grpLockEntry = groupLockEntry(); + IgniteTxEntry grpLockEntry = groupLockEntry(); assert grpLockEntry != null || (near() && !local()): "Group lock entry was not enlisted into transaction [tx=" + this + ", grpLockKey=" + groupLockKey() + ']'; return grpLockEntry == null ? - Collections.<IgniteTxEntry<K,V>>emptyList() : + Collections.<IgniteTxEntry>emptyList() : Collections.singletonList(grpLockEntry); } } @@ -425,11 +426,11 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * * @return Store manager. */ - protected GridCacheStoreManager<K, V> store() { + protected GridCacheStoreManager<?, ?> store() { if (!activeCacheIds().isEmpty()) { int cacheId = F.first(activeCacheIds()); - GridCacheStoreManager<K, V> store = cctx.cacheContext(cacheId).store(); + GridCacheStoreManager<?, ?> store = cctx.cacheContext(cacheId).store(); return store.configured() ? store : null; } @@ -442,9 +443,9 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter */ @SuppressWarnings({"CatchGenericClass"}) protected void uncommit() { - for (IgniteTxEntry<K, V> e : writeMap().values()) { + for (IgniteTxEntry e : writeMap().values()) { try { - GridCacheEntryEx<K, V> Entry = e.cached(); + GridCacheEntryEx Entry = e.cached(); if (e.op() != NOOP) Entry.invalidate(null, xidVer); @@ -465,8 +466,8 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @return Group lock tx entry. */ @SuppressWarnings("unchecked") - public IgniteTxEntry<K, V> groupLockEntry() { - return ((IgniteTxAdapter)this).entry(groupLockKey()); + public IgniteTxEntry groupLockEntry() { + return this.entry(groupLockKey()); } /** {@inheritDoc} */ @@ -674,7 +675,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } /** {@inheritDoc} */ - @Override public void addInvalidPartition(GridCacheContext<K, V> cacheCtx, int part) { + @Override public void addInvalidPartition(GridCacheContext<?, ?> cacheCtx, int part) { invalidParts.add(part); if (log.isDebugEnabled()) @@ -682,7 +683,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } /** {@inheritDoc} */ - @Override public GridCacheVersion ownedVersion(IgniteTxKey<K> key) { + @Override public GridCacheVersion ownedVersion(IgniteTxKey key) { return null; } @@ -761,10 +762,10 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** {@inheritDoc} */ @SuppressWarnings("SimplifiableIfStatement") - @Override public boolean ownsLock(GridCacheEntryEx<K, V> entry) throws GridCacheEntryRemovedException { - GridCacheContext<K, V> cacheCtx = entry.context(); + @Override public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException { + GridCacheContext<?, ?> cacheCtx = entry.context(); - IgniteTxEntry<K, V> txEntry = entry(entry.txKey()); + IgniteTxEntry txEntry = entry(entry.txKey()); GridCacheVersion explicit = txEntry == null ? null : txEntry.explicitVersion(); @@ -780,10 +781,10 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** {@inheritDoc} */ @SuppressWarnings("SimplifiableIfStatement") - @Override public boolean ownsLockUnsafe(GridCacheEntryEx<K, V> entry) { - GridCacheContext<K, V> cacheCtx = entry.context(); + @Override public boolean ownsLockUnsafe(GridCacheEntryEx entry) { + GridCacheContext cacheCtx = entry.context(); - IgniteTxEntry<K, V> txEntry = entry(entry.txKey()); + IgniteTxEntry txEntry = entry(entry.txKey()); GridCacheVersion explicit = txEntry == null ? null : txEntry.explicitVersion(); @@ -899,7 +900,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @param key Key. * @return {@code True} if key is internal. */ - protected boolean checkInternal(IgniteTxKey<K> key) { + protected boolean checkInternal(IgniteTxKey key) { if (key.key() instanceof GridCacheInternal) { internal = true; @@ -1192,8 +1193,8 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @throws IgniteCheckedException If failed to get previous value for transform. * @throws GridCacheEntryRemovedException If entry was concurrently deleted. */ - protected GridTuple3<GridCacheOperation, V, byte[]> applyTransformClosures( - IgniteTxEntry<K, V> txEntry, + protected GridTuple3<GridCacheOperation, CacheObject, byte[]> applyTransformClosures( + IgniteTxEntry txEntry, boolean metrics) throws GridCacheEntryRemovedException, IgniteCheckedException { GridCacheContext cacheCtx = txEntry.context(); @@ -1203,12 +1204,12 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter return F.t(cacheCtx.writeThrough() ? RELOAD : DELETE, null, null); if (F.isEmpty(txEntry.entryProcessors())) - return F.t(txEntry.op(), txEntry.value(), txEntry.valueBytes()); + return F.t(txEntry.op(), txEntry.value(), null); else { try { boolean recordEvt = cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_READ); - V val = txEntry.hasValue() ? txEntry.value() : + CacheObject cacheVal = txEntry.hasValue() ? txEntry.value() : txEntry.cached().innerGet(this, /*swap*/false, /*read through*/false, @@ -1224,11 +1225,15 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter boolean modified = false; - for (T2<EntryProcessor<K, V, ?>, Object[]> t : txEntry.entryProcessors()) { - CacheInvokeEntry<K, V> invokeEntry = new CacheInvokeEntry<>(txEntry.context(), txEntry.key(), val); + Object key = txEntry.key().value(txEntry.context()); + + Object val = cacheVal != null ? cacheVal.value(txEntry.context()) : null; + + for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) { + CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(txEntry.context(), key, val); try { - EntryProcessor<K, V, ?> processor = t.get1(); + EntryProcessor<Object, Object, Object> processor = t.get1(); processor.process(invokeEntry, t.get2()); @@ -1242,10 +1247,12 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } if (modified) { - val = (V)cacheCtx.<V>unwrapTemporary(val); - - if (cacheCtx.portableEnabled()) - val = (V)cacheCtx.marshalToPortable(val); + cacheVal = cacheCtx.toCacheObject(val); +// TODO IGNITE-51 +// val = (V)cacheCtx.<V>unwrapTemporary(val); +// +// if (cacheCtx.portableEnabled()) +// val = (V)cacheCtx.marshalToPortable(val); } GridCacheOperation op = modified ? (val == null ? DELETE : UPDATE) : NOOP; @@ -1263,7 +1270,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } } - return F.t(op, val, null); + return F.t(op, cacheVal, null); } catch (GridCacheFilterFailedException e) { assert false : "Empty filter failed for innerGet: " + e; @@ -1298,10 +1305,17 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @throws IgniteCheckedException In case of eny exception. * @throws GridCacheEntryRemovedException If entry got removed. */ - protected IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K, V>> conflictResolve( - GridCacheOperation op, K key, V newVal, byte[] newValBytes, long newTtl, long newDrExpireTime, - GridCacheVersion newVer, GridCacheEntryEx<K, V> old) - throws IgniteCheckedException, GridCacheEntryRemovedException { + protected <K, V> IgniteBiTuple<GridCacheOperation, GridCacheVersionConflictContext<K, V>> conflictResolve( + GridCacheOperation op, + K key, + V newVal, + byte[] newValBytes, + long newTtl, + long newDrExpireTime, + GridCacheVersion newVer, + GridCacheEntryEx old) + throws IgniteCheckedException, GridCacheEntryRemovedException + { // Construct old entry info. GridCacheVersionedEntryEx<K, V> oldEntry = old.versionedEntry(); @@ -1314,7 +1328,10 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter GridCacheVersionedEntryEx<K, V> newEntry = new GridCachePlainVersionedEntry<>(key, newVal, newTtl, newExpireTime, newVer); - GridCacheVersionConflictContext<K, V> ctx = old.context().conflictResolve(oldEntry, newEntry, false); + GridCacheVersionConflictContext<K, V> ctx = null; + + // TODO IGNITE-51. + //GridCacheVersionConflictContext<K, V> ctx = old.context().conflictResolve(oldEntry, newEntry, false); if (ctx.isMerge()) { V resVal = ctx.mergeValue(); @@ -1333,8 +1350,8 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @param primaryOnly Flag to include backups into check or not. * @return {@code True} if entry is locally mapped as a primary or back up node. */ - protected boolean isNearLocallyMapped(IgniteTxEntry<K, V> e, boolean primaryOnly) { - GridCacheContext<K, V> cacheCtx = e.context(); + protected boolean isNearLocallyMapped(IgniteTxEntry e, boolean primaryOnly) { + GridCacheContext cacheCtx = e.context(); if (!cacheCtx.isNear()) return false; @@ -1346,7 +1363,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter if (nodeId != null && nodeId.equals(cctx.localNodeId())) return true; - GridCacheEntryEx<K, V> cached = e.cached(); + GridCacheEntryEx cached = e.cached(); int part = cached != null ? cached.partition() : cacheCtx.affinity().partition(e.key()); @@ -1374,11 +1391,11 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter * @return {@code True} if attempt was made to evict the entry. * @throws IgniteCheckedException If failed. */ - protected boolean evictNearEntry(IgniteTxEntry<K, V> e, boolean primaryOnly) throws IgniteCheckedException { + protected boolean evictNearEntry(IgniteTxEntry e, boolean primaryOnly) throws IgniteCheckedException { assert e != null; if (isNearLocallyMapped(e, primaryOnly)) { - GridCacheEntryEx<K, V> cached = e.cached(); + GridCacheEntryEx cached = e.cached(); assert cached instanceof GridNearCacheEntry : "Invalid cache entry: " + e; @@ -1869,9 +1886,11 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter return null; } - @Nullable - @Override - public GridTuple peek(GridCacheContext ctx, boolean failFast, Object key, @Nullable IgnitePredicate[] filter) throws GridCacheFilterFailedException { + /** {@inheritDoc} */ + @Nullable @Override public <K, V> GridTuple<CacheObject> peek(GridCacheContext<?, ?> ctx, + boolean failFast, + KeyCacheObject key, + @Nullable IgnitePredicate<Cache.Entry<K, V>>[] filter) { return null; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java index 1416d8c..9adf979 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java @@ -43,7 +43,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; * {@link #equals(Object)} method, as transaction entries should use referential * equality. */ -public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, OptimizedMarshallable { +public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, OptimizedMarshallable { /** */ private static final long serialVersionUID = 0L; @@ -53,35 +53,32 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** Owning transaction. */ @GridToStringExclude - private IgniteInternalTx<K, V> tx; + private IgniteInternalTx tx; /** Cache key. */ @GridToStringInclude - private K key; - - /** Key bytes. */ - private byte[] keyBytes; + private KeyCacheObject key; /** Cache ID. */ private int cacheId; /** Transient tx key. */ - private IgniteTxKey<K> txKey; + private IgniteTxKey txKey; /** Cache value. */ @GridToStringInclude - private TxEntryValueHolder<K, V> val = new TxEntryValueHolder<>(); + private TxEntryValueHolder val = new TxEntryValueHolder(); /** Visible value for peek. */ @GridToStringInclude - private TxEntryValueHolder<K, V> prevVal = new TxEntryValueHolder<>(); + private TxEntryValueHolder prevVal = new TxEntryValueHolder(); /** Filter bytes. */ private byte[] filterBytes; /** Transform. */ @GridToStringInclude - private Collection<T2<EntryProcessor<K, V, ?>, Object[]>> entryProcessorsCol; + private Collection<T2<EntryProcessor<Object, Object, Object>, Object[]>> entryProcessorsCol; /** Transform closure bytes. */ @GridToStringExclude @@ -105,7 +102,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** Put filters. */ @GridToStringInclude - private IgnitePredicate<Cache.Entry<K, V>>[] filters; + private IgnitePredicate<Cache.Entry<Object, Object>>[] filters; /** Flag indicating whether filters passed. Used for fast-commit transactions. */ private boolean filtersPassed; @@ -114,10 +111,10 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, private transient boolean filtersSet; /** Underlying cache entry. */ - private transient volatile GridCacheEntryEx<K, V> entry; + private transient volatile GridCacheEntryEx entry; /** Cache registry. */ - private transient GridCacheContext<K, V> ctx; + private transient GridCacheContext<?, ?> ctx; /** Prepared flag to prevent multiple candidate add. */ @SuppressWarnings({"TransientFieldNotInitialized"}) @@ -163,13 +160,13 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param entry Cache entry. * @param conflictVer Data center replication version. */ - public IgniteTxEntry(GridCacheContext<K, V> ctx, - IgniteInternalTx<K, V> tx, + public IgniteTxEntry(GridCacheContext<?, ?> ctx, + IgniteInternalTx tx, GridCacheOperation op, - V val, + CacheObject val, long ttl, long conflictExpireTime, - GridCacheEntryEx<K, V> entry, + GridCacheEntryEx entry, @Nullable GridCacheVersion conflictVer) { assert ctx != null; assert tx != null; @@ -185,7 +182,6 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, this.conflictVer = conflictVer; key = entry.key(); - keyBytes = entry.keyBytes(); cacheId = entry.context().cacheId(); @@ -206,15 +202,15 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param filters Put filters. * @param conflictVer Data center replication version. */ - public IgniteTxEntry(GridCacheContext<K, V> ctx, - IgniteInternalTx<K, V> tx, + public IgniteTxEntry(GridCacheContext<?, ?> ctx, + IgniteInternalTx tx, GridCacheOperation op, - V val, - EntryProcessor<K, V, ?> entryProcessor, + CacheObject val, + EntryProcessor<Object, Object, Object> entryProcessor, Object[] invokeArgs, long ttl, - GridCacheEntryEx<K, V> entry, - IgnitePredicate<Cache.Entry<K, V>>[] filters, + GridCacheEntryEx entry, + IgnitePredicate<Cache.Entry<Object, Object>>[] filters, GridCacheVersion conflictVer) { assert ctx != null; assert tx != null; @@ -233,7 +229,6 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, addEntryProcessor(entryProcessor, invokeArgs); key = entry.key(); - keyBytes = entry.keyBytes(); cacheId = entry.context().cacheId(); @@ -243,7 +238,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Cache context for this tx entry. */ - public GridCacheContext<K, V> context() { + public GridCacheContext<?, ?> context() { return ctx; } @@ -281,19 +276,17 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param ctx Context. * @return Clean copy of this entry. */ - public IgniteTxEntry<K, V> cleanCopy(GridCacheContext<K, V> ctx) { - IgniteTxEntry<K, V> cp = new IgniteTxEntry<>(); + public IgniteTxEntry cleanCopy(GridCacheContext<?, ?> ctx) { + IgniteTxEntry cp = new IgniteTxEntry(); cp.key = key; cp.cacheId = cacheId; cp.ctx = ctx; - cp.val = new TxEntryValueHolder<>(); + cp.val = new TxEntryValueHolder(); - cp.keyBytes = keyBytes; cp.filters = filters; cp.val.value(val.op(), val.value(), val.hasWriteValue(), val.hasReadValue()); - cp.val.valueBytes(val.valueBytes()); cp.entryProcessorsCol = entryProcessorsCol; cp.ttl = ttl; cp.conflictExpireTime = conflictExpireTime; @@ -351,7 +344,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @param val Value to set. */ - void setAndMarkValid(V val) { + void setAndMarkValid(CacheObject val) { setAndMarkValid(op(), val, this.val.hasWriteValue(), this.val.hasReadValue()); } @@ -359,7 +352,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param op Operation. * @param val Value to set. */ - void setAndMarkValid(GridCacheOperation op, V val) { + void setAndMarkValid(GridCacheOperation op, CacheObject val) { setAndMarkValid(op, val, this.val.hasWriteValue(), this.val.hasReadValue()); } @@ -369,7 +362,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param hasReadVal Has read value flag. * @param hasWriteVal Has write value flag. */ - void setAndMarkValid(GridCacheOperation op, V val, boolean hasWriteVal, boolean hasReadVal) { + void setAndMarkValid(GridCacheOperation op, CacheObject val, boolean hasWriteVal, boolean hasReadVal) { this.val.value(op, val, hasWriteVal, hasReadVal); markValid(); @@ -395,7 +388,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Entry key. */ - public K key() { + public KeyCacheObject key() { return key; } @@ -409,40 +402,17 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Tx key. */ - public IgniteTxKey<K> txKey() { + public IgniteTxKey txKey() { if (txKey == null) - txKey = new IgniteTxKey<>(key, cacheId); + txKey = new IgniteTxKey(key, cacheId); return txKey; } /** - * - * @return Key bytes. - */ - @Nullable public byte[] keyBytes() { - byte[] bytes = keyBytes; - - if (bytes == null && entry != null) { - bytes = entry.keyBytes(); - - keyBytes = bytes; - } - - return bytes; - } - - /** - * @param keyBytes Key bytes. - */ - public void keyBytes(byte[] keyBytes) { - initKeyBytes(keyBytes); - } - - /** * @return Underlying cache entry. */ - public GridCacheEntryEx<K, V> cached() { + public GridCacheEntryEx cached() { return entry; } @@ -450,50 +420,19 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param entry Cache entry. * @param keyBytes Key bytes, possibly {@code null}. */ - public void cached(GridCacheEntryEx<K,V> entry, @Nullable byte[] keyBytes) { + public void cached(GridCacheEntryEx entry, @Nullable byte[] keyBytes) { assert entry != null; assert entry.context() == ctx : "Invalid entry assigned to tx entry [txEntry=" + this + ", entry=" + entry + ", ctxNear=" + ctx.isNear() + ", ctxDht=" + ctx.isDht() + ']'; this.entry = entry; - - initKeyBytes(keyBytes); - } - - /** - * Initialized key bytes locally and on the underlying entry. - * - * @param bytes Key bytes to initialize. - */ - private void initKeyBytes(@Nullable byte[] bytes) { - if (bytes != null) { - keyBytes = bytes; - - while (true) { - try { - if (entry != null) - entry.keyBytes(bytes); - - break; - } - catch (GridCacheEntryRemovedException ignore) { - entry = ctx.cache().entryEx(key); - } - } - } - else if (entry != null) { - bytes = entry.keyBytes(); - - if (bytes != null) - keyBytes = bytes; - } } /** * @return Entry value. */ - @Nullable public V value() { + @Nullable public CacheObject value() { return val.value(); } @@ -521,7 +460,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Value visible for peek. */ - @Nullable public V previousValue() { + @Nullable public CacheObject previousValue() { return prevVal.value(); } @@ -540,20 +479,6 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, } /** - * @return Value bytes. - */ - @Nullable public byte[] valueBytes() { - return val.valueBytes(); - } - - /** - * @param valBytes Value bytes. - */ - public void valueBytes(@Nullable byte[] valBytes) { - val.valueBytes(valBytes); - } - - /** * @return Time to live. */ public long ttl() { @@ -586,7 +511,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param writeVal Write value flag. * @param readVal Read value flag. */ - public void value(@Nullable V val, boolean writeVal, boolean readVal) { + public void value(@Nullable CacheObject val, boolean writeVal, boolean readVal) { this.val.value(this.val.op(), val, writeVal, readVal); } @@ -595,7 +520,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * * @param val Read value to set. */ - public void readValue(@Nullable V val) { + public void readValue(@Nullable CacheObject val) { this.val.value(this.val.op(), val, false, true); } @@ -603,11 +528,11 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param entryProcessor Entry processor. * @param invokeArgs Optional arguments for EntryProcessor. */ - public void addEntryProcessor(EntryProcessor<K, V, ?> entryProcessor, Object[] invokeArgs) { + public void addEntryProcessor(EntryProcessor<Object, Object, Object> entryProcessor, Object[] invokeArgs) { if (entryProcessorsCol == null) entryProcessorsCol = new LinkedList<>(); - entryProcessorsCol.add(new T2<EntryProcessor<K, V, ?>, Object[]>(entryProcessor, invokeArgs)); + entryProcessorsCol.add(new T2<>(entryProcessor, invokeArgs)); // Must clear transform closure bytes since collection has changed. transformClosBytes = null; @@ -618,7 +543,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Collection of entry processors. */ - public Collection<T2<EntryProcessor<K, V, ?>, Object[]>> entryProcessors() { + public Collection<T2<EntryProcessor<Object, Object, Object>, Object[]>> entryProcessors() { return entryProcessorsCol; } @@ -627,10 +552,10 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @return New value. */ @SuppressWarnings("unchecked") - public V applyEntryProcessors(V val) { - for (T2<EntryProcessor<K, V, ?>, Object[]> t : entryProcessors()) { + public CacheObject applyEntryProcessors(Object val) { + for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : entryProcessors()) { try { - CacheInvokeEntry<K, V> invokeEntry = new CacheInvokeEntry<>(ctx, key, val); + CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(ctx, key.value(ctx), val); EntryProcessor processor = t.get1(); @@ -643,16 +568,19 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, } } - if (ctx.portableEnabled()) - val = (V)ctx.marshalToPortable(val); - - return val; + return ctx.toCacheObject(val); +// TODO IGNITE-51 +// if (ctx.portableEnabled()) +// val = (V)ctx.marshalToPortable(val); +// +// return val; } /** * @param entryProcessorsCol Collection of entry processors. */ - public void entryProcessors(@Nullable Collection<T2<EntryProcessor<K, V, ?>, Object[]>> entryProcessorsCol) { + public void entryProcessors( + @Nullable Collection<T2<EntryProcessor<Object, Object, Object>, Object[]>> entryProcessorsCol) { this.entryProcessorsCol = entryProcessorsCol; // Must clear transform closure bytes since collection has changed. @@ -711,14 +639,14 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** * @return Put filters. */ - public IgnitePredicate<Cache.Entry<K, V>>[] filters() { + public IgnitePredicate<Cache.Entry<Object, Object>>[] filters() { return filters; } /** * @param filters Put filters. */ - public void filters(IgnitePredicate<Cache.Entry<K, V>>[] filters) { + public void filters(IgnitePredicate<Cache.Entry<Object, Object>>[] filters) { filterBytes = null; this.filters = filters; @@ -757,12 +685,9 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param transferExpiry {@code True} if expire policy should be marshalled. * @throws IgniteCheckedException If failed. */ - public void marshal(GridCacheSharedContext<K, V> ctx, boolean transferExpiry) throws IgniteCheckedException { + public void marshal(GridCacheSharedContext<?, ?> ctx, boolean transferExpiry) throws IgniteCheckedException { // Do not serialize filters if they are null. if (depEnabled) { - if (keyBytes == null) - keyBytes = entry.getOrMarshalKeyBytes(); - if (transformClosBytes == null && entryProcessorsCol != null) transformClosBytes = CU.marshal(ctx, entryProcessorsCol); @@ -786,36 +711,37 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param clsLdr Class loader. * @throws IgniteCheckedException If un-marshalling failed. */ - public void unmarshal(GridCacheSharedContext<K, V> ctx, boolean near, ClassLoader clsLdr) throws IgniteCheckedException { - if (this.ctx == null) { - GridCacheContext<K, V> cacheCtx = ctx.cacheContext(cacheId); - - if (cacheCtx.isNear() && !near) - cacheCtx = cacheCtx.near().dht().context(); - else if (!cacheCtx.isNear() && near) - cacheCtx = cacheCtx.dht().near().context(); - - this.ctx = cacheCtx; - } - - if (depEnabled) { - // Don't unmarshal more than once by checking key for null. - if (key == null) - key = ctx.marshaller().unmarshal(keyBytes, clsLdr); - - // Unmarshal transform closure anyway if it exists. - if (transformClosBytes != null && entryProcessorsCol == null) - entryProcessorsCol = ctx.marshaller().unmarshal(transformClosBytes, clsLdr); - - if (filters == null && filterBytes != null) { - filters = ctx.marshaller().unmarshal(filterBytes, clsLdr); - - if (filters == null) - filters = CU.empty(); - } - } - - val.unmarshal(this.ctx, clsLdr, depEnabled); + public void unmarshal(GridCacheSharedContext<?, ?> ctx, boolean near, ClassLoader clsLdr) throws IgniteCheckedException { +// TODO IGNITE-51. +// if (this.ctx == null) { +// GridCacheContext<?, ?> cacheCtx = ctx.cacheContext(cacheId); +// +// if (cacheCtx.isNear() && !near) +// cacheCtx = cacheCtx.near().dht().context(); +// else if (!cacheCtx.isNear() && near) +// cacheCtx = cacheCtx.dht().near().context(); +// +// this.ctx = cacheCtx; +// } +// +// if (depEnabled) { +// // Don't unmarshal more than once by checking key for null. +// if (key == null) +// key = ctx.marshaller().unmarshal(keyBytes, clsLdr); +// +// // Unmarshal transform closure anyway if it exists. +// if (transformClosBytes != null && entryProcessorsCol == null) +// entryProcessorsCol = ctx.marshaller().unmarshal(transformClosBytes, clsLdr); +// +// if (filters == null && filterBytes != null) { +// filters = ctx.marshaller().unmarshal(filterBytes, clsLdr); +// +// if (filters == null) +// filters = CU.empty(); +// } +// } +// +// val.unmarshal(this.ctx, clsLdr, depEnabled); } /** @@ -834,61 +760,63 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeBoolean(depEnabled); - - if (depEnabled) { - U.writeByteArray(out, keyBytes); - U.writeByteArray(out, transformClosBytes); - U.writeByteArray(out, filterBytes); - } - else { - out.writeObject(key); - U.writeCollection(out, entryProcessorsCol); - U.writeArray(out, filters); - } - - out.writeInt(cacheId); - - val.writeTo(out); - - out.writeLong(ttl); - out.writeLong(conflictExpireTime); - - CU.writeVersion(out, explicitVer); - out.writeBoolean(grpLock); - CU.writeVersion(out, conflictVer); - - out.writeObject(transferExpiryPlc ? new IgniteExternalizableExpiryPolicy(expiryPlc) : null); +// TODO IGNITE-51. +// out.writeBoolean(depEnabled); +// +// if (depEnabled) { +// U.writeByteArray(out, keyBytes); +// U.writeByteArray(out, transformClosBytes); +// U.writeByteArray(out, filterBytes); +// } +// else { +// out.writeObject(key); +// U.writeCollection(out, entryProcessorsCol); +// U.writeArray(out, filters); +// } +// +// out.writeInt(cacheId); +// +// val.writeTo(out); +// +// out.writeLong(ttl); +// out.writeLong(conflictExpireTime); +// +// CU.writeVersion(out, explicitVer); +// out.writeBoolean(grpLock); +// CU.writeVersion(out, conflictVer); +// +// out.writeObject(transferExpiryPlc ? new IgniteExternalizableExpiryPolicy(expiryPlc) : null); } /** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - depEnabled = in.readBoolean(); - - if (depEnabled) { - keyBytes = U.readByteArray(in); - transformClosBytes = U.readByteArray(in); - filterBytes = U.readByteArray(in); - } - else { - key = (K)in.readObject(); - entryProcessorsCol = U.readCollection(in); - filters = GridCacheUtils.readEntryFilterArray(in); - } - - cacheId = in.readInt(); - - val.readFrom(in); - - ttl = in.readLong(); - conflictExpireTime = in.readLong(); - - explicitVer = CU.readVersion(in); - grpLock = in.readBoolean(); - conflictVer = CU.readVersion(in); - - expiryPlc = (ExpiryPolicy)in.readObject(); +// TODO IGNITE-51. +// depEnabled = in.readBoolean(); +// +// if (depEnabled) { +// keyBytes = U.readByteArray(in); +// transformClosBytes = U.readByteArray(in); +// filterBytes = U.readByteArray(in); +// } +// else { +// key = (K)in.readObject(); +// entryProcessorsCol = U.readCollection(in); +// filters = GridCacheUtils.readEntryFilterArray(in); +// } +// +// cacheId = in.readInt(); +// +// val.readFrom(in); +// +// ttl = in.readLong(); +// conflictExpireTime = in.readLong(); +// +// explicitVer = CU.readVersion(in); +// grpLock = in.readBoolean(); +// conflictVer = CU.readVersion(in); +// +// expiryPlc = (ExpiryPolicy)in.readObject(); } /** {@inheritDoc} */ @@ -900,7 +828,7 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, @Override public Class<?> deployClass() { ClassLoader clsLdr = getClass().getClassLoader(); - V val = value(); + CacheObject val = value(); // First of all check classes that may be loaded by class loader other than application one. return key != null && !clsLdr.equals(key.getClass().getClassLoader()) ? @@ -914,22 +842,16 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, /** {@inheritDoc} */ @Override public String toString() { - return GridToStringBuilder.toString(IgniteTxEntry.class, this, - "keyBytesSize", keyBytes == null ? "null" : Integer.toString(keyBytes.length), - "xidVer", tx == null ? "null" : tx.xidVersion()); + return GridToStringBuilder.toString(IgniteTxEntry.class, this, "xidVer", tx == null ? "null" : tx.xidVersion()); } /** * Auxiliary class to hold value, value-has-been-set flag, value update operation, value bytes. */ - private static class TxEntryValueHolder<K, V> { + private static class TxEntryValueHolder { /** */ @GridToStringInclude - private V val; - - /** */ - @GridToStringExclude - private byte[] valBytes; + private CacheObject val; /** */ @GridToStringInclude @@ -950,18 +872,13 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param hasWriteVal Write value presence flag. * @param hasReadVal Read value presence flag. */ - public void value(GridCacheOperation op, V val, boolean hasWriteVal, boolean hasReadVal) { + public void value(GridCacheOperation op, CacheObject val, boolean hasWriteVal, boolean hasReadVal) { if (hasReadVal && this.hasWriteVal) return; - boolean clean = this.val != null; - this.op = op; this.val = val; - if (clean) - valBytes = null; - this.hasWriteVal = hasWriteVal || op == CREATE || op == UPDATE || op == DELETE; this.hasReadVal = hasReadVal || op == READ; } @@ -978,20 +895,15 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * * @return Value. */ - public V value() { + public CacheObject value() { return val; } /** * @param val Stored value. */ - public void value(@Nullable V val) { - boolean clean = this.val != null; - + public void value(@Nullable CacheObject val) { this.val = val; - - if (clean) - valBytes = null; } /** @@ -1027,39 +939,22 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, } /** - * Sets value bytes. - * - * @param valBytes Value bytes to set. - */ - public void valueBytes(@Nullable byte[] valBytes) { - this.valBytes = valBytes; - } - - /** - * Gets value bytes. - * - * @return Value bytes. - */ - public byte[] valueBytes() { - return valBytes; - } - - /** * @param sharedCtx Shared cache context. * @param ctx Cache context. * @param depEnabled Deployment enabled flag. * @throws IgniteCheckedException If marshaling failed. */ - public void marshal(GridCacheSharedContext<K, V> sharedCtx, GridCacheContext<K, V> ctx, boolean depEnabled) + public void marshal(GridCacheSharedContext<?, ?> sharedCtx, GridCacheContext<?, ?> ctx, boolean depEnabled) throws IgniteCheckedException { - boolean valIsByteArr = val != null && val instanceof byte[]; - - // Do not send write values to remote nodes. - if (hasWriteVal && val != null && !valIsByteArr && valBytes == null && - (depEnabled || !ctx.isUnmarshalValues())) - valBytes = CU.marshal(sharedCtx, val); - - valBytesSent = hasWriteVal && !valIsByteArr && valBytes != null && (depEnabled || !ctx.isUnmarshalValues()); +// TODO IGNITE-51. +// boolean valIsByteArr = val != null && val instanceof byte[]; +// +// // Do not send write values to remote nodes. +// if (hasWriteVal && val != null && !valIsByteArr && valBytes == null && +// (depEnabled || !ctx.isUnmarshalValues())) +// valBytes = CU.marshal(sharedCtx, val); +// +// valBytesSent = hasWriteVal && !valIsByteArr && valBytes != null && (depEnabled || !ctx.isUnmarshalValues()); } /** @@ -1068,9 +963,10 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @param depEnabled Deployment enabled flag. * @throws IgniteCheckedException If unmarshalling failed. */ - public void unmarshal(GridCacheContext<K, V> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException { - if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled)) - val = ctx.marshaller().unmarshal(valBytes, ldr); + public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException { +// TODO IGNITE-51. +// if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled)) +// val = ctx.marshaller().unmarshal(valBytes, ldr); } /** @@ -1078,27 +974,28 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, * @throws IOException If failed. */ public void writeTo(ObjectOutput out) throws IOException { - out.writeBoolean(hasWriteVal); - out.writeBoolean(valBytesSent); - - if (hasWriteVal) { - if (valBytesSent) - U.writeByteArray(out, valBytes); - else { - if (val != null && val instanceof byte[]) { - out.writeBoolean(true); - - U.writeByteArray(out, (byte[])val); - } - else { - out.writeBoolean(false); - - out.writeObject(val); - } - } - } - - out.writeInt(op.ordinal()); +// TODO IGNITE-51. +// out.writeBoolean(hasWriteVal); +// out.writeBoolean(valBytesSent); +// +// if (hasWriteVal) { +// if (valBytesSent) +// U.writeByteArray(out, valBytes); +// else { +// if (val != null && val instanceof byte[]) { +// out.writeBoolean(true); +// +// U.writeByteArray(out, (byte[])val); +// } +// else { +// out.writeBoolean(false); +// +// out.writeObject(val); +// } +// } +// } +// +// out.writeInt(op.ordinal()); } /** @@ -1108,22 +1005,23 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, */ @SuppressWarnings("unchecked") public void readFrom(ObjectInput in) throws IOException, ClassNotFoundException { - hasWriteVal = in.readBoolean(); - valBytesSent = in.readBoolean(); - - if (hasWriteVal) { - if (valBytesSent) - valBytes = U.readByteArray(in); - else - val = in.readBoolean() ? (V)U.readByteArray(in) : (V)in.readObject(); - } - - op = fromOrdinal(in.readInt()); +// TODO IGNITE-51. +// hasWriteVal = in.readBoolean(); +// valBytesSent = in.readBoolean(); +// +// if (hasWriteVal) { +// if (valBytesSent) +// valBytes = U.readByteArray(in); +// else +// val = in.readBoolean() ? (V)U.readByteArray(in) : (V)in.readObject(); +// } +// +// op = fromOrdinal(in.readInt()); } /** {@inheritDoc} */ @Override public String toString() { - return "[op=" + op +", val=" + val + ", valBytesLen=" + (valBytes == null ? 0 : valBytes.length) + ']'; + return "[op=" + op +", val=" + val + ']'; } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java index b29f721..5e13aa0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java @@ -46,14 +46,14 @@ import static org.apache.ignite.transactions.TransactionState.*; /** * Isolated logic to process cache messages. */ -public class IgniteTxHandler<K, V> { +public class IgniteTxHandler { /** Logger. */ private IgniteLogger log; /** Shared cache context. */ - private GridCacheSharedContext<K, V> ctx; + private GridCacheSharedContext<?, ?> ctx; - public IgniteInternalFuture<IgniteInternalTx<K, V>> processNearTxPrepareRequest(final UUID nearNodeId, + public IgniteInternalFuture<IgniteInternalTx> processNearTxPrepareRequest(final UUID nearNodeId, final GridNearTxPrepareRequest<K, V> req) { return prepareTx(nearNodeId, null, req, null); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java index 43130c7..4540ee9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxKey.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.transactions; +import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -26,13 +27,13 @@ import java.io.*; * Cache transaction key. This wrapper is needed because same keys may be enlisted in the same transaction * for multiple caches. */ -public class IgniteTxKey<K> implements Externalizable { +public class IgniteTxKey implements Externalizable { /** */ private static final long serialVersionUID = 0L; /** Key. */ @GridToStringInclude - private K key; + private KeyCacheObject key; /** Cache ID. */ private int cacheId; @@ -48,7 +49,7 @@ public class IgniteTxKey<K> implements Externalizable { * @param key User key. * @param cacheId Cache ID. */ - public IgniteTxKey(K key, int cacheId) { + public IgniteTxKey(KeyCacheObject key, int cacheId) { this.key = key; this.cacheId = cacheId; } @@ -56,7 +57,7 @@ public class IgniteTxKey<K> implements Externalizable { /** * @return User key. */ - public K key() { + public KeyCacheObject key() { return key; } @@ -98,7 +99,7 @@ public class IgniteTxKey<K> implements Externalizable { /** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { cacheId = in.readInt(); - key = (K)in.readObject(); + key = (KeyCacheObject)in.readObject(); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b7ea910f/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java index 251f133..a460d4d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.client.marshaller.*; import org.apache.ignite.internal.processors.*; +import org.apache.ignite.internal.processors.cache.*; import org.jetbrains.annotations.*; import java.nio.*; @@ -139,4 +140,16 @@ public interface GridPortableProcessor extends GridProcessor { * @return {@code true} if field is set. */ public boolean hasField(Object obj, String fieldName); + + /** + * @param obj Object. + * @return Cache object. + */ + @Nullable public CacheObject toCacheObject(@Nullable Object obj); + + /** + * @param obj Object. + * @return Cache object. + */ + @Nullable public KeyCacheObject toCacheKeyObject(@Nullable Object obj); }