http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java index ee1a930..8748350 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java @@ -275,11 +275,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridDhtPartitionSupplyMessage _clone = new GridDhtPartitionSupplyMessage(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -302,54 +298,57 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeBoolean("ack", ack)) return false; - state++; + state.increment(); case 4: if (!writer.writeByteArray("infoBytes", infoBytes)) return false; - state++; + state.increment(); case 5: if (!writer.writeCollection("last", last, int.class)) return false; - state++; + state.increment(); case 6: if (!writer.writeCollection("missed", missed, int.class)) return false; - state++; + state.increment(); case 7: if (!writer.writeLong("updateSeq", updateSeq)) return false; - state++; + state.increment(); case 8: if (!writer.writeInt("workerId", workerId)) return false; - state++; + state.increment(); } @@ -364,14 +363,14 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: ack = reader.readBoolean("ack"); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: infoBytes = reader.readByteArray("infoBytes"); @@ -379,7 +378,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 5: last = reader.readCollection("last", int.class); @@ -387,7 +386,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 6: missed = reader.readCollection("missed", int.class); @@ -395,7 +394,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 7: updateSeq = reader.readLong("updateSeq"); @@ -403,7 +402,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 8: workerId = reader.readInt("workerId"); @@ -411,7 +410,7 @@ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java index 763152a..584e06d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java @@ -87,30 +87,33 @@ abstract class GridDhtPartitionsAbstractMessage<K, V> extends GridCacheMessage<K /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeMessage("exchId", exchId)) return false; - state++; + state.increment(); case 4: if (!writer.writeMessage("lastVer", lastVer)) return false; - state++; + state.increment(); } @@ -125,14 +128,14 @@ abstract class GridDhtPartitionsAbstractMessage<K, V> extends GridCacheMessage<K if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: exchId = reader.readMessage("exchId"); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: lastVer = reader.readMessage("lastVer"); @@ -140,7 +143,7 @@ abstract class GridDhtPartitionsAbstractMessage<K, V> extends GridCacheMessage<K if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java index feb5580..0552756 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java @@ -118,11 +118,7 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridDhtPartitionsFullMessage _clone = new GridDhtPartitionsFullMessage(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -139,30 +135,33 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 5: if (!writer.writeByteArray("partsBytes", partsBytes)) return false; - state++; + state.increment(); case 6: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); } @@ -177,14 +176,14 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 5: partsBytes = reader.readByteArray("partsBytes"); if (!reader.isLastRead()) return false; - state++; + readState++; case 6: topVer = reader.readLong("topVer"); @@ -192,7 +191,7 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java index d9c9e45..154a410 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java @@ -97,11 +97,7 @@ public class GridDhtPartitionsSingleMessage<K, V> extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridDhtPartitionsSingleMessage _clone = new GridDhtPartitionsSingleMessage(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -117,24 +113,27 @@ public class GridDhtPartitionsSingleMessage<K, V> extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 5: if (!writer.writeByteArray("partsBytes", partsBytes)) return false; - state++; + state.increment(); } @@ -149,14 +148,14 @@ public class GridDhtPartitionsSingleMessage<K, V> extends GridDhtPartitionsAbstr if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 5: partsBytes = reader.readByteArray("partsBytes"); if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java index 944fcc0..f5e0977 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java @@ -47,11 +47,7 @@ public class GridDhtPartitionsSingleRequest<K, V> extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridDhtPartitionsSingleRequest _clone = new GridDhtPartitionsSingleRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -63,16 +59,19 @@ public class GridDhtPartitionsSingleRequest<K, V> extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } return true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java index 1c18112..223192a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java @@ -250,11 +250,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearGetRequest _clone = new GridNearGetRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -281,84 +277,87 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeLong("accessTtl", accessTtl)) return false; - state++; + state.increment(); case 4: if (!writer.writeObjectArray("filterBytes", filterBytes, byte[].class)) return false; - state++; + state.increment(); case 5: if (!writer.writeIgniteUuid("futId", futId)) return false; - state++; + state.increment(); case 6: if (!writer.writeMap("keyBytes", keyBytes, byte[].class, boolean.class)) return false; - state++; + state.increment(); case 7: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 8: if (!writer.writeBoolean("readThrough", readThrough)) return false; - state++; + state.increment(); case 9: if (!writer.writeBoolean("reload", reload)) return false; - state++; + state.increment(); case 10: if (!writer.writeUuid("subjId", subjId)) return false; - state++; + state.increment(); case 11: if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - state++; + state.increment(); case 12: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); case 13: if (!writer.writeMessage("ver", ver)) return false; - state++; + state.increment(); } @@ -373,14 +372,14 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: accessTtl = reader.readLong("accessTtl"); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: filterBytes = reader.readObjectArray("filterBytes", byte[].class); @@ -388,7 +387,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 5: futId = reader.readIgniteUuid("futId"); @@ -396,7 +395,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 6: keyBytes = reader.readMap("keyBytes", byte[].class, boolean.class, true); @@ -404,7 +403,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 7: miniId = reader.readIgniteUuid("miniId"); @@ -412,7 +411,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 8: readThrough = reader.readBoolean("readThrough"); @@ -420,7 +419,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 9: reload = reader.readBoolean("reload"); @@ -428,7 +427,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 10: subjId = reader.readUuid("subjId"); @@ -436,7 +435,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 11: taskNameHash = reader.readInt("taskNameHash"); @@ -444,7 +443,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 12: topVer = reader.readLong("topVer"); @@ -452,7 +451,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 13: ver = reader.readMessage("ver"); @@ -460,7 +459,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java index 93d48fb..0180227 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java @@ -202,11 +202,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearGetResponse _clone = new GridNearGetResponse(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -229,60 +225,63 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeByteArray("entriesBytes", entriesBytes)) return false; - state++; + state.increment(); case 4: if (!writer.writeByteArray("errBytes", errBytes)) return false; - state++; + state.increment(); case 5: if (!writer.writeIgniteUuid("futId", futId)) return false; - state++; + state.increment(); case 6: if (!writer.writeCollection("invalidParts", invalidParts, int.class)) return false; - state++; + state.increment(); case 7: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 8: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); case 9: if (!writer.writeMessage("ver", ver)) return false; - state++; + state.increment(); } @@ -297,14 +296,14 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: entriesBytes = reader.readByteArray("entriesBytes"); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: errBytes = reader.readByteArray("errBytes"); @@ -312,7 +311,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 5: futId = reader.readIgniteUuid("futId"); @@ -320,7 +319,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 6: invalidParts = reader.readCollection("invalidParts", int.class); @@ -328,7 +327,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 7: miniId = reader.readIgniteUuid("miniId"); @@ -336,7 +335,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 8: topVer = reader.readLong("topVer"); @@ -344,7 +343,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; case 9: ver = reader.readMessage("ver"); @@ -352,7 +351,7 @@ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java index cd02ff6..081a2a6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java @@ -333,11 +333,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearLockRequest _clone = new GridNearLockRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -364,90 +360,93 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 24: if (!writer.writeLong("accessTtl", accessTtl)) return false; - state++; + state.increment(); case 25: if (!writer.writeObjectArray("dhtVers", dhtVers, GridCacheVersion.class)) return false; - state++; + state.increment(); case 26: if (!writer.writeObjectArray("filterBytes", filterBytes, byte[].class)) return false; - state++; + state.increment(); case 27: if (!writer.writeBoolean("hasTransforms", hasTransforms)) return false; - state++; + state.increment(); case 28: if (!writer.writeBoolean("implicitSingleTx", implicitSingleTx)) return false; - state++; + state.increment(); case 29: if (!writer.writeBoolean("implicitTx", implicitTx)) return false; - state++; + state.increment(); case 30: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 31: if (!writer.writeBoolean("onePhaseCommit", onePhaseCommit)) return false; - state++; + state.increment(); case 32: if (!writer.writeUuid("subjId", subjId)) return false; - state++; + state.increment(); case 33: if (!writer.writeBoolean("syncCommit", syncCommit)) return false; - state++; + state.increment(); case 34: if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - state++; + state.increment(); case 35: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); } @@ -462,14 +461,14 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 24: accessTtl = reader.readLong("accessTtl"); if (!reader.isLastRead()) return false; - state++; + readState++; case 25: dhtVers = reader.readObjectArray("dhtVers", GridCacheVersion.class); @@ -477,7 +476,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 26: filterBytes = reader.readObjectArray("filterBytes", byte[].class); @@ -485,7 +484,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 27: hasTransforms = reader.readBoolean("hasTransforms"); @@ -493,7 +492,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 28: implicitSingleTx = reader.readBoolean("implicitSingleTx"); @@ -501,7 +500,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 29: implicitTx = reader.readBoolean("implicitTx"); @@ -509,7 +508,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 30: miniId = reader.readIgniteUuid("miniId"); @@ -517,7 +516,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 31: onePhaseCommit = reader.readBoolean("onePhaseCommit"); @@ -525,7 +524,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 32: subjId = reader.readUuid("subjId"); @@ -533,7 +532,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 33: syncCommit = reader.readBoolean("syncCommit"); @@ -541,7 +540,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 34: taskNameHash = reader.readInt("taskNameHash"); @@ -549,7 +548,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; case 35: topVer = reader.readLong("topVer"); @@ -557,7 +556,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java index 2769f7a..9f353b5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java @@ -183,11 +183,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearLockResponse _clone = new GridNearLockResponse(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -206,48 +202,51 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 11: if (!writer.writeObjectArray("dhtVers", dhtVers, GridCacheVersion.class)) return false; - state++; + state.increment(); case 12: if (!writer.writeBooleanArray("filterRes", filterRes)) return false; - state++; + state.increment(); case 13: if (!writer.writeObjectArray("mappedVers", mappedVers, GridCacheVersion.class)) return false; - state++; + state.increment(); case 14: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 15: if (!writer.writeCollection("pending", pending, GridCacheVersion.class)) return false; - state++; + state.increment(); } @@ -262,14 +261,14 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 11: dhtVers = reader.readObjectArray("dhtVers", GridCacheVersion.class); if (!reader.isLastRead()) return false; - state++; + readState++; case 12: filterRes = reader.readBooleanArray("filterRes"); @@ -277,7 +276,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V if (!reader.isLastRead()) return false; - state++; + readState++; case 13: mappedVers = reader.readObjectArray("mappedVers", GridCacheVersion.class); @@ -285,7 +284,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V if (!reader.isLastRead()) return false; - state++; + readState++; case 14: miniId = reader.readIgniteUuid("miniId"); @@ -293,7 +292,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V if (!reader.isLastRead()) return false; - state++; + readState++; case 15: pending = reader.readCollection("pending", GridCacheVersion.class); @@ -301,7 +300,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java index cfa797a..8e45af1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java @@ -160,11 +160,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearTxFinishRequest _clone = new GridNearTxFinishRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -184,54 +180,57 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 21: if (!writer.writeBoolean("explicitLock", explicitLock)) return false; - state++; + state.increment(); case 22: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 23: if (!writer.writeBoolean("storeEnabled", storeEnabled)) return false; - state++; + state.increment(); case 24: if (!writer.writeUuid("subjId", subjId)) return false; - state++; + state.increment(); case 25: if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - state++; + state.increment(); case 26: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); } @@ -246,14 +245,14 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 21: explicitLock = reader.readBoolean("explicitLock"); if (!reader.isLastRead()) return false; - state++; + readState++; case 22: miniId = reader.readIgniteUuid("miniId"); @@ -261,7 +260,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!reader.isLastRead()) return false; - state++; + readState++; case 23: storeEnabled = reader.readBoolean("storeEnabled"); @@ -269,7 +268,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!reader.isLastRead()) return false; - state++; + readState++; case 24: subjId = reader.readUuid("subjId"); @@ -277,7 +276,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!reader.isLastRead()) return false; - state++; + readState++; case 25: taskNameHash = reader.readInt("taskNameHash"); @@ -285,7 +284,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!reader.isLastRead()) return false; - state++; + readState++; case 26: topVer = reader.readLong("topVer"); @@ -293,7 +292,7 @@ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishReques if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java index 5e19079..3ec1e39 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -116,11 +116,7 @@ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearTxFinishResponse _clone = new GridNearTxFinishResponse(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -138,36 +134,39 @@ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 5: if (!writer.writeByteArray("errBytes", errBytes)) return false; - state++; + state.increment(); case 6: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 7: if (!writer.writeLong("nearThreadId", nearThreadId)) return false; - state++; + state.increment(); } @@ -182,14 +181,14 @@ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishRespo if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 5: errBytes = reader.readByteArray("errBytes"); if (!reader.isLastRead()) return false; - state++; + readState++; case 6: miniId = reader.readIgniteUuid("miniId"); @@ -197,7 +196,7 @@ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishRespo if (!reader.isLastRead()) return false; - state++; + readState++; case 7: nearThreadId = reader.readLong("nearThreadId"); @@ -205,7 +204,7 @@ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishRespo if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java index 9d5f73d..f566385 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java @@ -218,11 +218,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearTxPrepareRequest _clone = new GridNearTxPrepareRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -244,66 +240,69 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 22: if (!writer.writeIgniteUuid("futId", futId)) return false; - state++; + state.increment(); case 23: if (!writer.writeBoolean("last", last)) return false; - state++; + state.increment(); case 24: if (!writer.writeCollection("lastBackups", lastBackups, UUID.class)) return false; - state++; + state.increment(); case 25: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 26: if (!writer.writeBoolean("near", near)) return false; - state++; + state.increment(); case 27: if (!writer.writeUuid("subjId", subjId)) return false; - state++; + state.increment(); case 28: if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - state++; + state.increment(); case 29: if (!writer.writeLong("topVer", topVer)) return false; - state++; + state.increment(); } @@ -318,14 +317,14 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 22: futId = reader.readIgniteUuid("futId"); if (!reader.isLastRead()) return false; - state++; + readState++; case 23: last = reader.readBoolean("last"); @@ -333,7 +332,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 24: lastBackups = reader.readCollection("lastBackups", UUID.class); @@ -341,7 +340,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 25: miniId = reader.readIgniteUuid("miniId"); @@ -349,7 +348,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 26: near = reader.readBoolean("near"); @@ -357,7 +356,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 27: subjId = reader.readUuid("subjId"); @@ -365,7 +364,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 28: taskNameHash = reader.readInt("taskNameHash"); @@ -373,7 +372,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; case 29: topVer = reader.readLong("topVer"); @@ -381,7 +380,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/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 8de39b9..6d99832 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 @@ -226,11 +226,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearTxPrepareResponse _clone = new GridNearTxPrepareResponse(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -251,54 +247,57 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 10: if (!writer.writeMessage("dhtVer", dhtVer)) return false; - state++; + state.increment(); case 11: if (!writer.writeIgniteUuid("futId", futId)) return false; - state++; + state.increment(); case 12: if (!writer.writeCollection("invalidParts", invalidParts, int.class)) return false; - state++; + state.increment(); case 13: if (!writer.writeIgniteUuid("miniId", miniId)) return false; - state++; + state.increment(); case 14: if (!writer.writeCollection("ownedValsBytes", ownedValsBytes, byte[].class)) return false; - state++; + state.increment(); case 15: if (!writer.writeCollection("pending", pending, GridCacheVersion.class)) return false; - state++; + state.increment(); } @@ -313,14 +312,14 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 10: dhtVer = reader.readMessage("dhtVer"); if (!reader.isLastRead()) return false; - state++; + readState++; case 11: futId = reader.readIgniteUuid("futId"); @@ -328,7 +327,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!reader.isLastRead()) return false; - state++; + readState++; case 12: invalidParts = reader.readCollection("invalidParts", int.class); @@ -336,7 +335,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!reader.isLastRead()) return false; - state++; + readState++; case 13: miniId = reader.readIgniteUuid("miniId"); @@ -344,7 +343,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!reader.isLastRead()) return false; - state++; + readState++; case 14: ownedValsBytes = reader.readCollection("ownedValsBytes", byte[].class); @@ -352,7 +351,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!reader.isLastRead()) return false; - state++; + readState++; case 15: pending = reader.readCollection("pending", GridCacheVersion.class); @@ -360,7 +359,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java index 267d798..a6a96a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java @@ -49,11 +49,7 @@ public class GridNearUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridNearUnlockRequest _clone = new GridNearUnlockRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -65,16 +61,19 @@ public class GridNearUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } return true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java index df8e2c0..ba8ed24 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java @@ -443,11 +443,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridCacheQueryRequest _clone = new GridCacheQueryRequest(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -485,132 +481,135 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeBoolean("all", all)) return false; - state++; + state.increment(); case 4: if (!writer.writeByteArray("argsBytes", argsBytes)) return false; - state++; + state.increment(); case 5: if (!writer.writeString("cacheName", cacheName)) return false; - state++; + state.increment(); case 6: if (!writer.writeBoolean("cancel", cancel)) return false; - state++; + state.increment(); case 7: if (!writer.writeString("clause", clause)) return false; - state++; + state.increment(); case 8: if (!writer.writeString("clsName", clsName)) return false; - state++; + state.increment(); case 9: if (!writer.writeBoolean("fields", fields)) return false; - state++; + state.increment(); case 10: if (!writer.writeLong("id", id)) return false; - state++; + state.increment(); case 11: if (!writer.writeBoolean("incBackups", incBackups)) return false; - state++; + state.increment(); case 12: if (!writer.writeBoolean("incMeta", incMeta)) return false; - state++; + state.increment(); case 13: if (!writer.writeBoolean("keepPortable", keepPortable)) return false; - state++; + state.increment(); case 14: if (!writer.writeByteArray("keyValFilterBytes", keyValFilterBytes)) return false; - state++; + state.increment(); case 15: if (!writer.writeInt("pageSize", pageSize)) return false; - state++; + state.increment(); case 16: if (!writer.writeByteArray("prjFilterBytes", prjFilterBytes)) return false; - state++; + state.increment(); case 17: if (!writer.writeByteArray("rdcBytes", rdcBytes)) return false; - state++; + state.increment(); case 18: if (!writer.writeUuid("subjId", subjId)) return false; - state++; + state.increment(); case 19: if (!writer.writeInt("taskHash", taskHash)) return false; - state++; + state.increment(); case 20: if (!writer.writeByteArray("transBytes", transBytes)) return false; - state++; + state.increment(); case 21: if (!writer.writeEnum("type", type)) return false; - state++; + state.increment(); } @@ -625,14 +624,14 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: all = reader.readBoolean("all"); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: argsBytes = reader.readByteArray("argsBytes"); @@ -640,7 +639,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 5: cacheName = reader.readString("cacheName"); @@ -648,7 +647,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 6: cancel = reader.readBoolean("cancel"); @@ -656,7 +655,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 7: clause = reader.readString("clause"); @@ -664,7 +663,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 8: clsName = reader.readString("clsName"); @@ -672,7 +671,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 9: fields = reader.readBoolean("fields"); @@ -680,7 +679,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 10: id = reader.readLong("id"); @@ -688,7 +687,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 11: incBackups = reader.readBoolean("incBackups"); @@ -696,7 +695,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 12: incMeta = reader.readBoolean("incMeta"); @@ -704,7 +703,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 13: keepPortable = reader.readBoolean("keepPortable"); @@ -712,7 +711,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 14: keyValFilterBytes = reader.readByteArray("keyValFilterBytes"); @@ -720,7 +719,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 15: pageSize = reader.readInt("pageSize"); @@ -728,7 +727,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 16: prjFilterBytes = reader.readByteArray("prjFilterBytes"); @@ -736,7 +735,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 17: rdcBytes = reader.readByteArray("rdcBytes"); @@ -744,7 +743,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 18: subjId = reader.readUuid("subjId"); @@ -752,7 +751,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 19: taskHash = reader.readInt("taskHash"); @@ -760,7 +759,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 20: transBytes = reader.readByteArray("transBytes"); @@ -768,7 +767,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; case 21: type = reader.readEnum("type", GridCacheQueryType.class); @@ -776,7 +775,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implemen if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java index acba6f6..4ec39e1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java @@ -204,11 +204,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridCacheQueryResponse _clone = new GridCacheQueryResponse(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -231,54 +227,57 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 3: if (!writer.writeCollection("dataBytes", dataBytes, byte[].class)) return false; - state++; + state.increment(); case 4: if (!writer.writeByteArray("errBytes", errBytes)) return false; - state++; + state.increment(); case 5: if (!writer.writeBoolean("fields", fields)) return false; - state++; + state.increment(); case 6: if (!writer.writeBoolean("finished", finished)) return false; - state++; + state.increment(); case 7: if (!writer.writeCollection("metaDataBytes", metaDataBytes, byte[].class)) return false; - state++; + state.increment(); case 8: if (!writer.writeLong("reqId", reqId)) return false; - state++; + state.increment(); } @@ -293,14 +292,14 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!super.readFrom(buf)) return false; - switch (state) { + switch (readState) { case 3: dataBytes = reader.readCollection("dataBytes", byte[].class); if (!reader.isLastRead()) return false; - state++; + readState++; case 4: errBytes = reader.readByteArray("errBytes"); @@ -308,7 +307,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!reader.isLastRead()) return false; - state++; + readState++; case 5: fields = reader.readBoolean("fields"); @@ -316,7 +315,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!reader.isLastRead()) return false; - state++; + readState++; case 6: finished = reader.readBoolean("finished"); @@ -324,7 +323,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!reader.isLastRead()) return false; - state++; + readState++; case 7: metaDataBytes = reader.readCollection("metaDataBytes", byte[].class); @@ -332,7 +331,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!reader.isLastRead()) return false; - state++; + readState++; case 8: reqId = reader.readLong("reqId"); @@ -340,7 +339,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> impleme if (!reader.isLastRead()) return false; - state++; + readState++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java index 1990bb1..0bdc2e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java @@ -254,39 +254,42 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 0: if (!writer.writeLong("globalTime", globalTime)) return false; - state++; + state.increment(); case 1: if (!writer.writeInt("nodeOrderDrId", nodeOrderDrId)) return false; - state++; + state.increment(); case 2: if (!writer.writeLong("order", order)) return false; - state++; + state.increment(); case 3: if (!writer.writeInt("topVer", topVer)) return false; - state++; + state.increment(); } @@ -297,14 +300,14 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC @Override public boolean readFrom(ByteBuffer buf) { reader.setBuffer(buf); - switch (state) { + switch (readState) { case 0: globalTime = reader.readLong("globalTime"); if (!reader.isLastRead()) return false; - state++; + readState++; case 1: nodeOrderDrId = reader.readInt("nodeOrderDrId"); @@ -312,7 +315,7 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC if (!reader.isLastRead()) return false; - state++; + readState++; case 2: order = reader.readLong("order"); @@ -320,7 +323,7 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC if (!reader.isLastRead()) return false; - state++; + readState++; case 3: topVer = reader.readInt("topVer"); @@ -328,7 +331,7 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC if (!reader.isLastRead()) return false; - state++; + readState++; } @@ -343,11 +346,7 @@ public class GridCacheVersion extends MessageAdapter implements Comparable<GridC /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { - GridCacheVersion _clone = new GridCacheVersion(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/947723c9/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java index 5afd5a8..671f934 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java @@ -74,11 +74,7 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public MessageAdapter clone() { - GridClockDeltaSnapshotMessage _clone = new GridClockDeltaSnapshotMessage(); - - clone0(_clone); - - return _clone; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @@ -92,27 +88,30 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { + MessageWriteState state = MessageWriteState.get(); + MessageWriter writer = state.writer(); + writer.setBuffer(buf); - if (!typeWritten) { + if (!state.isTypeWritten()) { if (!writer.writeByte(null, directType())) return false; - typeWritten = true; + state.setTypeWritten(); } - switch (state) { + switch (state.index()) { case 0: if (!writer.writeMap("deltas", deltas, UUID.class, long.class)) return false; - state++; + state.increment(); case 1: if (!writer.writeMessage("snapVer", snapVer)) return false; - state++; + state.increment(); } @@ -124,14 +123,14 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter { @Override public boolean readFrom(ByteBuffer buf) { reader.setBuffer(buf); - switch (state) { + switch (readState) { case 0: deltas = reader.readMap("deltas", UUID.class, long.class, false); if (!reader.isLastRead()) return false; - state++; + readState++; case 1: snapVer = reader.readMessage("snapVer"); @@ -139,7 +138,7 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter { if (!reader.isLastRead()) return false; - state++; + readState++; }