You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/02/02 04:28:33 UTC
[41/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index 0000000,451b221..84d7eff
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@@ -1,0 -1,454 +1,452 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT cache lock response.
+ */
+ public class GridDhtLockResponse<K, V> extends GridDistributedLockResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Evicted readers. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxKey<K>> nearEvicted;
+
+ /** Evicted reader key bytes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearEvictedBytes;
+
+ /** Mini ID. */
+ private IgniteUuid miniId;
+
+ /** Invalid partitions. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Set<Integer> invalidParts = new GridLeanSet<>();
+
+ @GridDirectTransient
+ /** Preload entries. */
+ private List<GridCacheEntryInfo<K, V>> preloadEntries;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private List<byte[]> preloadEntriesBytes;
+
+ /**
+ * Empty constructor (required by {@link Externalizable}).
+ */
+ public GridDhtLockResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param lockVer Lock version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param cnt Key count.
+ */
+ public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, IgniteUuid miniId, int cnt) {
+ super(cacheId, lockVer, futId, cnt);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @param lockVer Lock ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param err Error.
+ */
+ public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, IgniteUuid miniId, Throwable err) {
+ super(cacheId, lockVer, futId, err);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Evicted readers.
+ */
+ public Collection<IgniteTxKey<K>> nearEvicted() {
+ return nearEvicted;
+ }
+
+ /**
+ * @param nearEvicted Evicted readers.
+ */
+ public void nearEvicted(Collection<IgniteTxKey<K>> nearEvicted) {
+ this.nearEvicted = nearEvicted;
+ }
+
+ /**
+ * @param nearEvictedBytes Key bytes.
+ */
+ public void nearEvictedBytes(Collection<byte[]> nearEvictedBytes) {
+ this.nearEvictedBytes = nearEvictedBytes;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param part Invalid partition.
+ */
+ public void addInvalidPartition(int part) {
+ invalidParts.add(part);
+ }
+
+ /**
+ * @return Invalid partitions.
+ */
+ public Set<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /**
+ * Adds preload entry to lock response.
+ *
+ * @param info Info to add.
+ */
+ public void addPreloadEntry(GridCacheEntryInfo<K, V> info) {
+ if (preloadEntries == null)
+ preloadEntries = new ArrayList<>();
+
+ preloadEntries.add(info);
+ }
+
+ /**
+ * Gets preload entries returned from backup.
+ *
+ * @return Collection of preload entries.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> preloadEntries() {
+ return preloadEntries == null ? Collections.<GridCacheEntryInfo<K, V>>emptyList() : preloadEntries;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearEvictedBytes == null && nearEvicted != null)
+ nearEvictedBytes = marshalCollection(nearEvicted, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null)
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null) {
+ marshalInfos(preloadEntries, ctx);
+
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearEvicted == null && nearEvictedBytes != null)
+ nearEvicted = unmarshalCollection(nearEvictedBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null)
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null) {
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+
+ unmarshalInfos(preloadEntries, ctx.cacheContext(cacheId), ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtLockResponse _clone = new GridDhtLockResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtLockResponse _clone = (GridDhtLockResponse)_msg;
+
+ _clone.nearEvicted = nearEvicted;
+ _clone.nearEvictedBytes = nearEvictedBytes;
+ _clone.miniId = miniId;
+ _clone.invalidParts = invalidParts;
+ _clone.preloadEntries = preloadEntries;
+ _clone.preloadEntriesBytes = preloadEntriesBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 11:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (nearEvictedBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEvictedBytes.size()))
++ if (!commState.putInt(null, nearEvictedBytes.size()))
+ return false;
+
+ commState.it = nearEvictedBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 14:
+ if (preloadEntriesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(preloadEntriesBytes.size()))
++ if (!commState.putInt(null, preloadEntriesBytes.size()))
+ return false;
+
+ commState.it = preloadEntriesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new HashSet<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 13:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEvictedBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (preloadEntriesBytes == null)
+ preloadEntriesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ preloadEntriesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 30;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtLockResponse.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index 0000000,dd71384..30987df
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@@ -1,0 -1,703 +1,695 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near transaction finish request.
+ */
+ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Near node ID. */
+ private UUID nearNodeId;
+
+ /** Transaction isolation. */
+ private IgniteTxIsolation isolation;
+
+ /** Near writes. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> nearWrites;
+
+ /** Serialized near writes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearWritesBytes;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** System invalidation flag. */
+ private boolean sysInvalidate;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Pending versions with order less than one for this message (needed for commit ordering). */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> pendingVers;
+
+ /** One phase commit flag for fast-commit path. */
+ private boolean onePhaseCommit;
+
+ /** One phase commit write version. */
+ private GridCacheVersion writeVer;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /** TTLs for optimistic transaction. */
+ private GridLongList ttls;
+
+ /** Near cache TTLs for optimistic transaction. */
+ private GridLongList nearTtls;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtTxFinishRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param nearNodeId Near node ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param topVer Topology version.
+ * @param xidVer Transaction ID.
+ * @param threadId Thread ID.
+ * @param commitVer Commit version.
+ * @param isolation Transaction isolation.
+ * @param commit Commit flag.
+ * @param invalidate Invalidate flag.
+ * @param sys System flag.
+ * @param sysInvalidate System invalidation flag.
+ * @param syncCommit Synchronous commit flag.
+ * @param syncRollback Synchronous rollback flag.
+ * @param baseVer Base version.
+ * @param committedVers Committed versions.
+ * @param rolledbackVers Rolled back versions.
+ * @param pendingVers Pending versions.
+ * @param txSize Expected transaction size.
+ * @param writes Write entries.
+ * @param nearWrites Near cache writes.
+ * @param recoverWrites Recovery write entries.
+ * @param onePhaseCommit One phase commit flag.
+ * @param grpLockKey Group lock key.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash.
+ */
+ public GridDhtTxFinishRequest(
+ UUID nearNodeId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ long topVer,
+ GridCacheVersion xidVer,
+ GridCacheVersion commitVer,
+ long threadId,
+ IgniteTxIsolation isolation,
+ boolean commit,
+ boolean invalidate,
+ boolean sys,
+ boolean sysInvalidate,
+ boolean syncCommit,
+ boolean syncRollback,
+ GridCacheVersion baseVer,
+ Collection<GridCacheVersion> committedVers,
+ Collection<GridCacheVersion> rolledbackVers,
+ Collection<GridCacheVersion> pendingVers,
+ int txSize,
+ Collection<IgniteTxEntry<K, V>> writes,
+ Collection<IgniteTxEntry<K, V>> nearWrites,
+ Collection<IgniteTxEntry<K, V>> recoverWrites,
+ boolean onePhaseCommit,
+ @Nullable IgniteTxKey grpLockKey,
+ @Nullable UUID subjId,
+ int taskNameHash
+ ) {
+ super(xidVer, futId, commitVer, threadId, commit, invalidate, sys, syncCommit, syncRollback, baseVer,
+ committedVers, rolledbackVers, txSize, writes, recoverWrites, grpLockKey);
+
+ assert miniId != null;
+ assert nearNodeId != null;
+ assert isolation != null;
+
+ this.pendingVers = pendingVers;
+ this.topVer = topVer;
+ this.nearNodeId = nearNodeId;
+ this.isolation = isolation;
+ this.nearWrites = nearWrites;
+ this.miniId = miniId;
+ this.sysInvalidate = sysInvalidate;
+ this.onePhaseCommit = onePhaseCommit;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Near writes.
+ */
+ public Collection<IgniteTxEntry<K, V>> nearWrites() {
+ return nearWrites == null ? Collections.<IgniteTxEntry<K, V>>emptyList() : nearWrites;
+ }
+
+ /**
+ * @return Mini ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Transaction isolation.
+ */
+ public IgniteTxIsolation isolation() {
+ return isolation;
+ }
+
+ /**
+ * @return Near node ID.
+ */
+ public UUID nearNodeId() {
+ return nearNodeId;
+ }
+
+ /**
+ * @return System invalidate flag.
+ */
+ public boolean isSystemInvalidate() {
+ return sysInvalidate;
+ }
+
+ /**
+ * @return One phase commit flag.
+ */
+ public boolean onePhaseCommit() {
+ return onePhaseCommit;
+ }
+
+ /**
+ * @return Write version for one-phase commit transactions.
+ */
+ public GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /**
+ * @param writeVer Write version for one-phase commit transactions.
+ */
+ public void writeVersion(GridCacheVersion writeVer) {
+ this.writeVer = writeVer;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * Gets versions of not acquired locks with version less then one of transaction being committed.
+ *
+ * @return Versions of locks for entries participating in transaction that have not been acquired yet
+ * have version less then one of transaction being committed.
+ */
+ public Collection<GridCacheVersion> pendingVersions() {
+ return pendingVers == null ? Collections.<GridCacheVersion>emptyList() : pendingVers;
+ }
+
+ /**
+ * @param idx Entry index.
+ * @param ttl TTL.
+ */
+ public void ttl(int idx, long ttl) {
+ if (ttl != -1L) {
+ if (ttls == null) {
+ ttls = new GridLongList();
+
+ for (int i = 0; i < idx - 1; i++)
+ ttls.add(-1L);
+ }
+ }
+
+ if (ttls != null)
+ ttls.add(ttl);
+ }
+
+ /**
+ * @return TTLs for optimistic transaction.
+ */
+ public GridLongList ttls() {
+ return ttls;
+ }
+
+ /**
+ * @param idx Entry index.
+ * @param ttl TTL.
+ */
+ public void nearTtl(int idx, long ttl) {
+ if (ttl != -1L) {
+ if (nearTtls == null) {
+ nearTtls = new GridLongList();
+
+ for (int i = 0; i < idx - 1; i++)
+ nearTtls.add(-1L);
+ }
+ }
+
+ if (nearTtls != null)
+ nearTtls.add(ttl);
+ }
+
+ /**
+ * @return TTLs for optimistic transaction.
+ */
+ public GridLongList nearTtls() {
+ return nearTtls;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearWrites != null) {
+ marshalTx(nearWrites, ctx);
+
+ nearWritesBytes = new ArrayList<>(nearWrites.size());
+
+ for (IgniteTxEntry<K, V> e : nearWrites)
+ nearWritesBytes.add(ctx.marshaller().marshal(e));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearWritesBytes != null) {
+ nearWrites = new ArrayList<>(nearWritesBytes.size());
+
+ for (byte[] arr : nearWritesBytes)
+ nearWrites.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(nearWrites, true, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxFinishRequest.class, this, super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxFinishRequest _clone = new GridDhtTxFinishRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxFinishRequest _clone = (GridDhtTxFinishRequest)_msg;
+
+ _clone.nearNodeId = nearNodeId;
+ _clone.isolation = isolation;
+ _clone.nearWrites = nearWrites;
+ _clone.nearWritesBytes = nearWritesBytes;
+ _clone.miniId = miniId;
+ _clone.sysInvalidate = sysInvalidate;
+ _clone.topVer = topVer;
+ _clone.pendingVers = pendingVers;
+ _clone.onePhaseCommit = onePhaseCommit;
+ _clone.writeVer = writeVer;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.ttls = ttls;
+ _clone.nearTtls = nearTtls;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 21:
- if (!commState.putEnum(isolation))
++ if (!commState.putEnum("isolation", isolation))
+ return false;
+
+ commState.idx++;
+
+ case 22:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putUuid(nearNodeId))
++ if (!commState.putUuid("nearNodeId", nearNodeId))
+ return false;
+
+ commState.idx++;
+
+ case 24:
+ if (nearWritesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearWritesBytes.size()))
++ if (!commState.putInt(null, nearWritesBytes.size()))
+ return false;
+
+ commState.it = nearWritesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putBoolean(onePhaseCommit))
++ if (!commState.putBoolean("onePhaseCommit", onePhaseCommit))
+ return false;
+
+ commState.idx++;
+
+ case 26:
+ if (pendingVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(pendingVers.size()))
++ if (!commState.putInt(null, pendingVers.size()))
+ return false;
+
+ commState.it = pendingVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 27:
- if (!commState.putBoolean(sysInvalidate))
++ if (!commState.putBoolean("sysInvalidate", sysInvalidate))
+ return false;
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putCacheVersion(writeVer))
++ if (!commState.putCacheVersion("writeVer", writeVer))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 32:
+ if (!commState.putLongList(ttls))
+ return false;
+
+ commState.idx++;
+
+ case 33:
+ if (!commState.putLongList(nearTtls))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 21:
- if (buf.remaining() < 1)
- return false;
++ byte isolation0 = commState.getByte("isolation");
+
- byte isolation0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ isolation = IgniteTxIsolation.fromOrdinal(isolation0);
+
+ commState.idx++;
+
+ case 22:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 23:
- UUID nearNodeId0 = commState.getUuid();
++ nearNodeId = commState.getUuid("nearNodeId");
+
- if (nearNodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearNodeId = nearNodeId0;
-
+ commState.idx++;
+
+ case 24:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearWritesBytes == null)
+ nearWritesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearWritesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 25:
- if (buf.remaining() < 1)
- return false;
++ onePhaseCommit = commState.getBoolean("onePhaseCommit");
+
- onePhaseCommit = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 26:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (pendingVers == null)
+ pendingVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ pendingVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 27:
- if (buf.remaining() < 1)
- return false;
++ sysInvalidate = commState.getBoolean("sysInvalidate");
+
- sysInvalidate = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 28:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 29:
- GridCacheVersion writeVer0 = commState.getCacheVersion();
++ writeVer = commState.getCacheVersion("writeVer");
+
- if (writeVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- writeVer = writeVer0;
-
+ commState.idx++;
+
+ case 30:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 31:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 32:
+ GridLongList ttls0 = commState.getLongList();
+
+ if (ttls0 == LONG_LIST_NOT_READ)
+ return false;
+
+ ttls = ttls0;
+
+ commState.idx++;
+
+ case 33:
+ GridLongList nearTtls0 = commState.getLongList();
+
+ if (nearTtls0 == LONG_LIST_NOT_READ)
+ return false;
+
+ nearTtls = nearTtls0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 31;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index 0000000,a100f93..1ee5a3f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@@ -1,0 -1,145 +1,143 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * DHT transaction finish response.
+ */
+ public class GridDhtTxFinishResponse<K, V> extends GridDistributedTxFinishResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtTxFinishResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ */
+ public GridDhtTxFinishResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId) {
+ super(xid, futId);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxFinishResponse.class, this, super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxFinishResponse _clone = new GridDhtTxFinishResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxFinishResponse _clone = (GridDhtTxFinishResponse)_msg;
+
+ _clone.miniId = miniId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 5:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 5:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 32;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index 0000000,4211696..819db64
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@@ -1,0 -1,614 +1,598 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT prepare request.
+ */
+ public class GridDhtTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Max order. */
+ private UUID nearNodeId;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Invalidate near entries flags. */
+ private BitSet invalidateNearEntries;
+
+ /** Near writes. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> nearWrites;
+
+ /** Serialized near writes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearWritesBytes;
+
+ /** Owned versions by key. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<IgniteTxKey<K>, GridCacheVersion> owned;
+
+ /** Owned versions bytes. */
+ private byte[] ownedBytes;
+
+ /** Near transaction ID. */
+ private GridCacheVersion nearXidVer;
+
+ /** {@code True} if this is last prepare request for node. */
+ private boolean last;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ @GridDirectVersion(3)
+ /** Preload keys. */
+ private BitSet preloadKeys;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtTxPrepareRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param topVer Topology version.
+ * @param tx Transaction.
+ * @param dhtWrites DHT writes.
+ * @param nearWrites Near writes.
+ * @param grpLockKey Group lock key if preparing group-lock transaction.
+ * @param partLock {@code True} if group-lock transaction locks partition.
+ * @param txNodes Transaction nodes mapping.
+ * @param nearXidVer Near transaction ID.
+ * @param last {@code True} if this is last prepare request for node.
+ */
+ public GridDhtTxPrepareRequest(
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ long topVer,
+ GridDhtTxLocalAdapter<K, V> tx,
+ Collection<IgniteTxEntry<K, V>> dhtWrites,
+ Collection<IgniteTxEntry<K, V>> nearWrites,
+ IgniteTxKey grpLockKey,
+ boolean partLock,
+ Map<UUID, Collection<UUID>> txNodes,
+ GridCacheVersion nearXidVer,
+ boolean last,
+ UUID subjId,
+ int taskNameHash) {
+ super(tx, null, dhtWrites, grpLockKey, partLock, txNodes);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.topVer = topVer;
+ this.futId = futId;
+ this.nearWrites = nearWrites;
+ this.miniId = miniId;
+ this.nearXidVer = nearXidVer;
+ this.last = last;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+
+ invalidateNearEntries = new BitSet(dhtWrites == null ? 0 : dhtWrites.size());
+
+ nearNodeId = tx.nearNodeId();
+ }
+
+ /**
+ * @return {@code True} if this is last prepare request for node.
+ */
+ public boolean last() {
+ return last;
+ }
+
+ /**
+ * @return Near transaction ID.
+ */
+ public GridCacheVersion nearXidVersion() {
+ return nearXidVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Near node ID.
+ */
+ public UUID nearNodeId() {
+ return nearNodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Near writes.
+ */
+ public Collection<IgniteTxEntry<K, V>> nearWrites() {
+ return nearWrites == null ? Collections.<IgniteTxEntry<K, V>>emptyList() : nearWrites;
+ }
+
+ /**
+ * @param idx Entry index to set invalidation flag.
+ * @param invalidate Invalidation flag value.
+ */
+ public void invalidateNearEntry(int idx, boolean invalidate) {
+ invalidateNearEntries.set(idx, invalidate);
+ }
+
+ /**
+ * @param idx Index to get invalidation flag value.
+ * @return Invalidation flag value.
+ */
+ public boolean invalidateNearEntry(int idx) {
+ return invalidateNearEntries.get(idx);
+ }
+
+ /**
+ * Marks last added key for preloading.
+ */
+ public void markKeyForPreload(int idx) {
+ if (preloadKeys == null)
+ preloadKeys = new BitSet();
+
+ preloadKeys.set(idx, true);
+ }
+
+ /**
+ * Checks whether entry info should be sent to primary node from backup.
+ *
+ * @param idx Index.
+ * @return {@code True} if value should be sent, {@code false} otherwise.
+ */
+ public boolean needPreloadKey(int idx) {
+ return preloadKeys != null && preloadKeys.get(idx);
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * Sets owner and its mapped version.
+ *
+ * @param key Key.
+ * @param ownerMapped Owner mapped version.
+ */
+ public void owned(IgniteTxKey<K> key, GridCacheVersion ownerMapped) {
+ if (owned == null)
+ owned = new GridLeanMap<>(3);
+
+ owned.put(key, ownerMapped);
+ }
+
+ /**
+ * @return Owned versions map.
+ */
+ public Map<IgniteTxKey<K>, GridCacheVersion> owned() {
+ return owned;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (ownedBytes == null && owned != null) {
+ ownedBytes = CU.marshal(ctx, owned);
+
+ if (ctx.deploymentEnabled()) {
+ for (IgniteTxKey<K> k : owned.keySet())
+ prepareObject(k, ctx);
+ }
+ }
+
+ if (nearWrites != null) {
+ marshalTx(nearWrites, ctx);
+
+ nearWritesBytes = new ArrayList<>(nearWrites.size());
+
+ for (IgniteTxEntry<K, V> e : nearWrites)
+ nearWritesBytes.add(ctx.marshaller().marshal(e));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (ownedBytes != null && owned == null)
+ owned = ctx.marshaller().unmarshal(ownedBytes, ldr);
+
+ if (nearWritesBytes != null) {
+ nearWrites = new ArrayList<>(nearWritesBytes.size());
+
+ for (byte[] arr : nearWritesBytes)
+ nearWrites.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(nearWrites, true, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxPrepareRequest.class, this, "super", super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxPrepareRequest _clone = new GridDhtTxPrepareRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxPrepareRequest _clone = (GridDhtTxPrepareRequest)_msg;
+
+ _clone.nearNodeId = nearNodeId;
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.topVer = topVer;
+ _clone.invalidateNearEntries = invalidateNearEntries;
+ _clone.nearWrites = nearWrites;
+ _clone.nearWritesBytes = nearWritesBytes;
+ _clone.owned = owned;
+ _clone.ownedBytes = ownedBytes;
+ _clone.nearXidVer = nearXidVer;
+ _clone.last = last;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.preloadKeys = preloadKeys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 22:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putBitSet(invalidateNearEntries))
++ if (!commState.putBitSet("invalidateNearEntries", invalidateNearEntries))
+ return false;
+
+ commState.idx++;
+
+ case 24:
- if (!commState.putBoolean(last))
++ if (!commState.putBoolean("last", last))
+ return false;
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 26:
- if (!commState.putUuid(nearNodeId))
++ if (!commState.putUuid("nearNodeId", nearNodeId))
+ return false;
+
+ commState.idx++;
+
+ case 27:
+ if (nearWritesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearWritesBytes.size()))
++ if (!commState.putInt(null, nearWritesBytes.size()))
+ return false;
+
+ commState.it = nearWritesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putCacheVersion(nearXidVer))
++ if (!commState.putCacheVersion("nearXidVer", nearXidVer))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putByteArray(ownedBytes))
++ if (!commState.putByteArray("ownedBytes", ownedBytes))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 32:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 33:
- if (!commState.putBitSet(preloadKeys))
++ if (!commState.putBitSet("preloadKeys", preloadKeys))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 22:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 23:
- BitSet invalidateNearEntries0 = commState.getBitSet();
++ invalidateNearEntries = commState.getBitSet("invalidateNearEntries");
+
- if (invalidateNearEntries0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- invalidateNearEntries = invalidateNearEntries0;
-
+ commState.idx++;
+
+ case 24:
- if (buf.remaining() < 1)
- return false;
++ last = commState.getBoolean("last");
+
- last = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 25:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 26:
- UUID nearNodeId0 = commState.getUuid();
++ nearNodeId = commState.getUuid("nearNodeId");
+
- if (nearNodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearNodeId = nearNodeId0;
-
+ commState.idx++;
+
+ case 27:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearWritesBytes == null)
+ nearWritesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearWritesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 28:
- GridCacheVersion nearXidVer0 = commState.getCacheVersion();
++ nearXidVer = commState.getCacheVersion("nearXidVer");
+
- if (nearXidVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearXidVer = nearXidVer0;
-
+ commState.idx++;
+
+ case 29:
- byte[] ownedBytes0 = commState.getByteArray();
++ ownedBytes = commState.getByteArray("ownedBytes");
+
- if (ownedBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ownedBytes = ownedBytes0;
-
+ commState.idx++;
+
+ case 30:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 31:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 32:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 33:
- BitSet preloadKeys0 = commState.getBitSet();
++ preloadKeys = commState.getBitSet("preloadKeys");
+
- if (preloadKeys0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- preloadKeys = preloadKeys0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 33;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index 0000000,165e294..ec59dae
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@@ -1,0 -1,472 +1,468 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT transaction prepare response.
+ */
+ public class GridDhtTxPrepareResponse<K, V> extends GridDistributedTxPrepareResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Evicted readers. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxKey<K>> nearEvicted;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearEvictedBytes;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Invalid partitions. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Collection<Integer> invalidParts;
+
+ @GridDirectTransient
+ /** Preload entries. */
+ private List<GridCacheEntryInfo<K, V>> preloadEntries;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private List<byte[]> preloadEntriesBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtTxPrepareResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ */
+ public GridDhtTxPrepareResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId) {
+ super(xid);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.futId = futId;
+ this.miniId = miniId;
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param err Error.
+ */
+ public GridDhtTxPrepareResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId, Throwable err) {
+ super(xid, err);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.futId = futId;
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Evicted readers.
+ */
+ public Collection<IgniteTxKey<K>> nearEvicted() {
+ return nearEvicted;
+ }
+
+ /**
+ * @param nearEvicted Evicted readers.
+ */
+ public void nearEvicted(Collection<IgniteTxKey<K>> nearEvicted) {
+ this.nearEvicted = nearEvicted;
+ }
+
+ /**
+ * @param nearEvictedBytes Near evicted bytes.
+ */
+ public void nearEvictedBytes(Collection<byte[]> nearEvictedBytes) {
+ this.nearEvictedBytes = nearEvictedBytes;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Invalid partitions.
+ */
+ public Collection<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /**
+ * @param invalidParts Invalid partitions.
+ */
+ public void invalidPartitions(Collection<Integer> invalidParts) {
+ this.invalidParts = invalidParts;
+ }
+
+ /**
+ * Gets preload entries found on backup node.
+ *
+ * @return Collection of entry infos need to be preloaded.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> preloadEntries() {
+ return preloadEntries == null ? Collections.<GridCacheEntryInfo<K, V>>emptyList() : preloadEntries;
+ }
+
+ /**
+ * Adds preload entry.
+ *
+ * @param info Info to add.
+ */
+ public void addPreloadEntry(GridCacheEntryInfo<K, V> info) {
+ if (preloadEntries == null)
+ preloadEntries = new ArrayList<>();
+
+ preloadEntries.add(info);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = marshalCollection(nearEvicted, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null)
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ // Unmarshal even if deployment is disabled, since we could get bytes initially.
+ if (nearEvicted == null && nearEvictedBytes != null)
+ nearEvicted = unmarshalCollection(nearEvictedBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null)
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxPrepareResponse.class, this, "super", super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxPrepareResponse _clone = new GridDhtTxPrepareResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxPrepareResponse _clone = (GridDhtTxPrepareResponse)_msg;
+
+ _clone.nearEvicted = nearEvicted;
+ _clone.nearEvictedBytes = nearEvictedBytes;
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.invalidParts = invalidParts;
+ _clone.preloadEntries = preloadEntries;
+ _clone.preloadEntriesBytes = preloadEntriesBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 10:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 11:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (nearEvictedBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEvictedBytes.size()))
++ if (!commState.putInt(null, nearEvictedBytes.size()))
+ return false;
+
+ commState.it = nearEvictedBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 14:
+ if (preloadEntriesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(preloadEntriesBytes.size()))
++ if (!commState.putInt(null, preloadEntriesBytes.size()))
+ return false;
+
+ commState.it = preloadEntriesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 10:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 13:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEvictedBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (preloadEntriesBytes == null)
+ preloadEntriesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ preloadEntriesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 34;
+ }
+ }