You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/03/04 14:26:36 UTC
[01/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-51 4c7f4566f -> 88bc98dd2
#ignite-51: IgniteTxEntry implements Message.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4ba6e20e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4ba6e20e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4ba6e20e
Branch: refs/heads/ignite-51
Commit: 4ba6e20e7530d892fce3f631355e087df1c593a8
Parents: 99b215a
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 15:58:57 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 15:58:57 2015 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 8 +
.../GridDistributedTxPrepareRequest.java | 109 +------
.../cache/transactions/IgniteTxEntry.java | 308 +++++++++++++++++--
3 files changed, 294 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ba6e20e/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 57b5ac4..814e380 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -533,6 +533,14 @@ public class GridIoMessageFactory implements MessageFactory {
msg = new CacheContinuousQueryEntry();
break;
+ case 97:
+ msg = new IgniteTxEntry();
+
+ break;
+ case 98:
+ msg = new IgniteTxEntry.TxEntryValueHolder();
+
+ break;
default:
if (ext != null) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ba6e20e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 5648ad4..7ab40ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -23,7 +23,6 @@ import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.apache.ignite.transactions.*;
@@ -70,19 +69,11 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
@GridDirectTransient
private Collection<IgniteTxEntry> reads;
- /** */
- @GridDirectCollection(byte[].class)
- private Collection<byte[]> readsBytes;
-
/** Transaction write entries. */
@GridToStringInclude
@GridDirectTransient
private Collection<IgniteTxEntry> writes;
- /** */
- @GridDirectCollection(byte[].class)
- private Collection<byte[]> writesBytes;
-
/** DHT versions to verify. */
@GridToStringInclude
@GridDirectTransient
@@ -301,24 +292,12 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- if (writes != null) {
+ if (writes != null)
marshalTx(writes, ctx);
- writesBytes = new ArrayList<>(writes.size());
-
- for (IgniteTxEntry e : writes)
- writesBytes.add(ctx.marshaller().marshal(e));
- }
-
- if (reads != null) {
+ if (reads != null)
marshalTx(reads, ctx);
- readsBytes = new ArrayList<>(reads.size());
-
- for (IgniteTxEntry e : reads)
- readsBytes.add(ctx.marshaller().marshal(e));
- }
-
if (grpLockKey != null && grpLockKeyBytes == null)
grpLockKeyBytes = ctx.marshaller().marshal(grpLockKey);
@@ -341,23 +320,9 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (writesBytes != null) {
- writes = new ArrayList<>(writesBytes.size());
-
- for (byte[] arr : writesBytes)
- writes.add(ctx.marshaller().<IgniteTxEntry>unmarshal(arr, ldr));
-
- unmarshalTx(writes, false, ctx, ldr);
- }
-
- if (readsBytes != null) {
- reads = new ArrayList<>(readsBytes.size());
+ unmarshalTx(writes, false, ctx, ldr);
- for (byte[] arr : readsBytes)
- reads.add(ctx.marshaller().<IgniteTxEntry>unmarshal(arr, ldr));
-
- unmarshalTx(reads, false, ctx, ldr);
- }
+ unmarshalTx(reads, false, ctx, ldr);
if (grpLockKeyBytes != null && grpLockKey == null)
grpLockKey = ctx.marshaller().unmarshal(grpLockKeyBytes, ldr);
@@ -384,64 +349,6 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
txNodes = ctx.marshaller().unmarshal(txNodesBytes, ldr);
}
- /**
- *
- * @param out Output.
- * @param col Set to write.
- * @throws IOException If write failed.
- */
- private void writeCollection(ObjectOutput out, Collection<IgniteTxEntry> col) throws IOException {
- boolean empty = F.isEmpty(col);
-
- if (!empty) {
- out.writeInt(col.size());
-
- for (IgniteTxEntry e : col) {
- CacheObject val = e.value();
- boolean hasWriteVal = e.hasWriteValue();
- boolean hasReadVal = e.hasReadValue();
-
- try {
- // Don't serialize value if invalidate is set to true.
- if (invalidate)
- e.value(null, false, false);
-
- out.writeObject(e);
- }
- finally {
- // Set original value back.
- e.value(val, hasWriteVal, hasReadVal);
- }
- }
- }
- else
- out.writeInt(-1);
- }
-
- /**
- * @param in Input.
- * @return Deserialized set.
- * @throws IOException If deserialization failed.
- * @throws ClassNotFoundException If deserialized class could not be found.
- */
- @SuppressWarnings({"unchecked"})
- @Nullable private Collection<IgniteTxEntry> readCollection(ObjectInput in) throws IOException,
- ClassNotFoundException {
- List<IgniteTxEntry> col = null;
-
- int size = in.readInt();
-
- // Check null flag.
- if (size != -1) {
- col = new ArrayList<>(size);
-
- for (int i = 0; i < size; i++)
- col.add((IgniteTxEntry)in.readObject());
- }
-
- return col == null ? Collections.<IgniteTxEntry>emptyList() : col;
- }
-
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
@@ -506,7 +413,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
writer.incrementState();
case 16:
- if (!writer.writeCollection("readsBytes", readsBytes, MessageCollectionItemType.BYTE_ARR))
+ if (!writer.writeCollection("reads", reads, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -548,7 +455,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
writer.incrementState();
case 23:
- if (!writer.writeCollection("writesBytes", writesBytes, MessageCollectionItemType.BYTE_ARR))
+ if (!writer.writeCollection("writes", writes, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -642,7 +549,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
reader.incrementState();
case 16:
- readsBytes = reader.readCollection("readsBytes", MessageCollectionItemType.BYTE_ARR);
+ reads = reader.readCollection("reads", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -698,7 +605,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
reader.incrementState();
case 23:
- writesBytes = reader.readCollection("writesBytes", MessageCollectionItemType.BYTE_ARR);
+ writes = reader.readCollection("writes", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ba6e20e/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 db166fb..367c586 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
@@ -21,19 +21,20 @@ import org.apache.ignite.*;
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.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
import javax.cache.*;
import javax.cache.expiry.*;
import javax.cache.processor.*;
import java.io.*;
+import java.nio.*;
import java.util.*;
import java.util.concurrent.atomic.*;
@@ -44,7 +45,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
* {@link #equals(Object)} method, as transaction entries should use referential
* equality.
*/
-public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, OptimizedMarshallable {
+public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Message, OptimizedMarshallable {
/** */
private static final long serialVersionUID = 0L;
@@ -134,7 +135,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
private boolean grpLock;
/** Deployment enabled flag. */
- private boolean depEnabled;
+ private boolean depEnabled = true;
/** Expiry policy. */
private ExpiryPolicy expiryPlc;
@@ -756,6 +757,182 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
}
/** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeMessage("key", key))
+ return false;
+
+ writer.incrementState();
+ case 1:
+ if (!writer.writeInt("cacheId", cacheId))
+ return false;
+
+ writer.incrementState();
+ case 2:
+ if (!writer.writeMessage("val", val))
+ return false;
+
+ writer.incrementState();
+ case 3:
+ if (!writer.writeLong("ttl", ttl))
+ return false;
+
+ writer.incrementState();
+ case 4:
+ if (!writer.writeMessage("conflictVer", conflictVer))
+ return false;
+
+ writer.incrementState();
+ case 5:
+ if (!writer.writeBoolean("grpLock", grpLock))
+ return false;
+
+ writer.incrementState();
+ case 6:
+ if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
+ return false;
+
+ writer.incrementState();
+ case 7:
+ if (!writer.writeByteArray("filterBytes", filterBytes))
+ return false;
+
+ writer.incrementState();
+ case 8:
+ if (!(writer.writeLong("conflictExpireTime", conflictExpireTime)))
+ return false;
+
+ writer.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ key = reader.readMessage("key");
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 1:
+ cacheId = reader.readInt("cacheId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 2:
+ val = reader.readMessage("val");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 3:
+ ttl = reader.readLong("ttl");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 4:
+ conflictVer = reader.readMessage("conflictVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 5:
+ grpLock = reader.readBoolean("grpLock");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 6:
+ transformClosBytes = reader.readByteArray("transformClosBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 7:
+ filterBytes = reader.readByteArray("filterBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 8:
+ conflictExpireTime = reader.readLong("conflictExpireTime");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 97;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 9;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object ggClassId() {
+ return GG_CLASS_ID;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Class<?> deployClass() {
+ ClassLoader clsLdr = getClass().getClassLoader();
+
+ 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()) ?
+ key.getClass() : val != null ? val.getClass() : getClass();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClassLoader classLoader() {
+ return deployClass().getClassLoader();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(IgniteTxEntry.class, this, "xidVer", tx == null ? "null" : tx.xidVersion());
+ }
+
+
+ /** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean(depEnabled);
@@ -822,36 +999,10 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
expiryPlc = (ExpiryPolicy)in.readObject();
}
- /** {@inheritDoc} */
- @Override public Object ggClassId() {
- return GG_CLASS_ID;
- }
-
- /** {@inheritDoc} */
- @Override public Class<?> deployClass() {
- ClassLoader clsLdr = getClass().getClassLoader();
-
- 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()) ?
- key.getClass() : val != null ? val.getClass() : getClass();
- }
-
- /** {@inheritDoc} */
- @Override public ClassLoader classLoader() {
- return deployClass().getClassLoader();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- 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 {
+ public static class TxEntryValueHolder implements Message {
/** */
@GridToStringInclude
private CacheObject val;
@@ -948,6 +1099,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
throws IgniteCheckedException {
if (hasWriteVal && val != null)
val.prepareMarshal(ctx.cacheObjectContext());
+
// TODO IGNITE-51.
// boolean valIsByteArr = val != null && val instanceof byte[];
//
@@ -968,6 +1120,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException {
if (val != null)
val.finishUnmarshal(ctx, ldr);
+
// TODO IGNITE-51.
// if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled))
// val = ctx.marshaller().unmarshal(valBytes, ldr);
@@ -1039,5 +1192,100 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Optim
@Override public String toString() {
return "[op=" + op +", val=" + val + ']';
}
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeBoolean("hasReadVal", hasReadVal))
+ return false;
+
+ writer.incrementState();
+
+ case 2:
+ if (!writer.writeInt("op", op.ordinal()))
+ return false;
+
+ writer.incrementState();
+ case 3:
+ if (!writer.writeMessage("cacheObject", val))
+ return false;
+
+ writer.incrementState();
+
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ hasWriteVal = reader.readBoolean("hasWriteVal");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ hasReadVal = reader.readBoolean("hasReadVal");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 2:
+ op = GridCacheOperation.fromOrdinal(reader.readInt("op"));
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 3:
+ val = reader.readMessage("cacheObject");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 98;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 4;
+ }
}
}
[22/22] incubator-ignite git commit: Merge branch 'ignite-51' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-51
Posted by sb...@apache.org.
Merge branch 'ignite-51' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-51
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/88bc98dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/88bc98dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/88bc98dd
Branch: refs/heads/ignite-51
Commit: 88bc98dd2dfa1d56fed77933ac49c8a15549a172
Parents: 8157fed 4c7f456
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 16:24:30 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 16:24:30 2015 +0300
----------------------------------------------------------------------
.../processors/cache/CacheObjectAdapter.java | 1 +
.../processors/cache/CacheObjectImpl.java | 10 +--
.../processors/cache/GridCacheContext.java | 43 ++--------
.../processors/cache/GridCacheMapEntry.java | 83 ++++----------------
.../processors/cache/KeyCacheObjectImpl.java | 4 +-
.../processors/cache/UserCacheObjectImpl.java | 2 +-
.../cache/UserKeyCacheObjectImpl.java | 13 +--
.../local/atomic/GridLocalAtomicCache.java | 11 ---
.../cache/query/GridCacheQueryManager.java | 4 +-
.../transactions/IgniteTxLocalAdapter.java | 55 -------------
.../dataload/IgniteDataLoaderImpl.java | 4 +-
.../portable/GridPortableProcessor.java | 55 ++++++++-----
.../IgniteCacheObjectProcessorAdapter.java | 81 +++++++++++++++++++
.../portable/os/GridOsPortableProcessor.java | 44 -----------
14 files changed, 160 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88bc98dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
index 5da0f79,51cb487..87ff779
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
@@@ -94,10 -94,8 +94,10 @@@ public class CacheObjectImpl extends Ca
/** {@inheritDoc} */
@Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ assert val != null || valBytes != null;
+
if (valBytes == null && !byteArray())
- valBytes = CU.marshal(ctx.kernalContext().cache().context(), val);
+ valBytes = ctx.kernalContext().portable().marshal(ctx, val);
}
/** {@inheritDoc} */
[21/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: working version.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: working version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8157fedf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8157fedf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8157fedf
Branch: refs/heads/ignite-51
Commit: 8157fedfb3b3d56209e7f7125a331726a06d5b94
Parents: b4f2f8f
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 16:09:05 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 16:09:05 2015 +0300
----------------------------------------------------------------------
.../internal/direct/DirectByteBufferStream.java | 22 +++++++++++++-------
.../cache/transactions/IgniteTxEntry.java | 9 +-------
2 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8157fedf/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
index 048617d..32a8d84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
@@ -246,6 +246,12 @@ public class DirectByteBufferStream {
private Iterator<?> it;
/** */
+ private Iterator<?> arrIt;
+
+ /** */
+ private Object arrCur = NULL;
+
+ /** */
private Object mapCur = NULL;
/** */
@@ -569,28 +575,28 @@ public class DirectByteBufferStream {
*/
public <T> void writeObjectArray(T[] arr, MessageCollectionItemType itemType, MessageWriter writer) {
if (arr != null) {
- if (it == null) {
+ if (arrIt == null) {
writeInt(arr.length);
if (!lastFinished)
return;
- it = arrayIterator(arr);
+ arrIt = arrayIterator(arr);
}
- while (it.hasNext() || cur != NULL) {
- if (cur == NULL)
- cur = it.next();
+ while (arrIt.hasNext() || arrCur != NULL) {
+ if (arrCur == NULL)
+ arrCur = arrIt.next();
- write(itemType, cur, writer);
+ write(itemType, arrCur, writer);
if (!lastFinished)
return;
- cur = NULL;
+ arrCur = NULL;
}
- it = null;
+ arrIt = null;
}
else
writeInt(-1);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8157fedf/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 48b7fb4..87ab46b 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
@@ -803,14 +803,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 5:
- if (!F.isEmptyOrNulls(filters)) {
- for (CacheEntryPredicate filter : filters) {
- if (filter == null) {
- System.out.println("TEST FAIL");
- }
- }
- }
- if (!writer.writeObjectArray("filters", filters, MessageCollectionItemType.MSG))
+ if (!writer.writeObjectArray("filters", !F.isEmptyOrNulls(filters) ? filters : null, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
[04/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5c26926c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5c26926c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5c26926c
Branch: refs/heads/ignite-51
Commit: 5c26926c7c23544f9cdb49ce0fbeb87d80131f1c
Parents: e1cf752
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:37:59 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:37:59 2015 +0300
----------------------------------------------------------------------
.../GridDistributedTxPrepareRequest.java | 4 ++--
.../dht/GridDhtTxPrepareRequest.java | 3 +--
.../near/GridNearTxPrepareResponse.java | 21 +++++++++-----------
3 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c26926c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 7ab40ea..0b130aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -71,7 +71,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
/** Transaction write entries. */
@GridToStringInclude
- @GridDirectTransient
+ @GridDirectCollection(IgniteTxEntry.class)
private Collection<IgniteTxEntry> writes;
/** DHT versions to verify. */
@@ -84,7 +84,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
private Collection<IgniteTxKey> dhtVerKeys;
/** */
- @GridDirectCollection(IgniteTxKey.class)
+ @GridDirectCollection(GridCacheVersion.class)
private Collection<GridCacheVersion> dhtVerVals;
/** Group lock key, if any. */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c26926c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --git 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
index 19533eb..34a59c7 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
@@ -295,7 +295,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (ownedKeys != null && owned == null) {
+ if (ownedKeys != null) {
assert ownedKeys.size() == ownedVals.size();
owned = U.newHashMap(ownedKeys.size());
@@ -311,7 +311,6 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
owned.put(key, valIter.next());
}
-
}
unmarshalTx(nearWrites, true, ctx, ldr);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c26926c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 22efce4..beb2015 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -65,12 +65,12 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** OwnedVals' keys for marshalling. */
@GridToStringExclude
- @GridDirectTransient
+ @GridDirectCollection(IgniteTxKey.class)
private Collection<IgniteTxKey> ownedValKeys;
/** OwnedVals' values for marshalling. */
@GridToStringExclude
- @GridDirectTransient
+ @GridDirectCollection(OwnedValue.class)
private Collection<OwnedValue> ownedValVals;
/** Cache return value. */
@@ -234,14 +234,12 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
ownedValVals = ownedVals.values();
- for (IgniteTxKey key : ownedVals.keySet()) {
- GridCacheContext cacheCtx = ctx.cacheContext(key.cacheId());
+ for (Map.Entry<IgniteTxKey, OwnedValue> entry : ownedVals.entrySet()) {
+ GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId());
- OwnedValue value = ownedVals.get(key);
+ entry.getKey().prepareMarshal(cacheCtx);
- key.prepareMarshal(cacheCtx);
-
- value.prepareMarshal(cacheCtx.cacheObjectContext());
+ entry.getValue().prepareMarshal(cacheCtx.cacheObjectContext());
}
}
@@ -262,7 +260,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
super.finishUnmarshal(ctx, ldr);
if (ownedValKeys != null && ownedVals == null) {
- ownedVals = new HashMap<>();
+ ownedVals = U.newHashMap(ownedValKeys.size());
assert ownedValKeys.size() == ownedValVals.size();
@@ -484,14 +482,13 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** Cache object. */
private CacheObject obj;
+ /** */
public OwnedValue() {
// No-op.
}
/**
- * Initialize OwnedValues.
- *
- * @param vers Cache version.
+ * @param vers Cache version.
* @param obj Cache object.
*/
OwnedValue(GridCacheVersion vers, CacheObject obj) {
[18/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: remove filterBytes from IgniteTxEntry.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: remove filterBytes from IgniteTxEntry.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/52be74ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/52be74ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/52be74ab
Branch: refs/heads/ignite-51
Commit: 52be74ab9fd9aadec30f484d75b356e908667350
Parents: ebb880c
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 13:01:28 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 13:01:28 2015 +0300
----------------------------------------------------------------------
.../near/NearTxPrepareResponseOwnedValue.java | 2 +-
.../cache/transactions/IgniteTxEntry.java | 36 +++++---------------
.../cache/transactions/TxEntryValueHolder.java | 2 +-
3 files changed, 11 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52be74ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
index 502b906..87f936e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
@@ -147,7 +147,7 @@ public class NearTxPrepareResponseOwnedValue implements Message {
/** {@inheritDoc} */
@Override public byte directType() {
- return 99;
+ return 102;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52be74ab/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 678a653..0d0503f 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
@@ -26,11 +26,9 @@ import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
-import javax.cache.*;
import javax.cache.expiry.*;
import javax.cache.processor.*;
import java.io.*;
@@ -74,9 +72,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
@GridDirectTransient
private TxEntryValueHolder prevVal = new TxEntryValueHolder();
- /** Filter bytes. */
- private byte[] filterBytes;
-
/** Transform. */
@GridToStringInclude
@GridDirectTransient
@@ -105,7 +100,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** Put filters. */
@GridToStringInclude
- @GridDirectTransient
private CacheEntryPredicate[] filters;
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
@@ -653,8 +647,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
* @param filters Put filters.
*/
public void filters(CacheEntryPredicate[] filters) {
- filterBytes = null;
-
this.filters = filters;
}
@@ -703,11 +695,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
if (transformClosBytes == null && entryProcessorsCol != null)
transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
- if (F.isEmptyOrNulls(filters))
- filterBytes = null;
- else if (filterBytes == null)
- filterBytes = CU.marshal(ctx, filters);
-
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
@@ -742,17 +729,12 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
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.empty0();
- else {
- for (CacheEntryPredicate p : filters) {
- if (p != null)
- p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
- }
- }
+ if (filters == null)
+ filters = CU.empty0();
+ else {
+ for (CacheEntryPredicate p : filters) {
+ if (p != null)
+ p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
}
}
@@ -821,7 +803,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 5:
- if (!writer.writeByteArray("filterBytes", filterBytes))
+ if (!writer.writeObjectArray("filters", filters, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -910,7 +892,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 5:
- filterBytes = reader.readByteArray("filterBytes");
+ filters = reader.readObjectArray("filters", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
if (!reader.isLastRead())
return false;
@@ -964,7 +946,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** {@inheritDoc} */
@Override public byte directType() {
- return 97;
+ return 100;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52be74ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 9627026..cce97b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -223,7 +223,7 @@ public class TxEntryValueHolder implements Message {
/** {@inheritDoc} */
@Override public byte directType() {
- return 98;
+ return 101;
}
/** {@inheritDoc} */
[15/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: small fixs.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: small fixs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/832657ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/832657ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/832657ef
Branch: refs/heads/ignite-51
Commit: 832657ef01740cfd34a3469573a7ada097c6cbef
Parents: 21cdc80
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 12:47:34 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 12:47:34 2015 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 2 +-
.../near/GridNearTxPrepareFuture.java | 6 +-
.../near/GridNearTxPrepareResponse.java | 18 +--
.../GridNearTxPrepareResponseOwnedValue.java | 157 -------------------
.../near/NearTxPrepareResponseOwnedValue.java | 157 +++++++++++++++++++
.../cache/transactions/IgniteTxEntry.java | 22 ++-
.../cache/transactions/TxEntryValueHolder.java | 24 +--
7 files changed, 189 insertions(+), 197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index f12a9bf..44f8c7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -545,7 +545,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 99:
- msg = new GridNearTxPrepareResponseOwnedValue();
+ msg = new NearTxPrepareResponseOwnedValue();
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index dc2c11d..2a6cddb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -934,7 +934,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
else {
assert F.isEmpty(res.invalidPartitions());
- for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> entry : res.ownedValues().entrySet()) {
+ for (Map.Entry<IgniteTxKey, NearTxPrepareResponseOwnedValue> entry : res.ownedValues().entrySet()) {
IgniteTxEntry txEntry = tx.entry(entry.getKey());
assert txEntry != null;
@@ -946,7 +946,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
if (cacheCtx.isNear()) {
GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
- GridNearTxPrepareResponseOwnedValue tup = entry.getValue();
+ NearTxPrepareResponseOwnedValue tup = entry.getValue();
nearEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion(),
tup.version(), m.node().id());
@@ -954,7 +954,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
else if (txEntry.cached().detached()) {
GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
- GridNearTxPrepareResponseOwnedValue tup = entry.getValue();
+ NearTxPrepareResponseOwnedValue tup = entry.getValue();
detachedEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index d6819bf..6cf80ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -61,7 +61,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** Map of owned values to set on near node. */
@GridToStringInclude
@GridDirectTransient
- private Map<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> ownedVals;
+ private Map<IgniteTxKey, NearTxPrepareResponseOwnedValue> ownedVals;
/** OwnedVals' keys for marshalling. */
@GridToStringExclude
@@ -70,8 +70,8 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** OwnedVals' values for marshalling. */
@GridToStringExclude
- @GridDirectCollection(GridNearTxPrepareResponseOwnedValue.class)
- private Collection<GridNearTxPrepareResponseOwnedValue> ownedValVals;
+ @GridDirectCollection(NearTxPrepareResponseOwnedValue.class)
+ private Collection<NearTxPrepareResponseOwnedValue> ownedValVals;
/** Cache return value. */
@GridDirectTransient
@@ -174,7 +174,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
if (ownedVals == null)
ownedVals = new HashMap<>();
- GridNearTxPrepareResponseOwnedValue oVal = new GridNearTxPrepareResponseOwnedValue(ver, val);
+ NearTxPrepareResponseOwnedValue oVal = new NearTxPrepareResponseOwnedValue(ver, val);
ownedVals.put(key, oVal);
}
@@ -182,9 +182,9 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/**
* @return Owned values map.
*/
- public Map<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> ownedValues() {
+ public Map<IgniteTxKey, NearTxPrepareResponseOwnedValue> ownedValues() {
return ownedVals == null ?
- Collections.<IgniteTxKey, GridNearTxPrepareResponseOwnedValue>emptyMap() :
+ Collections.<IgniteTxKey, NearTxPrepareResponseOwnedValue>emptyMap() :
Collections.unmodifiableMap(ownedVals);
}
@@ -234,7 +234,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
ownedValVals = ownedVals.values();
- for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> entry : ownedVals.entrySet()) {
+ for (Map.Entry<IgniteTxKey, NearTxPrepareResponseOwnedValue> entry : ownedVals.entrySet()) {
GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId());
entry.getKey().prepareMarshal(cacheCtx);
@@ -266,14 +266,14 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator();
- Iterator<GridNearTxPrepareResponseOwnedValue> valueIter = ownedValVals.iterator();
+ Iterator<NearTxPrepareResponseOwnedValue> valueIter = ownedValVals.iterator();
while (keyIter.hasNext()) {
IgniteTxKey key = keyIter.next();
GridCacheContext cctx = ctx.cacheContext(key.cacheId());
- GridNearTxPrepareResponseOwnedValue value = valueIter.next();
+ NearTxPrepareResponseOwnedValue value = valueIter.next();
key.finishUnmarshal(cctx, ldr);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
deleted file mode 100644
index ff0f35a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-
-import java.nio.*;
-
-/**
- * Message for owned values to set on near node.
- */
-public class GridNearTxPrepareResponseOwnedValue implements Message {
- /** Cache version. */
- private GridCacheVersion vers;
-
- /** Cache object. */
- private CacheObject obj;
-
- /** */
- public GridNearTxPrepareResponseOwnedValue() {
- // No-op.
- }
-
- /**
- * @param vers Cache version.
- * @param obj Cache object.
- */
- GridNearTxPrepareResponseOwnedValue(GridCacheVersion vers, CacheObject obj) {
- this.vers = vers;
- this.obj = obj;
- }
-
- /**
- * @return Cache version.
- */
- public GridCacheVersion version() {
- return vers;
- }
-
- /**
- * @return Cache object.
- */
- public CacheObject cacheObject() {
- return obj;
- }
-
- /**
- * This method is called before the whole message is sent
- * and is responsible for pre-marshalling state.
- *
- * @param ctx Cache object context.
- * @throws org.apache.ignite.IgniteCheckedException If failed.
- */
- public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
- if (obj != null)
- obj.prepareMarshal(ctx);
- }
-
- /**
- * This method is called after the whole message is recived
- * and is responsible for unmarshalling state.
- *
- * @param ctx Context.
- * @param ldr Class loader.
- * @throws org.apache.ignite.IgniteCheckedException If failed.
- */
- public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
- if (obj != null)
- obj.finishUnmarshal(ctx, ldr);
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 0:
- if (!writer.writeMessage("obj", obj))
- return false;
-
- writer.incrementState();
-
- case 1:
- if (!writer.writeMessage("vers", vers))
- return false;
-
- writer.incrementState();
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- switch (reader.state()) {
- case 0:
- obj = reader.readMessage("obj");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 1:
- vers = reader.readMessage("vers");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public byte directType() {
- return 99;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 2;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
new file mode 100644
index 0000000..502b906
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/NearTxPrepareResponseOwnedValue.java
@@ -0,0 +1,157 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+
+import java.nio.*;
+
+/**
+ * Message for owned values to set on near node.
+ */
+public class NearTxPrepareResponseOwnedValue implements Message {
+ /** Cache version. */
+ private GridCacheVersion vers;
+
+ /** Cache object. */
+ private CacheObject obj;
+
+ /** */
+ public NearTxPrepareResponseOwnedValue() {
+ // No-op.
+ }
+
+ /**
+ * @param vers Cache version.
+ * @param obj Cache object.
+ */
+ NearTxPrepareResponseOwnedValue(GridCacheVersion vers, CacheObject obj) {
+ this.vers = vers;
+ this.obj = obj;
+ }
+
+ /**
+ * @return Cache version.
+ */
+ public GridCacheVersion version() {
+ return vers;
+ }
+
+ /**
+ * @return Cache object.
+ */
+ public CacheObject cacheObject() {
+ return obj;
+ }
+
+ /**
+ * This method is called before the whole message is sent
+ * and is responsible for pre-marshalling state.
+ *
+ * @param ctx Cache object context.
+ * @throws org.apache.ignite.IgniteCheckedException If failed.
+ */
+ public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ if (obj != null)
+ obj.prepareMarshal(ctx);
+ }
+
+ /**
+ * This method is called after the whole message is recived
+ * and is responsible for unmarshalling state.
+ *
+ * @param ctx Context.
+ * @param ldr Class loader.
+ * @throws org.apache.ignite.IgniteCheckedException If failed.
+ */
+ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ if (obj != null)
+ obj.finishUnmarshal(ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeMessage("obj", obj))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeMessage("vers", vers))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ obj = reader.readMessage("obj");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ vers = reader.readMessage("vers");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 99;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/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 4ac2ab6..43ea4e5 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
@@ -100,7 +100,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
private GridCacheVersion explicitVer;
/** DHT version. */
- private transient volatile GridCacheVersion dhtVer;
+ @GridDirectTransient
+ private volatile GridCacheVersion dhtVer;
/** Put filters. */
@GridToStringInclude
@@ -112,23 +113,29 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
private boolean filtersPassed;
/** Flag indicating that filter is set and can not be replaced. */
- private transient boolean filtersSet;
+ @GridDirectTransient
+ private boolean filtersSet;
/** Underlying cache entry. */
- private transient volatile GridCacheEntryEx entry;
+ @GridDirectTransient
+ private volatile GridCacheEntryEx entry;
/** Cache registry. */
- private transient GridCacheContext<?, ?> ctx;
+ @GridDirectTransient
+ private GridCacheContext<?, ?> ctx;
/** Prepared flag to prevent multiple candidate add. */
@SuppressWarnings({"TransientFieldNotInitialized"})
- private transient AtomicBoolean prepared = new AtomicBoolean();
+ @GridDirectTransient
+ private AtomicBoolean prepared = new AtomicBoolean();
/** Lock flag for colocated cache. */
+ @GridDirectTransient
private transient boolean locked;
/** Assigned node ID (required only for partitioned cache). */
- private transient UUID nodeId;
+ @GridDirectTransient
+ private UUID nodeId;
/** Flag if this node is a back up node. */
@GridDirectTransient
@@ -142,6 +149,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
private ExpiryPolicy expiryPlc;
/** Expiry policy transfer flag. */
+ @GridDirectTransient
private boolean transferExpiryPlc;
/** Expiry policy bytes. */
@@ -738,7 +746,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
val.unmarshal(this.ctx, clsLdr);
- if (transferExpiryPlc && expiryPlcBytes != null)
+ if (expiryPlcBytes != null)
expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, clsLdr);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/832657ef/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index cafe643..9627026 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -128,16 +128,6 @@ public class TxEntryValueHolder implements Message {
throws IgniteCheckedException {
if (hasWriteVal && val != null)
val.prepareMarshal(ctx.cacheObjectContext());
-
-// 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());
}
/**
@@ -148,10 +138,6 @@ public class TxEntryValueHolder implements Message {
public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
if (hasWriteVal && val != null)
val.finishUnmarshal(ctx, ldr);
-
-// TODO IGNITE-51.
-// if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled))
-// val = ctx.marshaller().unmarshal(valBytes, ldr);
}
/** {@inheritDoc} */
@@ -184,7 +170,7 @@ public class TxEntryValueHolder implements Message {
writer.incrementState();
case 2:
- if (hasWriteVal && !writer.writeMessage("val", val))
+ if (!writer.writeMessage("val", hasWriteVal ? val : null))
return false;
writer.incrementState();
@@ -223,12 +209,10 @@ public class TxEntryValueHolder implements Message {
reader.incrementState();
case 2:
- if (hasWriteVal) {
- val = reader.readMessage("val");
+ val = reader.readMessage("val");
- if (!reader.isLastRead())
- return false;
- }
+ if (!reader.isLastRead())
+ return false;
reader.incrementState();
[06/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: GridNearTxPrepareResponseOwnedValue to upper level.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: GridNearTxPrepareResponseOwnedValue to upper level.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f138b576
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f138b576
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f138b576
Branch: refs/heads/ignite-51
Commit: f138b5760d081a9521ea28e0437b8f33a5781d6f
Parents: add068f
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:46:58 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:46:58 2015 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 2 +-
.../near/GridNearTxPrepareFuture.java | 6 +-
.../near/GridNearTxPrepareResponse.java | 147 ++----------------
.../GridNearTxPrepareResponseOwnedValue.java | 155 +++++++++++++++++++
4 files changed, 168 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138b576/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 5b0f7dc..2126d86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -545,7 +545,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 99:
- msg = new GridNearTxPrepareResponse.OwnedValue();
+ msg = new GridNearTxPrepareResponseOwnedValue();
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138b576/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 0f39b5e..dc2c11d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -934,7 +934,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
else {
assert F.isEmpty(res.invalidPartitions());
- for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponse.OwnedValue> entry : res.ownedValues().entrySet()) {
+ for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> entry : res.ownedValues().entrySet()) {
IgniteTxEntry txEntry = tx.entry(entry.getKey());
assert txEntry != null;
@@ -946,7 +946,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
if (cacheCtx.isNear()) {
GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
- GridNearTxPrepareResponse.OwnedValue tup = entry.getValue();
+ GridNearTxPrepareResponseOwnedValue tup = entry.getValue();
nearEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion(),
tup.version(), m.node().id());
@@ -954,7 +954,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
else if (txEntry.cached().detached()) {
GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
- GridNearTxPrepareResponse.OwnedValue tup = entry.getValue();
+ GridNearTxPrepareResponseOwnedValue tup = entry.getValue();
detachedEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138b576/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index beb2015..d6819bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -61,7 +61,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** Map of owned values to set on near node. */
@GridToStringInclude
@GridDirectTransient
- private Map<IgniteTxKey, OwnedValue> ownedVals;
+ private Map<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> ownedVals;
/** OwnedVals' keys for marshalling. */
@GridToStringExclude
@@ -70,8 +70,8 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** OwnedVals' values for marshalling. */
@GridToStringExclude
- @GridDirectCollection(OwnedValue.class)
- private Collection<OwnedValue> ownedValVals;
+ @GridDirectCollection(GridNearTxPrepareResponseOwnedValue.class)
+ private Collection<GridNearTxPrepareResponseOwnedValue> ownedValVals;
/** Cache return value. */
@GridDirectTransient
@@ -174,7 +174,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
if (ownedVals == null)
ownedVals = new HashMap<>();
- OwnedValue oVal = new OwnedValue(ver, val);
+ GridNearTxPrepareResponseOwnedValue oVal = new GridNearTxPrepareResponseOwnedValue(ver, val);
ownedVals.put(key, oVal);
}
@@ -182,9 +182,9 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/**
* @return Owned values map.
*/
- public Map<IgniteTxKey, OwnedValue> ownedValues() {
+ public Map<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> ownedValues() {
return ownedVals == null ?
- Collections.<IgniteTxKey, OwnedValue>emptyMap() :
+ Collections.<IgniteTxKey, GridNearTxPrepareResponseOwnedValue>emptyMap() :
Collections.unmodifiableMap(ownedVals);
}
@@ -234,7 +234,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
ownedValVals = ownedVals.values();
- for (Map.Entry<IgniteTxKey, OwnedValue> entry : ownedVals.entrySet()) {
+ for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponseOwnedValue> entry : ownedVals.entrySet()) {
GridCacheContext cacheCtx = ctx.cacheContext(entry.getKey().cacheId());
entry.getKey().prepareMarshal(cacheCtx);
@@ -266,14 +266,14 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator();
- Iterator<OwnedValue> valueIter = ownedValVals.iterator();
+ Iterator<GridNearTxPrepareResponseOwnedValue> valueIter = ownedValVals.iterator();
while (keyIter.hasNext()) {
IgniteTxKey key = keyIter.next();
GridCacheContext cctx = ctx.cacheContext(key.cacheId());
- OwnedValue value = valueIter.next();
+ GridNearTxPrepareResponseOwnedValue value = valueIter.next();
key.finishUnmarshal(cctx, ldr);
@@ -472,133 +472,4 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
return S.toString(GridNearTxPrepareResponse.class, this, "super", super.toString());
}
- /**
- * Message for owned values to set on near node.
- */
- public static class OwnedValue implements Message {
- /** Cache version. */
- private GridCacheVersion vers;
-
- /** Cache object. */
- private CacheObject obj;
-
- /** */
- public OwnedValue() {
- // No-op.
- }
-
- /**
- * @param vers Cache version.
- * @param obj Cache object.
- */
- OwnedValue(GridCacheVersion vers, CacheObject obj) {
- this.vers = vers;
- this.obj = obj;
- }
-
- /**
- * @return Cache version.
- */
- public GridCacheVersion version() {
- return vers;
- }
-
- /**
- * @return Cache object.
- */
- public CacheObject cacheObject() {
- return obj;
- }
-
- /**
- * This method is called before the whole message is sent
- * and is responsible for pre-marshalling state.
- *
- * @param ctx Cache object context.
- * @throws IgniteCheckedException If failed.
- */
- public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
- if (obj != null)
- obj.prepareMarshal(ctx);
- }
-
- /**
- * This method is called after the whole message is recived
- * and is responsible for unmarshalling state.
- *
- * @param ctx Context.
- * @param ldr Class loader.
- * @throws IgniteCheckedException If failed.
- */
- public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
- if (obj != null)
- obj.finishUnmarshal(ctx, ldr);
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 0:
- if (!writer.writeMessage("vers", vers))
- return false;
-
- writer.incrementState();
-
- case 1:
- if (!writer.writeMessage("obj", obj))
- return false;
-
- writer.incrementState();
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- switch (reader.state()) {
- case 0:
- vers = reader.readMessage("vers");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 1:
- obj = reader.readMessage("obj");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public byte directType() {
- return 99;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 2;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138b576/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
new file mode 100644
index 0000000..b833f78
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
@@ -0,0 +1,155 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+
+import java.nio.*;
+
+/**
+ * Message for owned values to set on near node.
+ */
+public class GridNearTxPrepareResponseOwnedValue implements Message {
+ /** Cache version. */
+ private GridCacheVersion vers;
+
+ /** Cache object. */
+ private CacheObject obj;
+
+ /** */
+ public GridNearTxPrepareResponseOwnedValue() {
+ // No-op.
+ }
+
+ /**
+ * @param vers Cache version.
+ * @param obj Cache object.
+ */
+ GridNearTxPrepareResponseOwnedValue(GridCacheVersion vers, CacheObject obj) {
+ this.vers = vers;
+ this.obj = obj;
+ }
+
+ /**
+ * @return Cache version.
+ */
+ public GridCacheVersion version() {
+ return vers;
+ }
+
+ /**
+ * @return Cache object.
+ */
+ public CacheObject cacheObject() {
+ return obj;
+ }
+
+ /**
+ * This method is called before the whole message is sent
+ * and is responsible for pre-marshalling state.
+ *
+ * @param ctx Cache object context.
+ * @throws org.apache.ignite.IgniteCheckedException If failed.
+ */
+ public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ if (obj != null)
+ obj.prepareMarshal(ctx);
+ }
+
+ /**
+ * This method is called after the whole message is recived
+ * and is responsible for unmarshalling state.
+ *
+ * @param ctx Context.
+ * @param ldr Class loader.
+ * @throws org.apache.ignite.IgniteCheckedException If failed.
+ */
+ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ if (obj != null)
+ obj.finishUnmarshal(ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeMessage("vers", vers))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeMessage("obj", obj))
+ return false;
+
+ writer.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ vers = reader.readMessage("vers");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ obj = reader.readMessage("obj");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 99;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 2;
+ }
+}
[13/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: small fixs.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: small fixs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0aedd9ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0aedd9ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0aedd9ce
Branch: refs/heads/ignite-51
Commit: 0aedd9cee143f4c121112217c916c952abcc92eb
Parents: 3d2415a
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 11:41:39 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 11:41:39 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/GridDistributedTxPrepareRequest.java | 6 ++++--
.../internal/processors/cache/transactions/IgniteTxEntry.java | 4 ----
2 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0aedd9ce/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index b94c9ba..5de5e07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -320,9 +320,11 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- unmarshalTx(writes, false, ctx, ldr);
+ if (writes != null)
+ unmarshalTx(writes, false, ctx, ldr);
- unmarshalTx(reads, false, ctx, ldr);
+ if (reads != null)
+ unmarshalTx(reads, false, ctx, ldr);
if (grpLockKeyBytes != null && grpLockKey == null)
grpLockKey = ctx.marshaller().unmarshal(grpLockKeyBytes, ldr);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0aedd9ce/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 cdfe7a6..4ac2ab6 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
@@ -49,10 +49,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** */
private static final long serialVersionUID = 0L;
- /** */
- @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
- private static Object GG_CLASS_ID;
-
/** Owning transaction. */
@GridToStringExclude
@GridDirectTransient
[16/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: small fixs.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: small fixs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3dbf815c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3dbf815c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3dbf815c
Branch: refs/heads/ignite-51
Commit: 3dbf815ca7fab42d9b66e395d14acdb2ee3569f7
Parents: 832657e
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 12:48:06 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 12:48:06 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/IgniteTxEntry.java | 24 ++++----------------
1 file changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbf815c/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 43ea4e5..f85fc37 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
@@ -825,24 +825,18 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 8:
- if (!writer.writeBoolean("transferExpiryPlc", transferExpiryPlc))
- return false;
-
- writer.incrementState();
-
- case 9:
if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
return false;
writer.incrementState();
- case 10:
+ case 9:
if (!writer.writeLong("ttl", ttl))
return false;
writer.incrementState();
- case 11:
+ case 10:
if (!writer.writeMessage("val", val))
return false;
@@ -926,14 +920,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 8:
- transferExpiryPlc = reader.readBoolean("transferExpiryPlc");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 9:
transformClosBytes = reader.readByteArray("transformClosBytes");
if (!reader.isLastRead())
@@ -941,7 +927,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
- case 10:
+ case 9:
ttl = reader.readLong("ttl");
if (!reader.isLastRead())
@@ -949,7 +935,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
- case 11:
+ case 10:
val = reader.readMessage("val");
if (!reader.isLastRead())
@@ -969,7 +955,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 12;
+ return 11;
}
/** {@inheritDoc} */
[11/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: IgniteTxEntry by codegen.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: IgniteTxEntry by codegen.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b3987e76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b3987e76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b3987e76
Branch: refs/heads/ignite-51
Commit: b3987e76ceb7e8a5e55cf531d192f2242297226a
Parents: cc7fab4
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 19:22:06 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 19:22:06 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/IgniteTxEntry.java | 60 ++++++++++++++++----
1 file changed, 48 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3987e76/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 0f30e85..fe9a087 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.transactions;
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.lang.*;
import org.apache.ignite.internal.util.tostring.*;
@@ -146,9 +147,11 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
private ExpiryPolicy expiryPlc;
/** Expiry policy transfer flag. */
- @GridDirectTransient
private boolean transferExpiryPlc;
+ /** Expiry policy bytes. */
+ private byte[] expiryPlcBytes;
+
/**
* Required by {@link Externalizable}
*/
@@ -701,6 +704,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
key.prepareMarshal(context().cacheObjectContext());
val.marshal(ctx, context());
+
+ expiryPlcBytes = transferExpiryPlc ? CU.marshal(ctx, new IgniteExternalizableExpiryPolicy(expiryPlc)) : null;
}
/**
@@ -737,6 +742,9 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
key.finishUnmarshal(context(), clsLdr);
val.unmarshal(this.ctx, clsLdr);
+
+ if (transferExpiryPlc && expiryPlcBytes != null)
+ expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, clsLdr);
}
/**
@@ -784,36 +792,48 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 3:
- if (!writer.writeByteArray("filterBytes", filterBytes))
+ if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
return false;
writer.incrementState();
case 4:
- if (!writer.writeBoolean("grpLock", grpLock))
+ if (!writer.writeByteArray("filterBytes", filterBytes))
return false;
writer.incrementState();
case 5:
- if (!writer.writeMessage("key", key))
+ if (!writer.writeBoolean("grpLock", grpLock))
return false;
writer.incrementState();
case 6:
- if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
+ if (!writer.writeMessage("key", key))
return false;
writer.incrementState();
case 7:
- if (!writer.writeLong("ttl", ttl))
+ if (!writer.writeBoolean("transferExpiryPlc", transferExpiryPlc))
return false;
writer.incrementState();
case 8:
+ if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeLong("ttl", ttl))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
if (!writer.writeMessage("val", val))
return false;
@@ -857,7 +877,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 3:
- filterBytes = reader.readByteArray("filterBytes");
+ expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
if (!reader.isLastRead())
return false;
@@ -865,7 +885,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 4:
- grpLock = reader.readBoolean("grpLock");
+ filterBytes = reader.readByteArray("filterBytes");
if (!reader.isLastRead())
return false;
@@ -873,7 +893,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 5:
- key = reader.readMessage("key");
+ grpLock = reader.readBoolean("grpLock");
if (!reader.isLastRead())
return false;
@@ -881,7 +901,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 6:
- transformClosBytes = reader.readByteArray("transformClosBytes");
+ key = reader.readMessage("key");
if (!reader.isLastRead())
return false;
@@ -889,7 +909,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 7:
- ttl = reader.readLong("ttl");
+ transferExpiryPlc = reader.readBoolean("transferExpiryPlc");
if (!reader.isLastRead())
return false;
@@ -897,6 +917,22 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 8:
+ transformClosBytes = reader.readByteArray("transformClosBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ ttl = reader.readLong("ttl");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 10:
val = reader.readMessage("val");
if (!reader.isLastRead())
@@ -916,7 +952,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 9;
+ return 11;
}
/** {@inheritDoc} */
[19/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: revert filterBytes to IgniteTxEntry, working version.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: revert filterBytes to IgniteTxEntry, working version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/362d073d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/362d073d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/362d073d
Branch: refs/heads/ignite-51
Commit: 362d073d42336f1d30e6f0e671d266ea62bf188c
Parents: 52be74a
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 13:28:08 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 13:28:08 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/IgniteTxEntry.java | 31 +++++++++++++++-----
1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362d073d/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 0d0503f..3c02341 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
@@ -100,8 +100,12 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** Put filters. */
@GridToStringInclude
+ @GridDirectTransient
private CacheEntryPredicate[] filters;
+ /** Filter bytes. */
+ private byte[] filterBytes;
+
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
@GridDirectTransient
private boolean filtersPassed;
@@ -647,6 +651,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
* @param filters Put filters.
*/
public void filters(CacheEntryPredicate[] filters) {
+ filterBytes = null;
+
this.filters = filters;
}
@@ -695,6 +701,11 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
if (transformClosBytes == null && entryProcessorsCol != null)
transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
+ if (F.isEmptyOrNulls(filters))
+ filterBytes = null;
+ else if (filterBytes == null)
+ filterBytes = CU.marshal(ctx, filters);
+
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
@@ -729,12 +740,16 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
if (transformClosBytes != null && entryProcessorsCol == null)
entryProcessorsCol = ctx.marshaller().unmarshal(transformClosBytes, clsLdr);
- if (filters == null)
- filters = CU.empty0();
- else {
- for (CacheEntryPredicate p : filters) {
- if (p != null)
- p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
+ if (filters == null && filterBytes != null) {
+ filters = ctx.marshaller().unmarshal(filterBytes, clsLdr);
+
+ if (filters == null)
+ filters = CU.empty0();
+ else {
+ for (CacheEntryPredicate p : filters) {
+ if (p != null)
+ p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
+ }
}
}
@@ -803,7 +818,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 5:
- if (!writer.writeObjectArray("filters", filters, MessageCollectionItemType.MSG))
+ if (!writer.writeByteArray("filterBytes", filterBytes))
return false;
writer.incrementState();
@@ -892,7 +907,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 5:
- filters = reader.readObjectArray("filters", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+ filterBytes = reader.readByteArray("filterBytes");
if (!reader.isLastRead())
return false;
[02/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ac04da2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ac04da2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ac04da2f
Branch: refs/heads/ignite-51
Commit: ac04da2fa7ba52d0f976b77e25108f1a0b60e0d6
Parents: 4ba6e20
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 17:56:06 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 17:56:06 2015 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 4 +
.../dht/GridDhtTxPrepareRequest.java | 88 +++++---
.../near/GridNearTxPrepareFuture.java | 13 +-
.../near/GridNearTxPrepareResponse.java | 218 ++++++++++++++++---
.../cache/transactions/IgniteTxEntry.java | 70 +-----
.../cache/transactions/IgniteTxKey.java | 14 +-
6 files changed, 251 insertions(+), 156 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 814e380..ccf8395 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -541,6 +541,10 @@ public class GridIoMessageFactory implements MessageFactory {
msg = new IgniteTxEntry.TxEntryValueHolder();
break;
+ case 99:
+ msg = new GridNearTxPrepareResponse.OwnedValue();
+
+ break;
default:
if (ext != null) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --git 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
index ec45af1..de812c9 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
@@ -61,17 +61,16 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
@GridDirectTransient
private Collection<IgniteTxEntry> nearWrites;
- /** Serialized near writes. */
- @GridDirectCollection(byte[].class)
- private Collection<byte[]> nearWritesBytes;
-
/** Owned versions by key. */
@GridToStringInclude
@GridDirectTransient
private Map<IgniteTxKey, GridCacheVersion> owned;
- /** Owned versions bytes. */
- private byte[] ownedBytes;
+ /** Owned keys. */
+ private Collection<IgniteTxKey> ownedKeys;
+
+ /** Owned values. */
+ private Collection<GridCacheVersion> ownedVals;
/** Near transaction ID. */
private GridCacheVersion nearXidVer;
@@ -272,8 +271,13 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- if (ownedBytes == null && owned != null) {
- ownedBytes = CU.marshal(ctx, owned);
+ if (owned != null) {
+ ownedKeys = owned.keySet();
+
+ ownedVals = owned.values();
+
+ for (IgniteTxKey key: ownedKeys)
+ key.prepareMarshal(ctx.cacheContext(key.cacheId()));
if (ctx.deploymentEnabled()) {
for (IgniteTxKey k : owned.keySet())
@@ -281,31 +285,35 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
}
}
- if (nearWrites != null) {
+ if (nearWrites != null)
marshalTx(nearWrites, ctx);
-
- nearWritesBytes = new ArrayList<>(nearWrites.size());
-
- for (IgniteTxEntry e : nearWrites)
- nearWritesBytes.add(ctx.marshaller().marshal(e));
- }
}
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (ownedBytes != null && owned == null)
- owned = ctx.marshaller().unmarshal(ownedBytes, ldr);
+ if (ownedKeys != null && owned == null) {
+ owned = new HashMap<>();
+
+ assert ownedKeys.size() == ownedVals.size();
+
+ Iterator<IgniteTxKey> keyIter = ownedKeys.iterator();
- if (nearWritesBytes != null) {
- nearWrites = new ArrayList<>(nearWritesBytes.size());
+ Iterator<GridCacheVersion> valIter = ownedVals.iterator();
- for (byte[] arr : nearWritesBytes)
- nearWrites.add(ctx.marshaller().<IgniteTxEntry>unmarshal(arr, ldr));
+ while (keyIter.hasNext()) {
+ IgniteTxKey key = keyIter.next();
+
+ key.finishUnmarshal(ctx.cacheContext(key.cacheId()), ldr);
+
+ owned.put(key, valIter.next());
+ }
- unmarshalTx(nearWrites, true, ctx, ldr);
}
+
+ unmarshalTx(nearWrites, true, ctx, ldr);
+
}
/** {@inheritDoc} */
@@ -359,7 +367,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
writer.incrementState();
case 29:
- if (!writer.writeCollection("nearWritesBytes", nearWritesBytes, MessageCollectionItemType.BYTE_ARR))
+ if (!writer.writeCollection("nearWrites", nearWrites, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -371,30 +379,36 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
writer.incrementState();
case 31:
- if (!writer.writeByteArray("ownedBytes", ownedBytes))
+ if (!writer.writeCollection("ownedKeys", ownedKeys, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
case 32:
- if (!writer.writeBitSet("preloadKeys", preloadKeys))
+ if (!writer.writeCollection("ownedVals", ownedVals, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
case 33:
- if (!writer.writeUuid("subjId", subjId))
+ if (!writer.writeBitSet("preloadKeys", preloadKeys))
return false;
writer.incrementState();
case 34:
- if (!writer.writeInt("taskNameHash", taskNameHash))
+ if (!writer.writeUuid("subjId", subjId))
return false;
writer.incrementState();
case 35:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 36:
if (!writer.writeLong("topVer", topVer))
return false;
@@ -457,7 +471,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 29:
- nearWritesBytes = reader.readCollection("nearWritesBytes", MessageCollectionItemType.BYTE_ARR);
+ nearWrites = reader.readCollection("nearWrites", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -473,7 +487,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 31:
- ownedBytes = reader.readByteArray("ownedBytes");
+ ownedKeys = reader.readCollection("ownedKeys", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -481,7 +495,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 32:
- preloadKeys = reader.readBitSet("preloadKeys");
+ ownedVals = reader.readCollection("ownedVals", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -489,7 +503,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 33:
- subjId = reader.readUuid("subjId");
+ preloadKeys = reader.readBitSet("preloadKeys");
if (!reader.isLastRead())
return false;
@@ -497,7 +511,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 34:
- taskNameHash = reader.readInt("taskNameHash");
+ subjId = reader.readUuid("subjId");
if (!reader.isLastRead())
return false;
@@ -505,6 +519,14 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
reader.incrementState();
case 35:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 36:
topVer = reader.readLong("topVer");
if (!reader.isLastRead())
@@ -524,6 +546,6 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 36;
+ return 37;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 9bb3aa7..0f39b5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -33,7 +33,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.transactions.*;
import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -935,7 +934,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
else {
assert F.isEmpty(res.invalidPartitions());
- for (Map.Entry<IgniteTxKey, IgniteBiTuple<GridCacheVersion, CacheObject>> entry : res.ownedValues().entrySet()) {
+ for (Map.Entry<IgniteTxKey, GridNearTxPrepareResponse.OwnedValue> entry : res.ownedValues().entrySet()) {
IgniteTxEntry txEntry = tx.entry(entry.getKey());
assert txEntry != null;
@@ -947,17 +946,17 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
if (cacheCtx.isNear()) {
GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
- IgniteBiTuple<GridCacheVersion, CacheObject> tup = entry.getValue();
+ GridNearTxPrepareResponse.OwnedValue tup = entry.getValue();
- nearEntry.resetFromPrimary(tup.get2(), tx.xidVersion(),
- tup.get1(), m.node().id());
+ nearEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion(),
+ tup.version(), m.node().id());
}
else if (txEntry.cached().detached()) {
GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
- IgniteBiTuple<GridCacheVersion, CacheObject> tup = entry.getValue();
+ GridNearTxPrepareResponse.OwnedValue tup = entry.getValue();
- detachedEntry.resetFromPrimary(tup.get2(), tx.xidVersion());
+ detachedEntry.resetFromPrimary(tup.cacheObject(), tx.xidVersion());
}
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 78cfb73..e30f89c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -23,9 +23,7 @@ import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.distributed.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.plugin.extensions.communication.*;
@@ -63,12 +61,17 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** Map of owned values to set on near node. */
@GridToStringInclude
@GridDirectTransient
- private Map<IgniteTxKey, IgniteBiTuple<GridCacheVersion, CacheObject>> ownedVals;
+ private Map<IgniteTxKey, OwnedValue> ownedVals;
- /** Marshalled owned bytes. */
+ /** OwnedVals' keys for marshalling. */
@GridToStringExclude
- @GridDirectCollection(byte[].class)
- private Collection<byte[]> ownedValsBytes;
+ @GridDirectTransient
+ private Collection<IgniteTxKey> ownedValKeys;
+
+ /** OwnedVals' values for marshalling. */
+ @GridToStringExclude
+ @GridDirectTransient
+ private Collection<OwnedValue> ownedValVals;
/** Cache return value. */
@GridDirectTransient
@@ -171,15 +174,19 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
if (ownedVals == null)
ownedVals = new HashMap<>();
- ownedVals.put(key, F.t(ver, val));
+ OwnedValue oVal = new OwnedValue();
+
+ oVal.init(ver, val);
+
+ ownedVals.put(key, oVal);
}
/**
* @return Owned values map.
*/
- public Map<IgniteTxKey, IgniteBiTuple<GridCacheVersion, CacheObject>> ownedValues() {
+ public Map<IgniteTxKey, OwnedValue> ownedValues() {
return ownedVals == null ?
- Collections.<IgniteTxKey, IgniteBiTuple<GridCacheVersion, CacheObject>>emptyMap() :
+ Collections.<IgniteTxKey, OwnedValue>emptyMap() :
Collections.unmodifiableMap(ownedVals);
}
@@ -224,22 +231,19 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- if (ownedVals != null && ownedValsBytes == null) {
- ownedValsBytes = new ArrayList<>(ownedVals.size());
-
- for (Map.Entry<IgniteTxKey, IgniteBiTuple<GridCacheVersion, CacheObject>> entry : ownedVals.entrySet()) {
- IgniteBiTuple<GridCacheVersion, CacheObject> tup = entry.getValue();
+ if (ownedVals != null) {
+ ownedValKeys = ownedVals.keySet();
- GridCacheContext cctx = ctx.cacheContext(entry.getKey().cacheId());
+ ownedValVals = ownedVals.values();
- entry.getKey().prepareMarshal(cctx);
+ for (IgniteTxKey key : ownedVals.keySet()) {
+ GridCacheContext cacheCtx = ctx.cacheContext(key.cacheId());
- CacheObject val = tup.get2();
+ OwnedValue value = ownedVals.get(key);
- if (val != null)
- val.prepareMarshal(cctx.cacheObjectContext());
+ key.prepareMarshal(cacheCtx);
- ownedValsBytes.add(ctx.marshaller().marshal(F.t(entry.getKey(), tup.get1(), val)));
+ value.prepareMarshal(cacheCtx.cacheObjectContext());
}
}
@@ -259,22 +263,27 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (ownedValsBytes != null && ownedVals == null) {
+ if (ownedValKeys != null && ownedVals == null) {
ownedVals = new HashMap<>();
- for (byte[] bytes : ownedValsBytes) {
- GridTuple3<IgniteTxKey, GridCacheVersion, CacheObject> tup = ctx.marshaller().unmarshal(bytes, ldr);
+ assert ownedValKeys.size() == ownedValVals.size();
- CacheObject val = tup.get3();
+ Iterator<IgniteTxKey> keyIter = ownedValKeys.iterator();
- GridCacheContext cctx = ctx.cacheContext(tup.get1().cacheId());
+ Iterator<OwnedValue> valueIter = ownedValVals.iterator();
- tup.get1().finishUnmarshal(cctx, ldr);
+ while (keyIter.hasNext()) {
+ IgniteTxKey key = keyIter.next();
+
+ GridCacheContext cctx = ctx.cacheContext(key.cacheId());
- if (val != null)
- val.finishUnmarshal(cctx, ldr);
+ OwnedValue value = valueIter.next();
- ownedVals.put(tup.get1(), F.t(tup.get2(), val));
+ key.finishUnmarshal(cctx, ldr);
+
+ value.finishUnmarshal(cctx, ldr);
+
+ ownedVals.put(key, value);
}
}
@@ -336,18 +345,24 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
writer.incrementState();
case 15:
- if (!writer.writeCollection("ownedValsBytes", ownedValsBytes, MessageCollectionItemType.BYTE_ARR))
+ if (!writer.writeCollection("ownedValKeys", ownedValKeys, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
case 16:
- if (!writer.writeCollection("pending", pending, MessageCollectionItemType.MSG))
+ if (!writer.writeCollection("ownedValVals", ownedValVals, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
case 17:
+ if (!writer.writeCollection("pending", pending, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 18:
if (!writer.writeByteArray("retValBytes", retValBytes))
return false;
@@ -410,7 +425,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
reader.incrementState();
case 15:
- ownedValsBytes = reader.readCollection("ownedValsBytes", MessageCollectionItemType.BYTE_ARR);
+ ownedValKeys = reader.readCollection("ownedValKeys", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -418,7 +433,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
reader.incrementState();
case 16:
- pending = reader.readCollection("pending", MessageCollectionItemType.MSG);
+ ownedValVals = reader.readCollection("ownedValVals", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
return false;
@@ -426,6 +441,14 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
reader.incrementState();
case 17:
+ pending = reader.readCollection("pending", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 18:
retValBytes = reader.readByteArray("retValBytes");
if (!reader.isLastRead())
@@ -445,11 +468,138 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 18;
+ return 19;
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridNearTxPrepareResponse.class, this, "super", super.toString());
}
+
+ /**
+ * Message for owned values to set on near node.
+ */
+ public static class OwnedValue implements Message {
+ /** Cache version. */
+ private GridCacheVersion vers;
+
+ /** Cache object. */
+ private CacheObject obj;
+
+ /**
+ * Initialize OwnedValues.
+ *
+ * @param vers Cache version.
+ * @param obj Cache object.
+ */
+ void init(GridCacheVersion vers, CacheObject obj) {
+ this.vers = vers;
+ this.obj = obj;
+ }
+
+ /**
+ * @return Cache version.
+ */
+ public GridCacheVersion version() {
+ return vers;
+ }
+
+ /**
+ * @return Cache object.
+ */
+ public CacheObject cacheObject() {
+ return obj;
+ }
+
+ /**
+ * This method is called before the whole message is sent
+ * and is responsible for pre-marshalling state.
+ *
+ * @param ctx Cache object context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ if (obj != null)
+ obj.prepareMarshal(ctx);
+ }
+
+ /**
+ * This method is called after the whole message is recived
+ * and is responsible for unmarshalling state.
+ *
+ * @param ctx Context.
+ * @param ldr Class loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ if (obj != null)
+ obj.finishUnmarshal(ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeMessage("vers", vers))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeMessage("obj", obj))
+ return false;
+
+ writer.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ vers = reader.readMessage("vers");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ obj = reader.readMessage("obj");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 99;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 2;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/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 367c586..e763444 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
@@ -45,7 +45,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
* {@link #equals(Object)} method, as transaction entries should use referential
* equality.
*/
-public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Message, OptimizedMarshallable {
+public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMarshallable {
/** */
private static final long serialVersionUID = 0L;
@@ -931,74 +931,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Externalizable, Messa
return GridToStringBuilder.toString(IgniteTxEntry.class, this, "xidVer", tx == null ? "null" : tx.xidVersion());
}
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeBoolean(depEnabled);
-
- if (depEnabled) {
- U.writeByteArray(out, transformClosBytes);
- U.writeByteArray(out, filterBytes);
- }
- else {
- U.writeCollection(out, entryProcessorsCol);
- U.writeArray(out, filters);
- }
-
- out.writeObject(key);
-
- out.writeInt(cacheId);
-
- val.writeTo(out);
-
- out.writeLong(ttl);
-
- CU.writeVersion(out, explicitVer);
- out.writeBoolean(grpLock);
-
- if (conflictExpireTime != CU.EXPIRE_TIME_CALCULATE) {
- out.writeBoolean(true);
- out.writeLong(conflictExpireTime);
- }
- else
- out.writeBoolean(false);
-
- 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) {
- transformClosBytes = U.readByteArray(in);
- filterBytes = U.readByteArray(in);
- }
- else {
- entryProcessorsCol = U.readCollection(in);
- filters = GridCacheUtils.readEntryFilterArray(in);
- }
-
- key = (KeyCacheObject)in.readObject();
-
- cacheId = in.readInt();
-
- val.readFrom(in);
-
- ttl = in.readLong();
-
- explicitVer = CU.readVersion(in);
- grpLock = in.readBoolean();
-
- conflictExpireTime = in.readBoolean() ? in.readLong() : CU.EXPIRE_TIME_CALCULATE;
- conflictVer = CU.readVersion(in);
-
- expiryPlc = (ExpiryPolicy)in.readObject();
- }
-
/**
* Auxiliary class to hold value, value-has-been-set flag, value update operation, value bytes.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac04da2f/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 3062647..7d10a66 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
@@ -30,7 +30,7 @@ import java.nio.*;
* Cache transaction key. This wrapper is needed because same keys may be enlisted in the same transaction
* for multiple caches.
*/
-public class IgniteTxKey implements Externalizable, Message {
+public class IgniteTxKey implements Message {
/** */
private static final long serialVersionUID = 0L;
@@ -181,18 +181,6 @@ public class IgniteTxKey implements Externalizable, Message {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(cacheId);
- out.writeObject(key);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- cacheId = in.readInt();
- key = (KeyCacheObject)in.readObject();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(IgniteTxKey.class, this);
}
[05/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: add Javadoc for codegen.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: add Javadoc for codegen.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/add068f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/add068f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/add068f1
Branch: refs/heads/ignite-51
Commit: add068f1809bffb9580d35ae156b1b8801c972e1
Parents: 5c26926
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:42:44 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:42:44 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/GridDistributedTxPrepareRequest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/add068f1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 0b130aa..b94c9ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -66,7 +66,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
/** Transaction read set. */
@GridToStringInclude
- @GridDirectTransient
+ @GridDirectCollection(IgniteTxEntry.class)
private Collection<IgniteTxEntry> reads;
/** Transaction write entries. */
[08/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: TxEntryValueHolder to upper level.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: TxEntryValueHolder to upper level.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/22df51c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/22df51c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/22df51c8
Branch: refs/heads/ignite-51
Commit: 22df51c8b866585c838f22b3e664f837a8a976e1
Parents: 8d617ea
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:52:29 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:52:29 2015 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 2 +-
.../cache/transactions/IgniteTxEntry.java | 292 +----------------
.../cache/transactions/TxEntryValueHolder.java | 319 +++++++++++++++++++
3 files changed, 323 insertions(+), 290 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/22df51c8/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 2126d86..f12a9bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -540,7 +540,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 98:
- msg = new IgniteTxEntry.TxEntryValueHolder();
+ msg = new TxEntryValueHolder();
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/22df51c8/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 03f70db..7d6e637 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
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.transactions;
import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.util.lang.*;
@@ -79,6 +80,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
/** Transform. */
@GridToStringInclude
+ @GridDirectTransient
private Collection<T2<EntryProcessor<Object, Object, Object>, Object[]>> entryProcessorsCol;
/** Transform closure bytes. */
@@ -103,6 +105,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
/** Put filters. */
@GridToStringInclude
+ @GridDirectTransient
private IgnitePredicate<Cache.Entry<Object, Object>>[] filters;
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
@@ -930,293 +933,4 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
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.
- */
- public static class TxEntryValueHolder implements Message {
- /** */
- @GridToStringInclude
- private CacheObject val;
-
- /** */
- @GridToStringInclude
- private GridCacheOperation op = NOOP;
-
- /** Flag indicating that value has been set for write. */
- private boolean hasWriteVal;
-
- /** Flag indicating that value has been set for read. */
- private boolean hasReadVal;
-
- /**
- * @param op Cache operation.
- * @param val Value.
- * @param hasWriteVal Write value presence flag.
- * @param hasReadVal Read value presence flag.
- */
- public void value(GridCacheOperation op, CacheObject val, boolean hasWriteVal, boolean hasReadVal) {
- if (hasReadVal && this.hasWriteVal)
- return;
-
- this.op = op;
- this.val = val;
-
- this.hasWriteVal = hasWriteVal || op == CREATE || op == UPDATE || op == DELETE;
- this.hasReadVal = hasReadVal || op == READ;
- }
-
- /**
- * @return {@code True} if has read or write value.
- */
- public boolean hasValue() {
- return hasWriteVal || hasReadVal;
- }
-
- /**
- * Gets stored value.
- *
- * @return Value.
- */
- public CacheObject value() {
- return val;
- }
-
- /**
- * @param val Stored value.
- */
- public void value(@Nullable CacheObject val) {
- this.val = val;
- }
-
- /**
- * Gets cache operation.
- *
- * @return Cache operation.
- */
- public GridCacheOperation op() {
- return op;
- }
-
- /**
- * Sets cache operation.
- *
- * @param op Cache operation.
- */
- public void op(GridCacheOperation op) {
- this.op = op;
- }
-
- /**
- * @return {@code True} if write value was set.
- */
- public boolean hasWriteValue() {
- return hasWriteVal;
- }
-
- /**
- * @return {@code True} if read value was set.
- */
- public boolean hasReadValue() {
- return hasReadVal;
- }
-
- /**
- * @param sharedCtx Shared cache context.
- * @param ctx Cache context.
- * @param depEnabled Deployment enabled flag.
- * @throws IgniteCheckedException If marshaling failed.
- */
- public void marshal(GridCacheSharedContext<?, ?> sharedCtx, GridCacheContext<?, ?> ctx, boolean depEnabled)
- throws IgniteCheckedException {
- if (hasWriteVal && val != null)
- val.prepareMarshal(ctx.cacheObjectContext());
-
-// 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());
- }
-
- /**
- * @param ctx Cache context.
- * @param ldr Class loader.
- * @param depEnabled Deployment enabled flag.
- * @throws IgniteCheckedException If unmarshalling failed.
- */
- public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException {
- if (val != null)
- val.finishUnmarshal(ctx, ldr);
-
-// TODO IGNITE-51.
-// if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled))
-// val = ctx.marshaller().unmarshal(valBytes, ldr);
- }
-
- /**
- * @param out Data output.
- * @throws IOException If failed.
- */
- public void writeTo(ObjectOutput out) throws IOException {
- out.writeBoolean(hasWriteVal);
-
- if (hasWriteVal)
- 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());
- }
-
- /**
- * @param in Data input.
- * @throws IOException If failed.
- * @throws ClassNotFoundException If failed.
- */
- @SuppressWarnings("unchecked")
- public void readFrom(ObjectInput in) throws IOException, ClassNotFoundException {
- hasWriteVal = in.readBoolean();
-
- if (hasWriteVal)
- val = (CacheObject)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 + ']';
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 0:
- if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
- return false;
-
- writer.incrementState();
-
- case 1:
- if (!writer.writeBoolean("hasReadVal", hasReadVal))
- return false;
-
- writer.incrementState();
-
- case 2:
- if (!writer.writeInt("op", op.ordinal()))
- return false;
-
- writer.incrementState();
- case 3:
- if (!writer.writeMessage("cacheObject", val))
- return false;
-
- writer.incrementState();
-
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- switch (reader.state()) {
- case 0:
- hasWriteVal = reader.readBoolean("hasWriteVal");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 1:
- hasReadVal = reader.readBoolean("hasReadVal");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
- case 2:
- op = GridCacheOperation.fromOrdinal(reader.readInt("op"));
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 3:
- val = reader.readMessage("cacheObject");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public byte directType() {
- return 98;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 4;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/22df51c8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
new file mode 100644
index 0000000..c1c759f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -0,0 +1,319 @@
+/*
+ * 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.transactions;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.nio.*;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+
+/**
+ * Auxiliary class to hold value, value-has-been-set flag, value update operation, value bytes.
+ */
+public class TxEntryValueHolder implements Message {
+ /** */
+ @GridToStringInclude
+ private CacheObject val;
+
+ /** */
+ @GridToStringInclude
+ private GridCacheOperation op = NOOP;
+
+ /** Flag indicating that value has been set for write. */
+ private boolean hasWriteVal;
+
+ /** Flag indicating that value has been set for read. */
+ private boolean hasReadVal;
+
+ /**
+ * @param op Cache operation.
+ * @param val Value.
+ * @param hasWriteVal Write value presence flag.
+ * @param hasReadVal Read value presence flag.
+ */
+ public void value(GridCacheOperation op, CacheObject val, boolean hasWriteVal, boolean hasReadVal) {
+ if (hasReadVal && this.hasWriteVal)
+ return;
+
+ this.op = op;
+ this.val = val;
+
+ this.hasWriteVal = hasWriteVal || op == CREATE || op == UPDATE || op == DELETE;
+ this.hasReadVal = hasReadVal || op == READ;
+ }
+
+ /**
+ * @return {@code True} if has read or write value.
+ */
+ public boolean hasValue() {
+ return hasWriteVal || hasReadVal;
+ }
+
+ /**
+ * Gets stored value.
+ *
+ * @return Value.
+ */
+ public CacheObject value() {
+ return val;
+ }
+
+ /**
+ * @param val Stored value.
+ */
+ public void value(@Nullable CacheObject val) {
+ this.val = val;
+ }
+
+ /**
+ * Gets cache operation.
+ *
+ * @return Cache operation.
+ */
+ public GridCacheOperation op() {
+ return op;
+ }
+
+ /**
+ * Sets cache operation.
+ *
+ * @param op Cache operation.
+ */
+ public void op(GridCacheOperation op) {
+ this.op = op;
+ }
+
+ /**
+ * @return {@code True} if write value was set.
+ */
+ public boolean hasWriteValue() {
+ return hasWriteVal;
+ }
+
+ /**
+ * @return {@code True} if read value was set.
+ */
+ public boolean hasReadValue() {
+ return hasReadVal;
+ }
+
+ /**
+ * @param sharedCtx Shared cache context.
+ * @param ctx Cache context.
+ * @param depEnabled Deployment enabled flag.
+ * @throws org.apache.ignite.IgniteCheckedException If marshaling failed.
+ */
+ public void marshal(GridCacheSharedContext<?, ?> sharedCtx, GridCacheContext<?, ?> ctx, boolean depEnabled)
+ throws IgniteCheckedException {
+ if (hasWriteVal && val != null)
+ val.prepareMarshal(ctx.cacheObjectContext());
+
+// 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());
+ }
+
+ /**
+ * @param ctx Cache context.
+ * @param ldr Class loader.
+ * @param depEnabled Deployment enabled flag.
+ * @throws org.apache.ignite.IgniteCheckedException If unmarshalling failed.
+ */
+ public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException {
+ if (val != null)
+ val.finishUnmarshal(ctx, ldr);
+
+// TODO IGNITE-51.
+// if (valBytes != null && val == null && (ctx.isUnmarshalValues() || op == TRANSFORM || depEnabled))
+// val = ctx.marshaller().unmarshal(valBytes, ldr);
+ }
+
+ /**
+ * @param out Data output.
+ * @throws java.io.IOException If failed.
+ */
+ public void writeTo(ObjectOutput out) throws IOException {
+ out.writeBoolean(hasWriteVal);
+
+ if (hasWriteVal)
+ 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());
+ }
+
+ /**
+ * @param in Data input.
+ * @throws java.io.IOException If failed.
+ * @throws ClassNotFoundException If failed.
+ */
+ @SuppressWarnings("unchecked")
+ public void readFrom(ObjectInput in) throws IOException, ClassNotFoundException {
+ hasWriteVal = in.readBoolean();
+
+ if (hasWriteVal)
+ val = (CacheObject)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 + ']';
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeBoolean("hasReadVal", hasReadVal))
+ return false;
+
+ writer.incrementState();
+
+ case 2:
+ if (!writer.writeInt("op", op.ordinal()))
+ return false;
+
+ writer.incrementState();
+ case 3:
+ if (!writer.writeMessage("cacheObject", val))
+ return false;
+
+ writer.incrementState();
+
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ hasWriteVal = reader.readBoolean("hasWriteVal");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ hasReadVal = reader.readBoolean("hasReadVal");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+ case 2:
+ op = GridCacheOperation.fromOrdinal(reader.readInt("op"));
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 3:
+ val = reader.readMessage("cacheObject");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 98;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 4;
+ }
+}
[12/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: IgniteTxEntry by codegen.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: IgniteTxEntry by codegen.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3d2415af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3d2415af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3d2415af
Branch: refs/heads/ignite-51
Commit: 3d2415af4b7cd77eaeeaa100de95d6a0e92ac88d
Parents: b3987e7
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 19:23:50 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 19:23:50 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/IgniteTxEntry.java | 41 +++++++++++++-------
1 file changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d2415af/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 fe9a087..cdfe7a6 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
@@ -101,7 +101,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** Explicit lock version if there is one. */
@GridToStringInclude
- @GridDirectTransient
private GridCacheVersion explicitVer;
/** DHT version. */
@@ -798,42 +797,48 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 4:
- if (!writer.writeByteArray("filterBytes", filterBytes))
+ if (!writer.writeMessage("explicitVer", explicitVer))
return false;
writer.incrementState();
case 5:
- if (!writer.writeBoolean("grpLock", grpLock))
+ if (!writer.writeByteArray("filterBytes", filterBytes))
return false;
writer.incrementState();
case 6:
- if (!writer.writeMessage("key", key))
+ if (!writer.writeBoolean("grpLock", grpLock))
return false;
writer.incrementState();
case 7:
- if (!writer.writeBoolean("transferExpiryPlc", transferExpiryPlc))
+ if (!writer.writeMessage("key", key))
return false;
writer.incrementState();
case 8:
- if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
+ if (!writer.writeBoolean("transferExpiryPlc", transferExpiryPlc))
return false;
writer.incrementState();
case 9:
- if (!writer.writeLong("ttl", ttl))
+ if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
return false;
writer.incrementState();
case 10:
+ if (!writer.writeLong("ttl", ttl))
+ return false;
+
+ writer.incrementState();
+
+ case 11:
if (!writer.writeMessage("val", val))
return false;
@@ -885,7 +890,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 4:
- filterBytes = reader.readByteArray("filterBytes");
+ explicitVer = reader.readMessage("explicitVer");
if (!reader.isLastRead())
return false;
@@ -893,7 +898,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 5:
- grpLock = reader.readBoolean("grpLock");
+ filterBytes = reader.readByteArray("filterBytes");
if (!reader.isLastRead())
return false;
@@ -901,7 +906,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 6:
- key = reader.readMessage("key");
+ grpLock = reader.readBoolean("grpLock");
if (!reader.isLastRead())
return false;
@@ -909,7 +914,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 7:
- transferExpiryPlc = reader.readBoolean("transferExpiryPlc");
+ key = reader.readMessage("key");
if (!reader.isLastRead())
return false;
@@ -917,7 +922,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 8:
- transformClosBytes = reader.readByteArray("transformClosBytes");
+ transferExpiryPlc = reader.readBoolean("transferExpiryPlc");
if (!reader.isLastRead())
return false;
@@ -925,7 +930,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 9:
- ttl = reader.readLong("ttl");
+ transformClosBytes = reader.readByteArray("transformClosBytes");
if (!reader.isLastRead())
return false;
@@ -933,6 +938,14 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 10:
+ ttl = reader.readLong("ttl");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 11:
val = reader.readMessage("val");
if (!reader.isLastRead())
@@ -952,7 +965,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 11;
+ return 12;
}
/** {@inheritDoc} */
[10/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: IgniteTxEntry by codegen.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: IgniteTxEntry by codegen.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cc7fab49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cc7fab49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cc7fab49
Branch: refs/heads/ignite-51
Commit: cc7fab49ec5001d04f58e8298549c3d0c073f7c2
Parents: 954777c
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 19:09:22 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 19:09:22 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/IgniteTxEntry.java | 111 ++++++++++---------
.../cache/transactions/TxEntryValueHolder.java | 37 ++-----
2 files changed, 71 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc7fab49/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 7d6e637..0f30e85 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
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
@@ -45,7 +44,7 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
* {@link #equals(Object)} method, as transaction entries should use referential
* equality.
*/
-public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMarshallable {
+public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** */
private static final long serialVersionUID = 0L;
@@ -55,6 +54,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
/** Owning transaction. */
@GridToStringExclude
+ @GridDirectTransient
private IgniteInternalTx tx;
/** Cache key. */
@@ -65,6 +65,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
private int cacheId;
/** Transient tx key. */
+ @GridDirectTransient
private IgniteTxKey txKey;
/** Cache value. */
@@ -73,6 +74,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
/** Visible value for peek. */
@GridToStringInclude
+ @GridDirectTransient
private TxEntryValueHolder prevVal = new TxEntryValueHolder();
/** Filter bytes. */
@@ -98,6 +100,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
/** Explicit lock version if there is one. */
@GridToStringInclude
+ @GridDirectTransient
private GridCacheVersion explicitVer;
/** DHT version. */
@@ -109,6 +112,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
private IgnitePredicate<Cache.Entry<Object, Object>>[] filters;
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
+ @GridDirectTransient
private boolean filtersPassed;
/** Flag indicating that filter is set and can not be replaced. */
@@ -131,18 +135,18 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
private transient UUID nodeId;
/** Flag if this node is a back up node. */
+ @GridDirectTransient
private boolean locMapped;
/** Group lock entry flag. */
private boolean grpLock;
- /** Deployment enabled flag. */
- private boolean depEnabled = true;
-
/** Expiry policy. */
+ @GridDirectTransient
private ExpiryPolicy expiryPlc;
/** Expiry policy transfer flag. */
+ @GridDirectTransient
private boolean transferExpiryPlc;
/**
@@ -188,8 +192,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
key = entry.key();
cacheId = entry.context().cacheId();
-
- depEnabled = ctx.gridDeploy().enabled();
}
/**
@@ -235,8 +237,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
key = entry.key();
cacheId = entry.context().cacheId();
-
- depEnabled = ctx.gridDeploy().enabled();
}
/**
@@ -296,7 +296,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
cp.conflictExpireTime = conflictExpireTime;
cp.explicitVer = explicitVer;
cp.grpLock = grpLock;
- cp.depEnabled = depEnabled;
cp.conflictVer = conflictVer;
cp.expiryPlc = expiryPlc;
@@ -688,22 +687,20 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
*/
public void marshal(GridCacheSharedContext<?, ?> ctx, boolean transferExpiry) throws IgniteCheckedException {
// Do not serialize filters if they are null.
- if (depEnabled) {
- if (transformClosBytes == null && entryProcessorsCol != null)
- transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
-
- if (F.isEmptyOrNulls(filters))
- filterBytes = null;
- else if (filterBytes == null)
- filterBytes = CU.marshal(ctx, filters);
- }
+ if (transformClosBytes == null && entryProcessorsCol != null)
+ transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
+
+ if (F.isEmptyOrNulls(filters))
+ filterBytes = null;
+ else if (filterBytes == null)
+ filterBytes = CU.marshal(ctx, filters);
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
key.prepareMarshal(context().cacheObjectContext());
- val.marshal(ctx, context(), depEnabled);
+ val.marshal(ctx, context());
}
/**
@@ -726,22 +723,20 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
this.ctx = cacheCtx;
}
- if (depEnabled) {
- // Unmarshal transform closure anyway if it exists.
- if (transformClosBytes != null && entryProcessorsCol == null)
- entryProcessorsCol = ctx.marshaller().unmarshal(transformClosBytes, 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 && filterBytes != null) {
+ filters = ctx.marshaller().unmarshal(filterBytes, clsLdr);
- if (filters == null)
- filters = CU.empty();
- }
+ if (filters == null)
+ filters = CU.empty();
}
key.finishUnmarshal(context(), clsLdr);
- val.unmarshal(this.ctx, clsLdr, depEnabled);
+ val.unmarshal(this.ctx, clsLdr);
}
/**
@@ -771,50 +766,59 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
switch (writer.state()) {
case 0:
- if (!writer.writeMessage("key", key))
+ if (!writer.writeInt("cacheId", cacheId))
return false;
writer.incrementState();
+
case 1:
- if (!writer.writeInt("cacheId", cacheId))
+ if (!writer.writeLong("conflictExpireTime", conflictExpireTime))
return false;
writer.incrementState();
+
case 2:
- if (!writer.writeMessage("val", val))
+ if (!writer.writeMessage("conflictVer", conflictVer))
return false;
writer.incrementState();
+
case 3:
- if (!writer.writeLong("ttl", ttl))
+ if (!writer.writeByteArray("filterBytes", filterBytes))
return false;
writer.incrementState();
+
case 4:
- if (!writer.writeMessage("conflictVer", conflictVer))
+ if (!writer.writeBoolean("grpLock", grpLock))
return false;
writer.incrementState();
+
case 5:
- if (!writer.writeBoolean("grpLock", grpLock))
+ if (!writer.writeMessage("key", key))
return false;
writer.incrementState();
+
case 6:
if (!writer.writeByteArray("transformClosBytes", transformClosBytes))
return false;
writer.incrementState();
+
case 7:
- if (!writer.writeByteArray("filterBytes", filterBytes))
+ if (!writer.writeLong("ttl", ttl))
return false;
writer.incrementState();
+
case 8:
- if (!(writer.writeLong("conflictExpireTime", conflictExpireTime)))
+ if (!writer.writeMessage("val", val))
return false;
writer.incrementState();
+
}
return true;
@@ -829,46 +833,53 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
switch (reader.state()) {
case 0:
- key = reader.readMessage("key");
+ cacheId = reader.readInt("cacheId");
+
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 1:
- cacheId = reader.readInt("cacheId");
+ conflictExpireTime = reader.readLong("conflictExpireTime");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 2:
- val = reader.readMessage("val");
+ conflictVer = reader.readMessage("conflictVer");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 3:
- ttl = reader.readLong("ttl");
+ filterBytes = reader.readByteArray("filterBytes");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 4:
- conflictVer = reader.readMessage("conflictVer");
+ grpLock = reader.readBoolean("grpLock");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 5:
- grpLock = reader.readBoolean("grpLock");
+ key = reader.readMessage("key");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 6:
transformClosBytes = reader.readByteArray("transformClosBytes");
@@ -876,22 +887,23 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
return false;
reader.incrementState();
+
case 7:
- filterBytes = reader.readByteArray("filterBytes");
+ ttl = reader.readLong("ttl");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 8:
- conflictExpireTime = reader.readLong("conflictExpireTime");
+ val = reader.readMessage("val");
if (!reader.isLastRead())
return false;
reader.incrementState();
-
}
return true;
@@ -908,11 +920,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message, OptimizedMar
}
/** {@inheritDoc} */
- @Override public Object ggClassId() {
- return GG_CLASS_ID;
- }
-
- /** {@inheritDoc} */
@Override public Class<?> deployClass() {
ClassLoader clsLdr = getClass().getClassLoader();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc7fab49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 5a4689c..2cd0c37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.transactions;
import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.plugin.extensions.communication.*;
@@ -44,6 +45,7 @@ public class TxEntryValueHolder implements Message {
private boolean hasWriteVal;
/** Flag indicating that value has been set for read. */
+ @GridDirectTransient
private boolean hasReadVal;
/**
@@ -121,10 +123,9 @@ public class TxEntryValueHolder implements Message {
/**
* @param sharedCtx Shared cache context.
* @param ctx Cache context.
- * @param depEnabled Deployment enabled flag.
* @throws org.apache.ignite.IgniteCheckedException If marshaling failed.
*/
- public void marshal(GridCacheSharedContext<?, ?> sharedCtx, GridCacheContext<?, ?> ctx, boolean depEnabled)
+ public void marshal(GridCacheSharedContext<?, ?> sharedCtx, GridCacheContext<?, ?> ctx)
throws IgniteCheckedException {
if (hasWriteVal && val != null)
val.prepareMarshal(ctx.cacheObjectContext());
@@ -143,10 +144,9 @@ public class TxEntryValueHolder implements Message {
/**
* @param ctx Cache context.
* @param ldr Class loader.
- * @param depEnabled Deployment enabled flag.
* @throws org.apache.ignite.IgniteCheckedException If unmarshalling failed.
*/
- public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr, boolean depEnabled) throws IgniteCheckedException {
+ public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
if (val != null)
val.finishUnmarshal(ctx, ldr);
@@ -235,24 +235,18 @@ public class TxEntryValueHolder implements Message {
switch (writer.state()) {
case 0:
- if (!writer.writeBoolean("hasReadVal", hasReadVal))
- return false;
-
- writer.incrementState();
-
- case 1:
if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
return false;
writer.incrementState();
- case 2:
+ case 1:
if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
return false;
writer.incrementState();
- case 3:
+ case 2:
if (!writer.writeMessage("val", val))
return false;
@@ -272,7 +266,7 @@ public class TxEntryValueHolder implements Message {
switch (reader.state()) {
case 0:
- hasReadVal = reader.readBoolean("hasReadVal");
+ hasWriteVal = reader.readBoolean("hasWriteVal");
if (!reader.isLastRead())
return false;
@@ -280,25 +274,18 @@ public class TxEntryValueHolder implements Message {
reader.incrementState();
case 1:
- hasWriteVal = reader.readBoolean("hasWriteVal");
-
- if (!reader.isLastRead())
- return false;
+ byte opOrd;
- reader.incrementState();
-
- case 2:
- byte opOrd = reader.readByte("op");
+ opOrd = reader.readByte("op");
if (!reader.isLastRead())
return false;
- if (opOrd != -1)
- op = GridCacheOperation.fromOrdinal(opOrd);
+ op = GridCacheOperation.fromOrdinal(opOrd);
reader.incrementState();
- case 3:
+ case 2:
val = reader.readMessage("val");
if (!reader.isLastRead())
@@ -318,6 +305,6 @@ public class TxEntryValueHolder implements Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 4;
+ return 3;
}
}
[03/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1cf7527
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1cf7527
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1cf7527
Branch: refs/heads/ignite-51
Commit: e1cf7527ed0c4a861b4cd87d9d3f461819df02fc
Parents: ac04da2
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:28:14 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:28:14 2015 +0300
----------------------------------------------------------------------
.../managers/communication/GridIoMessageFactory.java | 3 +++
.../cache/distributed/dht/GridDhtTxPrepareRequest.java | 9 +++++----
.../cache/distributed/near/GridNearTxPrepareResponse.java | 10 ++++++----
.../processors/cache/transactions/IgniteTxEntry.java | 1 -
.../processors/cache/transactions/IgniteTxKey.java | 3 ---
5 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1cf7527/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index ccf8395..5b0f7dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -533,14 +533,17 @@ public class GridIoMessageFactory implements MessageFactory {
msg = new CacheContinuousQueryEntry();
break;
+
case 97:
msg = new IgniteTxEntry();
break;
+
case 98:
msg = new IgniteTxEntry.TxEntryValueHolder();
break;
+
case 99:
msg = new GridNearTxPrepareResponse.OwnedValue();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1cf7527/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --git 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
index de812c9..19533eb 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
@@ -58,7 +58,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
/** Near writes. */
@GridToStringInclude
- @GridDirectTransient
+ @GridDirectCollection(IgniteTxEntry.class)
private Collection<IgniteTxEntry> nearWrites;
/** Owned versions by key. */
@@ -67,9 +67,11 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
private Map<IgniteTxKey, GridCacheVersion> owned;
/** Owned keys. */
+ @GridDirectCollection(IgniteTxKey.class)
private Collection<IgniteTxKey> ownedKeys;
/** Owned values. */
+ @GridDirectCollection(GridCacheVersion.class)
private Collection<GridCacheVersion> ownedVals;
/** Near transaction ID. */
@@ -294,10 +296,10 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
super.finishUnmarshal(ctx, ldr);
if (ownedKeys != null && owned == null) {
- owned = new HashMap<>();
-
assert ownedKeys.size() == ownedVals.size();
+ owned = U.newHashMap(ownedKeys.size());
+
Iterator<IgniteTxKey> keyIter = ownedKeys.iterator();
Iterator<GridCacheVersion> valIter = ownedVals.iterator();
@@ -313,7 +315,6 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareRequest {
}
unmarshalTx(nearWrites, true, ctx, ldr);
-
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1cf7527/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index e30f89c..22efce4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -174,9 +174,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
if (ownedVals == null)
ownedVals = new HashMap<>();
- OwnedValue oVal = new OwnedValue();
-
- oVal.init(ver, val);
+ OwnedValue oVal = new OwnedValue(ver, val);
ownedVals.put(key, oVal);
}
@@ -486,13 +484,17 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** Cache object. */
private CacheObject obj;
+ public OwnedValue() {
+ // No-op.
+ }
+
/**
* Initialize OwnedValues.
*
* @param vers Cache version.
* @param obj Cache object.
*/
- void init(GridCacheVersion vers, CacheObject obj) {
+ OwnedValue(GridCacheVersion vers, CacheObject obj) {
this.vers = vers;
this.obj = obj;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1cf7527/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 e763444..03f70db 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
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.transactions;
import org.apache.ignite.*;
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.lang.*;
import org.apache.ignite.internal.util.tostring.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1cf7527/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 7d10a66..eb0fee8 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
@@ -31,9 +31,6 @@ import java.nio.*;
* for multiple caches.
*/
public class IgniteTxKey implements Message {
- /** */
- private static final long serialVersionUID = 0L;
-
/** Key. */
@GridToStringInclude
private KeyCacheObject key;
[17/22] incubator-ignite git commit: #ignite-51: merge
Posted by sb...@apache.org.
#ignite-51: merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ebb880cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ebb880cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ebb880cb
Branch: refs/heads/ignite-51
Commit: ebb880cbde7e4901df467b75337df937227dd01c
Parents: 3dbf815 bf2b5ac
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 13:00:05 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 13:00:05 2015 +0300
----------------------------------------------------------------------
.../spi/checkpoint/s3/S3CheckpointSpi.java | 2 +-
modules/clients/readme.md | 4 +-
modules/clients/readme.pdf | Bin 52230 -> 47887 bytes
.../ClientAbstractMultiThreadedSelfTest.java | 37 +-
.../impl/ClientPartitionAffinitySelfTest.java | 406 -
.../ClientAbstractMultiNodeSelfTest.java | 54 +-
.../integration/ClientAbstractSelfTest.java | 11 -
.../ClientTcpUnreachableMultiNodeSelfTest.java | 4 -
.../client/suite/IgniteClientTestSuite.java | 1 -
.../src/test/resources/spring-server-node.xml | 2 +-
.../test/resources/spring-server-ssl-node.xml | 2 +-
.../java/org/apache/ignite/IgniteEvents.java | 2 +-
.../ignite/cache/CacheTypeFieldMetadata.java | 2 +-
.../apache/ignite/cache/CacheTypeMetadata.java | 18 +-
.../java/org/apache/ignite/cache/GridCache.java | 2 +-
.../CacheConsistentHashAffinityFunction.java | 702 -
.../cache/affinity/consistenthash/package.html | 24 -
.../CacheRendezvousAffinityFunction.java | 2 +-
.../apache/ignite/cache/store/CacheStore.java | 49 -
.../cache/store/jdbc/CacheJdbcBlobStore.java | 2 +-
.../configuration/CacheConfiguration.java | 2 +-
.../configuration/IgniteConfiguration.java | 6 +-
.../apache/ignite/internal/GridDiagnostic.java | 15 +-
.../ignite/internal/GridUpdateNotifier.java | 8 +-
.../apache/ignite/internal/IgniteKernal.java | 23 +-
.../ignite/internal/client/GridClientNode.java | 8 -
.../client/GridClientPartitionAffinity.java | 2 +-
.../client/impl/GridClientNodeImpl.java | 22 -
.../connection/GridClientNioTcpConnection.java | 3 +-
.../communication/GridIoMessageFactory.java | 19 +-
.../processors/cache/CacheEntryPredicate.java | 40 +
.../cache/CacheEntryPredicateAdapter.java | 97 +
.../cache/CacheEntryPredicateContainsValue.java | 133 +
.../cache/CacheEntryPredicateHasValue.java | 28 +
.../cache/CacheEntryPredicateNoValue.java | 28 +
.../cache/CacheEntrySerializablePredicate.java | 140 +
.../processors/cache/CacheEvictionEntry.java | 179 +
.../processors/cache/CacheProjection.java | 80 +-
.../processors/cache/EvictableEntryImpl.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 298 +-
.../processors/cache/GridCacheAttributes.java | 32 +-
.../cache/GridCacheClearAllRunnable.java | 2 +-
.../cache/GridCacheConcurrentMap.java | 64 +-
.../processors/cache/GridCacheContext.java | 117 +-
.../cache/GridCacheDeploymentManager.java | 107 +-
.../processors/cache/GridCacheEntryEx.java | 22 +-
.../cache/GridCacheEvictionManager.java | 74 +-
.../cache/GridCacheEvictionRequest.java | 36 +-
.../processors/cache/GridCacheKeySet.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 62 +-
.../processors/cache/GridCacheMessage.java | 159 +-
.../processors/cache/GridCacheProcessor.java | 31 +-
.../processors/cache/GridCacheProjectionEx.java | 24 +-
.../cache/GridCacheProjectionImpl.java | 493 +-
.../processors/cache/GridCacheProxyImpl.java | 93 +-
.../processors/cache/GridCacheSwapManager.java | 12 +-
.../processors/cache/GridCacheUtils.java | 116 +-
.../cache/GridCacheValueCollection.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../processors/cache/KeyCacheObjectImpl.java | 5 +-
.../cache/KeyCacheObjectTransferImpl.java | 119 +
.../GridDistributedCacheAdapter.java | 6 +-
.../GridDistributedTxRemoteAdapter.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 4 +-
.../distributed/dht/GridDhtLocalPartition.java | 2 +-
.../distributed/dht/GridDhtLockFuture.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 10 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 8 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 69 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 4 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 42 +-
.../dht/colocated/GridDhtColocatedCache.java | 12 +-
.../colocated/GridDhtColocatedLockFuture.java | 6 +-
.../preloader/GridDhtPartitionSupplyPool.java | 1 +
.../distributed/near/GridNearAtomicCache.java | 36 +-
.../distributed/near/GridNearCacheAdapter.java | 49 +-
.../distributed/near/GridNearLockFuture.java | 12 +-
.../distributed/near/GridNearLockRequest.java | 36 +-
.../near/GridNearTransactionalCache.java | 6 +-
.../cache/distributed/near/GridNearTxLocal.java | 2 +-
.../distributed/near/GridNearTxRemote.java | 4 +-
.../processors/cache/local/GridLocalCache.java | 8 +-
.../cache/local/GridLocalLockFuture.java | 4 +-
.../local/atomic/GridLocalAtomicCache.java | 102 +-
.../query/GridCacheDistributedQueryManager.java | 4 +-
.../cache/query/GridCacheLocalQueryFuture.java | 3 +-
.../cache/query/GridCacheQueriesImpl.java | 4 +-
.../cache/query/GridCacheQueryAdapter.java | 8 +-
.../cache/query/GridCacheQueryInfo.java | 7 +-
.../cache/query/GridCacheQueryManager.java | 42 +-
.../cache/query/GridCacheQueryRequest.java | 20 +-
.../cache/transactions/IgniteInternalTx.java | 2 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxEntry.java | 26 +-
.../transactions/IgniteTxLocalAdapter.java | 56 +-
.../cache/transactions/IgniteTxLocalEx.java | 4 +-
.../dataload/IgniteDataLoaderImpl.java | 11 +-
.../portable/GridPortableProcessor.java | 2 +-
.../portable/os/GridOsPortableProcessor.java | 7 +-
.../rest/client/message/GridClientNodeBean.java | 23 -
.../top/GridTopologyCommandHandler.java | 8 -
.../org/apache/ignite/internal/util/F0.java | 90 +
.../ignite/internal/util/lang/GridFunc.java | 52 -
.../cache/VisorCacheAffinityConfiguration.java | 19 +-
.../apache/ignite/marshaller/Marshaller.java | 2 +-
.../ignite/marshaller/jdk/JdkMarshaller.java | 2 +-
.../optimized/OptimizedMarshaller.java | 2 +-
.../SpringApplicationContextResource.java | 2 +-
.../checkpoint/cache/CacheCheckpointSpi.java | 2 +-
.../spi/checkpoint/jdbc/JdbcCheckpointSpi.java | 2 +-
.../sharedfs/SharedFsCheckpointSpi.java | 2 +-
.../jobstealing/JobStealingCollisionSpi.java | 4 +-
.../PriorityQueueCollisionSpi.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 16 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../memory/MemoryEventStorageSpi.java | 2 +-
.../spi/failover/always/AlwaysFailoverSpi.java | 2 +-
.../jobstealing/JobStealingFailoverSpi.java | 2 +-
.../spi/failover/never/NeverFailoverSpi.java | 2 +-
.../apache/ignite/spi/indexing/IndexingSpi.java | 2 +-
.../adaptive/AdaptiveLoadBalancingSpi.java | 2 +-
.../roundrobin/RoundRobinLoadBalancingSpi.java | 2 +-
.../WeightedRandomLoadBalancingSpi.java | 2 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 2 +-
.../startup/cmdline/CommandLineStartup.java | 4 +-
.../startup/cmdline/ggcube_node_128x128.png | Bin 4679 -> 0 bytes
.../startup/cmdline/ggcube_node_48x48.png | Bin 2355 -> 0 bytes
.../startup/cmdline/logo_ignite_128x128.png | Bin 0 -> 18667 bytes
.../startup/cmdline/logo_ignite_48x48.png | Bin 0 -> 16572 bytes
.../config/load/dsi-49-server-production.xml | 2 +-
.../GridCacheAffinityBackupsSelfTest.java | 9 -
.../ignite/IgniteCacheAffinitySelfTest.java | 30 +-
.../internal/GridUpdateNotifierSelfTest.java | 2 +-
...AffinityProcessorConsistentHashSelfTest.java | 31 -
.../cache/GridCacheAbstractFullApiSelfTest.java | 29 +-
...idCacheConfigurationConsistencySelfTest.java | 46 +-
...ridCacheConfigurationValidationSelfTest.java | 8 +-
.../cache/GridCacheOffHeapSelfTest.java | 12 +-
.../GridCachePartitionedAffinitySpreadTest.java | 16 +-
.../processors/cache/GridCacheTestEntryEx.java | 22 +-
.../GridCacheValueBytesPreloadingSelfTest.java | 1 +
.../IgniteClientAffinityAssignmentSelfTest.java | 16 +-
...actQueueFailoverDataConsistencySelfTest.java | 2 +-
.../GridCacheClientModesAbstractSelfTest.java | 4 +-
.../distributed/GridCacheEventAbstractTest.java | 12 +-
...dCachePartitionedAffinityFilterSelfTest.java | 6 +-
...GridCachePreloadRestartAbstractSelfTest.java | 4 +-
.../dht/GridCacheColocatedDebugTest.java | 4 +-
.../dht/GridCacheDhtEntrySelfTest.java | 4 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 13 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 13 +-
.../dht/GridCacheDhtInternalEntrySelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadBigDataSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 4 +-
.../GridCacheDhtPreloadDisabledSelfTest.java | 4 +-
.../GridCacheDhtPreloadMessageCountTest.java | 4 +-
...ridCacheDhtPreloadMultiThreadedSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 4 +-
.../GridCacheDhtPreloadStartStopSelfTest.java | 4 +-
.../dht/GridCacheDhtPreloadUnloadSelfTest.java | 4 +-
.../distributed/dht/GridCacheDhtTestUtils.java | 6 +-
...dCachePartitionedTopologyChangeSelfTest.java | 7 +-
...ridCachePartitionedUnloadEventsSelfTest.java | 5 +-
...ffinityFunctionExcludeNeighborsSelfTest.java | 32 -
...AffinityExcludeNeighborsPerformanceTest.java | 4 +-
...rtitionedAffinityHashIdResolverSelfTest.java | 4 +-
.../GridCachePartitionedAffinitySelfTest.java | 226 -
.../GridCachePartitionedFullApiSelfTest.java | 11 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 4 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 4 +-
.../GridCachePartitionedTxSalvageSelfTest.java | 4 +-
...cheSynchronousEvictionsFailoverSelfTest.java | 4 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 4 +-
...dCacheAbstractReduceFieldsQuerySelfTest.java | 21 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 4 +-
...apPartitionedMapPerformanceAbstractTest.java | 4 +-
...GridUnsafePartitionedMapPerformanceTest.java | 4 +-
.../capacity/spring-capacity-cache.xml | 2 +-
.../loadtests/colocation/spring-colocation.xml | 2 +-
.../GridCachePartitionedAtomicLongLoadTest.java | 4 +-
...apPartitionedMapPerformanceAbstractTest.java | 4 +-
...GridUnsafePartitionedMapPerformanceTest.java | 4 +-
.../ignite/testframework/GridTestUtils.java | 11 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 -
.../ignite/testsuites/IgniteCacheTestSuite.java | 1 -
.../core/src/test/resources/log/ignite.log.tst | 13706 -----------------
.../hibernate/CacheHibernateBlobStore.java | 2 +-
.../hibernate/HibernateL2CacheSelfTest.java | 8 +-
.../GridCacheAbstractFieldsQuerySelfTest.java | 34 -
.../cache/GridCacheAbstractQuerySelfTest.java | 20 +-
.../cache/GridCacheCrossCacheQuerySelfTest.java | 17 -
.../processors/cache/GridCacheSwapSelfTest.java | 12 +-
.../rest/protocols/http/jetty/rest.html | 19 +-
.../ignite/schema/generator/PojoGenerator.java | 3 +-
.../schema/generator/SnippetGenerator.java | 138 +
.../apache/ignite/schema/ui/SchemaLoadApp.java | 2 +
.../cache/spring/SpringDynamicCacheManager.java | 36 +-
.../spi/deployment/uri/UriDeploymentSpi.java | 2 +-
.../ignite/visor/commands/VisorConsole.scala | 16 +-
.../commands/cache/VisorCacheCommand.scala | 18 +-
.../commands/cache/VisorCacheScanCommand.scala | 7 +-
.../config/VisorConfigurationCommand.scala | 5 +-
.../ignite/visor/commands/ggcube_128x128.png | Bin 11444 -> 0 bytes
.../ignite/visor/commands/ggcube_48x48.png | Bin 3365 -> 0 bytes
.../visor/commands/logo_ignite_128x128.png | Bin 0 -> 18667 bytes
.../ignite/visor/commands/logo_ignite_48x48.png | Bin 0 -> 16572 bytes
.../visor/commands/node/VisorNodeCommand.scala | 6 +-
.../scala/org/apache/ignite/visor/visor.scala | 27 +-
pom.xml | 50 +-
211 files changed, 2328 insertions(+), 17434 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ebb880cb/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 44f8c7b,a9263b9..7c4f949
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@@ -545,10 -545,10 +545,25 @@@ public class GridIoMessageFactory imple
break;
case 99:
+ msg = new CacheEntrySerializablePredicate();
+
+ break;
+
++ case 100:
++ msg = new IgniteTxEntry();
++
++ break;
++
++ case 101:
++ msg = new TxEntryValueHolder();
++
++ break;
++
++ case 102:
+ msg = new NearTxPrepareResponseOwnedValue();
+
+ break;
+
default:
if (ext != null) {
for (MessageFactory factory : ext) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ebb880cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index f85fc37,5e6f2bb..678a653
--- 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
@@@ -105,11 -103,9 +105,11 @@@ public class IgniteTxEntry implements G
/** Put filters. */
@GridToStringInclude
+ @GridDirectTransient
- private IgnitePredicate<Cache.Entry<Object, Object>>[] filters;
+ private CacheEntryPredicate[] filters;
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
+ @GridDirectTransient
private boolean filtersPassed;
/** Flag indicating that filter is set and can not be replaced. */
@@@ -692,14 -684,23 +692,21 @@@
* @throws IgniteCheckedException If failed.
*/
public void marshal(GridCacheSharedContext<?, ?> ctx, boolean transferExpiry) throws IgniteCheckedException {
+ if (filters != null) {
+ for (CacheEntryPredicate p : filters) {
+ if (p != null)
+ p.prepareMarshal(ctx.cacheContext(cacheId));
+ }
+ }
+
// Do not serialize filters if they are null.
- if (depEnabled) {
- if (transformClosBytes == null && entryProcessorsCol != null)
- transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
-
- if (F.isEmptyOrNulls(filters))
- filterBytes = null;
- else if (filterBytes == null)
- filterBytes = CU.marshal(ctx, filters);
- }
+ if (transformClosBytes == null && entryProcessorsCol != null)
+ transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
+
+ if (F.isEmptyOrNulls(filters))
+ filterBytes = null;
+ else if (filterBytes == null)
+ filterBytes = CU.marshal(ctx, filters);
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
@@@ -731,15 -730,23 +738,22 @@@
this.ctx = cacheCtx;
}
- if (depEnabled) {
- // Unmarshal transform closure anyway if it exists.
- if (transformClosBytes != null && entryProcessorsCol == null)
- entryProcessorsCol = ctx.marshaller().unmarshal(transformClosBytes, 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 && filterBytes != null) {
+ filters = ctx.marshaller().unmarshal(filterBytes, clsLdr);
- if (filters == null)
- filters = CU.empty();
+ if (filters == null)
+ filters = CU.empty0();
+ else {
+ for (CacheEntryPredicate p : filters) {
+ if (p != null)
+ p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
+ }
+ }
+ }
}
key.finishUnmarshal(context(), clsLdr);
[07/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: GridNearTxPrepareResponseOwnedValue to upper level.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: GridNearTxPrepareResponseOwnedValue to upper level.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8d617ea2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8d617ea2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8d617ea2
Branch: refs/heads/ignite-51
Commit: 8d617ea2d74826cd23192e60ead83302aa3be626
Parents: f138b57
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:48:40 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:48:40 2015 +0300
----------------------------------------------------------------------
.../near/GridNearTxPrepareResponseOwnedValue.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d617ea2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
index b833f78..ff0f35a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponseOwnedValue.java
@@ -100,16 +100,17 @@ public class GridNearTxPrepareResponseOwnedValue implements Message {
switch (writer.state()) {
case 0:
- if (!writer.writeMessage("vers", vers))
+ if (!writer.writeMessage("obj", obj))
return false;
writer.incrementState();
case 1:
- if (!writer.writeMessage("obj", obj))
+ if (!writer.writeMessage("vers", vers))
return false;
writer.incrementState();
+
}
return true;
@@ -124,7 +125,7 @@ public class GridNearTxPrepareResponseOwnedValue implements Message {
switch (reader.state()) {
case 0:
- vers = reader.readMessage("vers");
+ obj = reader.readMessage("obj");
if (!reader.isLastRead())
return false;
@@ -132,12 +133,13 @@ public class GridNearTxPrepareResponseOwnedValue implements Message {
reader.incrementState();
case 1:
- obj = reader.readMessage("obj");
+ vers = reader.readMessage("vers");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
}
return true;
[09/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: TxEntryValueHolder to upper level.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: TxEntryValueHolder to upper level.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/954777cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/954777cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/954777cc
Branch: refs/heads/ignite-51
Commit: 954777cc33db970848a8b006e339a0e316d645fa
Parents: 22df51c
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Mar 3 18:54:38 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Mar 3 18:54:38 2015 +0300
----------------------------------------------------------------------
.../cache/transactions/TxEntryValueHolder.java | 22 ++++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954777cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index c1c759f..5a4689c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -235,29 +235,29 @@ public class TxEntryValueHolder implements Message {
switch (writer.state()) {
case 0:
- if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
+ if (!writer.writeBoolean("hasReadVal", hasReadVal))
return false;
writer.incrementState();
case 1:
- if (!writer.writeBoolean("hasReadVal", hasReadVal))
+ if (!writer.writeBoolean("hasWriteVal", hasWriteVal))
return false;
writer.incrementState();
case 2:
- if (!writer.writeInt("op", op.ordinal()))
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
return false;
writer.incrementState();
+
case 3:
- if (!writer.writeMessage("cacheObject", val))
+ if (!writer.writeMessage("val", val))
return false;
writer.incrementState();
-
}
return true;
@@ -272,7 +272,7 @@ public class TxEntryValueHolder implements Message {
switch (reader.state()) {
case 0:
- hasWriteVal = reader.readBoolean("hasWriteVal");
+ hasReadVal = reader.readBoolean("hasReadVal");
if (!reader.isLastRead())
return false;
@@ -280,22 +280,26 @@ public class TxEntryValueHolder implements Message {
reader.incrementState();
case 1:
- hasReadVal = reader.readBoolean("hasReadVal");
+ hasWriteVal = reader.readBoolean("hasWriteVal");
if (!reader.isLastRead())
return false;
reader.incrementState();
+
case 2:
- op = GridCacheOperation.fromOrdinal(reader.readInt("op"));
+ byte opOrd = reader.readByte("op");
if (!reader.isLastRead())
return false;
+ if (opOrd != -1)
+ op = GridCacheOperation.fromOrdinal(opOrd);
+
reader.incrementState();
case 3:
- val = reader.readMessage("cacheObject");
+ val = reader.readMessage("val");
if (!reader.isLastRead())
return false;
[14/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: small fixs.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: small fixs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/21cdc80e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/21cdc80e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/21cdc80e
Branch: refs/heads/ignite-51
Commit: 21cdc80ef8b2a159aae1a75045c38d58ea30c9de
Parents: 0aedd9c
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 12:33:22 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 12:33:22 2015 +0300
----------------------------------------------------------------------
.../processors/cache/CacheObjectImpl.java | 2 +
.../cache/transactions/TxEntryValueHolder.java | 75 ++------------------
2 files changed, 9 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/21cdc80e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
index aef1978..5da0f79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
@@ -94,6 +94,8 @@ public class CacheObjectImpl extends CacheObjectAdapter {
/** {@inheritDoc} */
@Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ assert val != null || valBytes != null;
+
if (valBytes == null && !byteArray())
valBytes = CU.marshal(ctx.kernalContext().cache().context(), val);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/21cdc80e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 2cd0c37..cafe643 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
-import java.io.*;
import java.nio.*;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
@@ -147,7 +146,7 @@ public class TxEntryValueHolder implements Message {
* @throws org.apache.ignite.IgniteCheckedException If unmarshalling failed.
*/
public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException {
- if (val != null)
+ if (hasWriteVal && val != null)
val.finishUnmarshal(ctx, ldr);
// TODO IGNITE-51.
@@ -155,68 +154,6 @@ public class TxEntryValueHolder implements Message {
// val = ctx.marshaller().unmarshal(valBytes, ldr);
}
- /**
- * @param out Data output.
- * @throws java.io.IOException If failed.
- */
- public void writeTo(ObjectOutput out) throws IOException {
- out.writeBoolean(hasWriteVal);
-
- if (hasWriteVal)
- 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());
- }
-
- /**
- * @param in Data input.
- * @throws java.io.IOException If failed.
- * @throws ClassNotFoundException If failed.
- */
- @SuppressWarnings("unchecked")
- public void readFrom(ObjectInput in) throws IOException, ClassNotFoundException {
- hasWriteVal = in.readBoolean();
-
- if (hasWriteVal)
- val = (CacheObject)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 + ']';
@@ -247,7 +184,7 @@ public class TxEntryValueHolder implements Message {
writer.incrementState();
case 2:
- if (!writer.writeMessage("val", val))
+ if (hasWriteVal && !writer.writeMessage("val", val))
return false;
writer.incrementState();
@@ -286,10 +223,12 @@ public class TxEntryValueHolder implements Message {
reader.incrementState();
case 2:
- val = reader.readMessage("val");
+ if (hasWriteVal) {
+ val = reader.readMessage("val");
- if (!reader.isLastRead())
- return false;
+ if (!reader.isLastRead())
+ return false;
+ }
reader.incrementState();
[20/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry
implements Message: not working version.
Posted by sb...@apache.org.
#ignite-51: IgniteTxEntry implements Message: not working version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b4f2f8f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b4f2f8f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b4f2f8f5
Branch: refs/heads/ignite-51
Commit: b4f2f8f5e46edf65bcc3f3544d86e43582dae8eb
Parents: 362d073
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Mar 4 15:19:50 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Mar 4 15:19:50 2015 +0300
----------------------------------------------------------------------
.../cache/CacheEntrySerializablePredicate.java | 8 +++--
.../cache/transactions/IgniteTxEntry.java | 38 ++++++++------------
2 files changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b4f2f8f5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
index 583882f..c538910 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntrySerializablePredicate.java
@@ -61,11 +61,13 @@ public class CacheEntrySerializablePredicate implements CacheEntryPredicate {
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheContext ctx, ClassLoader ldr) throws IgniteCheckedException {
- assert bytes != null;
+ assert p != null || bytes != null;
- p = ctx.marshaller().unmarshal(bytes, ldr);
+ if (p == null) {
+ p = ctx.marshaller().unmarshal(bytes, ldr);
- p.finishUnmarshal(ctx, ldr);
+ p.finishUnmarshal(ctx, ldr);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b4f2f8f5/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 3c02341..48b7fb4 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
@@ -100,12 +100,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** Put filters. */
@GridToStringInclude
- @GridDirectTransient
private CacheEntryPredicate[] filters;
- /** Filter bytes. */
- private byte[] filterBytes;
-
/** Flag indicating whether filters passed. Used for fast-commit transactions. */
@GridDirectTransient
private boolean filtersPassed;
@@ -651,8 +647,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
* @param filters Put filters.
*/
public void filters(CacheEntryPredicate[] filters) {
- filterBytes = null;
-
this.filters = filters;
}
@@ -701,11 +695,6 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
if (transformClosBytes == null && entryProcessorsCol != null)
transformClosBytes = CU.marshal(ctx, entryProcessorsCol);
- if (F.isEmptyOrNulls(filters))
- filterBytes = null;
- else if (filterBytes == null)
- filterBytes = CU.marshal(ctx, filters);
-
if (transferExpiry)
transferExpiryPlc = expiryPlc != null && expiryPlc != this.ctx.expiry();
@@ -740,16 +729,12 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
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.empty0();
- else {
- for (CacheEntryPredicate p : filters) {
- if (p != null)
- p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
- }
+ if (filters == null)
+ filters = CU.empty0();
+ else {
+ for (CacheEntryPredicate p : filters) {
+ if (p != null)
+ p.finishUnmarshal(ctx.cacheContext(cacheId), clsLdr);
}
}
@@ -818,7 +803,14 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
writer.incrementState();
case 5:
- if (!writer.writeByteArray("filterBytes", filterBytes))
+ if (!F.isEmptyOrNulls(filters)) {
+ for (CacheEntryPredicate filter : filters) {
+ if (filter == null) {
+ System.out.println("TEST FAIL");
+ }
+ }
+ }
+ if (!writer.writeObjectArray("filters", filters, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
@@ -907,7 +899,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
reader.incrementState();
case 5:
- filterBytes = reader.readByteArray("filterBytes");
+ filters = reader.readObjectArray("filters", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
if (!reader.isLastRead())
return false;