From d21e6b4b70b0b6baa0115c392eb94c2d207678e2 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 18 Dec 2014 15:06:05 +0300 Subject: [PATCH 01/71] IGNITE-61 - Portable format in direct marshalling --- .../collision/jobstealing/JobStealingRequest.java | 6 +- .../spi/communication/tcp/TcpCommunicationSpi.java | 108 +- .../GridClientConnectionManagerAdapter.java | 75 +- .../gridgain/grid/kernal/GridJobCancelRequest.java | 14 +- .../grid/kernal/GridJobExecuteRequest.java | 102 +- .../grid/kernal/GridJobExecuteRequestV2.java | 6 +- .../grid/kernal/GridJobExecuteResponse.java | 30 +- .../grid/kernal/GridJobSiblingsRequest.java | 10 +- .../grid/kernal/GridJobSiblingsResponse.java | 6 +- .../grid/kernal/GridTaskCancelRequest.java | 6 +- .../grid/kernal/GridTaskSessionRequest.java | 14 +- .../managers/checkpoint/GridCheckpointRequest.java | 14 +- .../managers/communication/GridIoMessage.java | 30 +- .../managers/communication/GridIoUserMessage.java | 40 +- .../deployment/GridDeploymentInfoBean.java | 32 +- .../managers/deployment/GridDeploymentRequest.java | 28 +- .../deployment/GridDeploymentResponse.java | 14 +- .../eventstorage/GridEventStorageMessage.java | 48 +- .../processors/cache/GridCacheEvictionRequest.java | 14 +- .../cache/GridCacheEvictionResponse.java | 20 +- .../kernal/processors/cache/GridCacheMessage.java | 14 +- .../GridCacheOptimisticCheckPreparedTxRequest.java | 18 +- ...GridCacheOptimisticCheckPreparedTxResponse.java | 14 +- ...ridCachePessimisticCheckCommittedTxRequest.java | 26 +- ...idCachePessimisticCheckCommittedTxResponse.java | 14 +- .../distributed/GridDistributedBaseMessage.java | 34 +- .../distributed/GridDistributedLockRequest.java | 78 +- .../distributed/GridDistributedLockResponse.java | 20 +- .../GridDistributedTxFinishRequest.java | 62 +- .../GridDistributedTxFinishResponse.java | 10 +- .../GridDistributedTxPrepareRequest.java | 66 +- .../GridDistributedTxPrepareResponse.java | 10 +- .../distributed/GridDistributedUnlockRequest.java | 12 +- .../dht/GridDhtAffinityAssignmentRequest.java | 6 +- .../dht/GridDhtAffinityAssignmentResponse.java | 10 +- .../cache/distributed/dht/GridDhtLockRequest.java | 40 +- .../cache/distributed/dht/GridDhtLockResponse.java | 36 +- .../distributed/dht/GridDhtTxFinishRequest.java | 58 +- .../distributed/dht/GridDhtTxFinishResponse.java | 6 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 56 +- .../distributed/dht/GridDhtTxPrepareResponse.java | 40 +- .../distributed/dht/GridDhtUnlockRequest.java | 12 +- .../GridDhtAtomicDeferredUpdateResponse.java | 12 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 116 +- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 24 +- .../dht/atomic/GridNearAtomicUpdateRequest.java | 98 +- .../dht/atomic/GridNearAtomicUpdateResponse.java | 60 +- .../dht/preloader/GridDhtForceKeysRequest.java | 24 +- .../dht/preloader/GridDhtForceKeysResponse.java | 24 +- .../preloader/GridDhtPartitionDemandMessage.java | 32 +- .../preloader/GridDhtPartitionSupplyMessage.java | 38 +- .../GridDhtPartitionsAbstractMessage.java | 10 +- .../preloader/GridDhtPartitionsFullMessage.java | 14 +- .../preloader/GridDhtPartitionsSingleMessage.java | 6 +- .../preloader/GridDhtPartitionsSingleRequest.java | 2 +- .../cache/distributed/near/GridNearGetRequest.java | 54 +- .../distributed/near/GridNearGetResponse.java | 36 +- .../distributed/near/GridNearLockRequest.java | 54 +- .../distributed/near/GridNearLockResponse.java | 40 +- .../distributed/near/GridNearTxFinishRequest.java | 22 +- .../distributed/near/GridNearTxFinishResponse.java | 14 +- .../distributed/near/GridNearTxPrepareRequest.java | 40 +- .../near/GridNearTxPrepareResponse.java | 44 +- .../distributed/near/GridNearUnlockRequest.java | 2 +- .../cache/query/GridCacheQueryRequest.java | 78 +- .../cache/query/GridCacheQueryResponse.java | 38 +- .../clock/GridClockDeltaSnapshotMessage.java | 20 +- .../continuous/GridContinuousMessage.java | 14 +- .../processors/dataload/GridDataLoadRequest.java | 60 +- .../processors/dataload/GridDataLoadResponse.java | 14 +- .../kernal/processors/ggfs/GridGgfsAckMessage.java | 14 +- .../kernal/processors/ggfs/GridGgfsBlockKey.java | 18 +- .../processors/ggfs/GridGgfsBlocksMessage.java | 24 +- .../ggfs/GridGgfsCommunicationMessage.java | 2 +- .../processors/ggfs/GridGgfsDeleteMessage.java | 10 +- .../processors/ggfs/GridGgfsFileAffinityRange.java | 22 +- .../ggfs/GridGgfsFragmentizerRequest.java | 16 +- .../ggfs/GridGgfsFragmentizerResponse.java | 6 +- .../processors/ggfs/GridGgfsSyncMessage.java | 10 +- .../portable/GridPortableOutputStream.java | 7 - .../message/GridClientHandshakeRequestWrapper.java | 16 +- .../GridClientHandshakeResponseWrapper.java | 2 +- .../client/message/GridClientMessageWrapper.java | 38 +- .../message/GridClientPingPacketWrapper.java | 4 +- .../rest/handlers/task/GridTaskResultRequest.java | 10 +- .../rest/handlers/task/GridTaskResultResponse.java | 18 +- .../protocols/tcp/GridMemcachedMessageWrapper.java | 4 +- .../protocols/tcp/GridTcpRestDirectParser.java | 12 +- .../rest/protocols/tcp/GridTcpRestProtocol.java | 57 +- .../streamer/GridStreamerCancelRequest.java | 6 +- .../streamer/GridStreamerExecutionRequest.java | 40 +- .../processors/streamer/GridStreamerResponse.java | 10 +- .../java/org/gridgain/grid/util/GridLongList.java | 10 +- .../java/org/gridgain/grid/util/GridUtils.java | 34 + .../util/direct/GridPortableByteBufferStream.java | 726 +++++++++++ .../direct/GridTcpCommunicationMessageAdapter.java | 22 - .../direct/GridTcpCommunicationMessageState.java | 1321 ++++++-------------- .../grid/util/ipc/GridIpcToNioAdapter.java | 15 +- .../gridgain/grid/util/nio/GridDirectParser.java | 11 +- .../grid/util/nio/GridNioMessageReader.java | 34 - .../grid/util/nio/GridNioMessageWriter.java | 41 - .../org/gridgain/grid/util/nio/GridNioServer.java | 39 +- .../util/nio/GridShmemCommunicationClient.java | 19 +- .../grid/util/nio/GridTcpCommunicationClient.java | 9 +- .../ignite/spi/communication/GridTestMessage.java | 18 +- .../GridCommunicationSendMessageSelfTest.java | 2 +- 106 files changed, 2373 insertions(+), 2523 deletions(-) create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageReader.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageWriter.java diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 4df54a2..6e43563 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -69,7 +69,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -77,7 +77,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putInt(delta)) + if (!commState.putInt(null, delta)) return false; commState.idx++; @@ -97,7 +97,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - delta = commState.getInt(); + delta = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index 9ba7c45..16d161c 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -15,13 +15,12 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; -import org.apache.ignite.product.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; +import org.apache.ignite.spi.communication.*; import org.apache.ignite.thread.*; import org.gridgain.grid.*; import org.gridgain.grid.kernal.managers.eventstorage.*; -import org.apache.ignite.spi.communication.*; import org.gridgain.grid.util.*; import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.future.*; @@ -324,13 +323,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter ClusterNode locNode = getSpiContext().localNode(); - IgniteProductVersion locVer = locNode.version(); - - IgniteProductVersion rmtVer = rmtNode.version(); - - if (!locVer.equals(rmtVer)) - ses.addMeta(GridNioServer.DIFF_VER_NODE_ID_META_KEY, sndId); - if (ses.remoteAddress() == null) return; @@ -790,87 +782,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter } }; - /** Message reader. */ - private final GridNioMessageReader msgReader = new GridNioMessageReader() { - /** */ - private GridTcpMessageFactory msgFactory; - - @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageReader(this, nodeId); - - boolean finished = msg.readFrom(buf); - - if (finished && nodeId != null) - finished = getSpiContext().readDelta(nodeId, msg.getClass(), buf); - - return finished; - } - - @Nullable @Override public GridTcpMessageFactory messageFactory() { - if (msgFactory == null) - msgFactory = getSpiContext().messageFactory(); - - return msgFactory; - } - }; - - /** Message writer. */ - private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() { - @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageWriter(this, nodeId); - - boolean finished = msg.writeTo(buf); - - if (finished && nodeId != null) - finished = getSpiContext().writeDelta(nodeId, msg, buf); - - return finished; - } - - @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out, - ByteBuffer buf) throws IOException { - assert msg != null; - assert out != null; - assert buf != null; - assert buf.hasArray(); - - msg.messageWriter(this, nodeId); - - boolean finished = false; - int cnt = 0; - - while (!finished) { - finished = msg.writeTo(buf); - - out.write(buf.array(), 0, buf.position()); - - cnt += buf.position(); - - buf.clear(); - } - - if (nodeId != null) { - while (!finished) { - finished = getSpiContext().writeDelta(nodeId, msg.getClass(), buf); - - out.write(buf.array(), 0, buf.position()); - - cnt += buf.position(); - - buf.clear(); - } - } - - return cnt; - } - }; - /** * Sets address resolver. * @@ -1564,9 +1475,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter .sendQueueLimit(msgQueueLimit) .directMode(true) .metricsListener(metricsLsnr) - .messageWriter(msgWriter) .writeTimeout(sockWriteTimeout) - .filters(new GridNioCodecFilter(new GridDirectParser(msgReader, this), log, true), + .filters(new GridNioCodecFilter(new GridDirectParser(this), log, true), new GridConnectionBytesVerifyFilter(log)) .build(); @@ -1925,7 +1835,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter GridCommunicationClient client; try { - client = new GridShmemCommunicationClient(metricsLsnr, port, connTimeout, log, msgWriter); + client = new GridShmemCommunicationClient(metricsLsnr, port, connTimeout, log); } catch (IgniteCheckedException e) { // Reconnect for the second time, if connection is not established. @@ -2066,19 +1976,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter recoveryDesc.release(); } - UUID diffVerNodeId = null; - - IgniteProductVersion locVer = getSpiContext().localNode().version(); - IgniteProductVersion rmtVer = node.version(); - - if (!locVer.equals(rmtVer)) - diffVerNodeId = node.id(); - try { Map meta = new HashMap<>(); meta.put(NODE_ID_META, node.id()); - meta.put(GridNioServer.DIFF_VER_NODE_ID_META_KEY, diffVerNodeId); if (recoveryDesc != null) { recoveryDesc.onHandshake(rcvCnt); @@ -2502,9 +2403,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter metricsLsnr, log, endpoint, - msgWriter, srvLsnr, - new GridNioCodecFilter(new GridDirectParser(msgReader, TcpCommunicationSpi.this), log, true), + new GridNioCodecFilter(new GridDirectParser(TcpCommunicationSpi.this), log, true), new GridConnectionBytesVerifyFilter(log) ); diff --git a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java index a5a27a6..56700e7 100644 --- a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -11,12 +11,11 @@ package org.gridgain.client.impl.connection; import org.apache.ignite.*; import org.apache.ignite.logger.java.*; +import org.apache.ignite.plugin.security.*; import org.gridgain.client.*; import org.gridgain.client.impl.*; import org.gridgain.client.util.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.processors.rest.client.message.*; -import org.apache.ignite.plugin.security.*; import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.nio.*; import org.gridgain.grid.util.nio.ssl.*; @@ -88,44 +87,6 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio /** Marshaller ID. */ private final Byte marshId; - /** Message writer. */ - @SuppressWarnings("FieldCanBeLocal") - private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() { - @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageWriter(this, nodeId); - - return msg.writeTo(buf); - } - - @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out, - ByteBuffer buf) throws IOException { - assert msg != null; - assert out != null; - assert buf != null; - assert buf.hasArray(); - - msg.messageWriter(this, nodeId); - - boolean finished = false; - int cnt = 0; - - while (!finished) { - finished = msg.writeTo(buf); - - out.write(buf.array(), 0, buf.position()); - - cnt += buf.position(); - - buf.clear(); - } - - return cnt; - } - }; - /** * @param clientId Client ID. * @param sslCtx SSL context to enable secured connection or {@code null} to use unsecured one. @@ -173,23 +134,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio GridNioFilter[] filters; - GridNioMessageReader msgReader = new GridNioMessageReader() { - @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, - ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageReader(this, nodeId); - - return msg.readFrom(buf); - } - - @Nullable @Override public GridTcpMessageFactory messageFactory() { - return null; - } - }; - - GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(msgReader), gridLog, true); + GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(), gridLog, true); if (sslCtx != null) { GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog); @@ -217,7 +162,6 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio .socketSendBufferSize(0) .idleTimeout(Long.MAX_VALUE) .gridName("gridClient") - .messageWriter(msgWriter) .daemon(cfg.isDaemon()) .build(); @@ -702,18 +646,9 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio /** Message metadata key. */ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - /** Message reader. */ - private final GridNioMessageReader msgReader; - - /** - * @param msgReader Message reader. - */ - NioParser(GridNioMessageReader msgReader) { - this.msgReader = msgReader; - } - /** {@inheritDoc} */ - @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException { + @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) + throws IOException, IgniteCheckedException { GridClientFutureAdapter handshakeFut = ses.meta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) { @@ -736,7 +671,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio boolean finished = false; if (buf.hasRemaining()) - finished = msgReader.read(null, msg, buf); + finished = msg.readFrom(buf); if (finished) return msg; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java index 90dc740..1c0e1a4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java @@ -126,7 +126,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -134,19 +134,19 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(jobId)) + if (!commState.putGridUuid(null, jobId)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; case 2: - if (!commState.putBoolean(sys)) + if (!commState.putBoolean(null, sys)) return false; commState.idx++; @@ -163,7 +163,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid jobId0 = commState.getGridUuid(); + IgniteUuid jobId0 = commState.getGridUuid(null); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -173,7 +173,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -186,7 +186,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - sys = commState.getBoolean(); + sys = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java index 12f7d8f..2e3eba7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java @@ -449,7 +449,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -457,61 +457,61 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im switch (commState.idx) { case 0: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putString(cpSpi)) + if (!commState.putString(null, cpSpi)) return false; commState.idx++; case 2: - if (!commState.putLong(createTime)) + if (!commState.putLong(null, createTime)) return false; commState.idx++; case 3: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; case 4: - if (!commState.putBoolean(dynamicSiblings)) + if (!commState.putBoolean(null, dynamicSiblings)) return false; commState.idx++; case 5: - if (!commState.putBoolean(forceLocDep)) + if (!commState.putBoolean(null, forceLocDep)) return false; commState.idx++; case 6: - if (!commState.putBoolean(internal)) + if (!commState.putBoolean(null, internal)) return false; commState.idx++; case 7: - if (!commState.putByteArray(jobAttrsBytes)) + if (!commState.putByteArray(null, jobAttrsBytes)) return false; commState.idx++; case 8: - if (!commState.putByteArray(jobBytes)) + if (!commState.putByteArray(null, jobBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(jobId)) + if (!commState.putGridUuid(null, jobId)) return false; commState.idx++; @@ -519,7 +519,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im case 10: if (ldrParticipants != null) { if (commState.it == null) { - if (!commState.putInt(ldrParticipants.size())) + if (!commState.putInt(null, ldrParticipants.size())) return false; commState.it = ldrParticipants.entrySet().iterator(); @@ -532,13 +532,13 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -548,56 +548,56 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 11: - if (!commState.putByteArray(sesAttrsBytes)) + if (!commState.putByteArray(null, sesAttrsBytes)) return false; commState.idx++; case 12: - if (!commState.putBoolean(sesFullSup)) + if (!commState.putBoolean(null, sesFullSup)) return false; commState.idx++; case 13: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; case 14: - if (!commState.putByteArray(siblingsBytes)) + if (!commState.putByteArray(null, siblingsBytes)) return false; commState.idx++; case 15: - if (!commState.putLong(startTaskTime)) + if (!commState.putLong(null, startTaskTime)) return false; commState.idx++; case 16: - if (!commState.putString(taskClsName)) + if (!commState.putString(null, taskClsName)) return false; commState.idx++; case 17: - if (!commState.putString(taskName)) + if (!commState.putString(null, taskName)) return false; commState.idx++; case 18: - if (!commState.putLong(timeout)) + if (!commState.putLong(null, timeout)) return false; commState.idx++; @@ -605,7 +605,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im case 19: if (top != null) { if (commState.it == null) { - if (!commState.putInt(top.size())) + if (!commState.putInt(null, top.size())) return false; commState.it = top.iterator(); @@ -615,7 +615,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putUuid((UUID)commState.cur)) + if (!commState.putUuid(null, (UUID)commState.cur)) return false; commState.cur = NULL; @@ -623,14 +623,14 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 20: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -647,7 +647,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -657,7 +657,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 1: - String cpSpi0 = commState.getString(); + String cpSpi0 = commState.getString(null); if (cpSpi0 == STR_NOT_READ) return false; @@ -670,7 +670,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - createTime = commState.getLong(); + createTime = commState.getLong(null); commState.idx++; @@ -678,7 +678,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -688,7 +688,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - dynamicSiblings = commState.getBoolean(); + dynamicSiblings = commState.getBoolean(null); commState.idx++; @@ -696,7 +696,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(); + forceLocDep = commState.getBoolean(null); commState.idx++; @@ -704,12 +704,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - internal = commState.getBoolean(); + internal = commState.getBoolean(null); commState.idx++; case 7: - byte[] jobAttrsBytes0 = commState.getByteArray(); + byte[] jobAttrsBytes0 = commState.getByteArray(null); if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -719,7 +719,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 8: - byte[] jobBytes0 = commState.getByteArray(); + byte[] jobBytes0 = commState.getByteArray(null); if (jobBytes0 == BYTE_ARR_NOT_READ) return false; @@ -729,7 +729,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 9: - IgniteUuid jobId0 = commState.getGridUuid(); + IgniteUuid jobId0 = commState.getGridUuid(null); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -743,7 +743,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -752,7 +752,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -761,7 +761,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -781,7 +781,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 11: - byte[] sesAttrsBytes0 = commState.getByteArray(); + byte[] sesAttrsBytes0 = commState.getByteArray(null); if (sesAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -794,12 +794,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - sesFullSup = commState.getBoolean(); + sesFullSup = commState.getBoolean(null); commState.idx++; case 13: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -809,7 +809,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 14: - byte[] siblingsBytes0 = commState.getByteArray(); + byte[] siblingsBytes0 = commState.getByteArray(null); if (siblingsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -822,12 +822,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - startTaskTime = commState.getLong(); + startTaskTime = commState.getLong(null); commState.idx++; case 16: - String taskClsName0 = commState.getString(); + String taskClsName0 = commState.getString(null); if (taskClsName0 == STR_NOT_READ) return false; @@ -837,7 +837,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 17: - String taskName0 = commState.getString(); + String taskName0 = commState.getString(null); if (taskName0 == STR_NOT_READ) return false; @@ -850,7 +850,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - timeout = commState.getLong(); + timeout = commState.getLong(null); commState.idx++; @@ -859,7 +859,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -867,7 +867,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im top = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -884,7 +884,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 20: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java index 7793224..cf70842 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java @@ -129,7 +129,7 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -137,7 +137,7 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { switch (commState.idx) { case 21: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; @@ -156,7 +156,7 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { switch (commState.idx) { case 21: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java index b605753..88e7483 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java @@ -221,7 +221,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -229,43 +229,43 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putByteArray(gridExBytes)) + if (!commState.putByteArray(null, gridExBytes)) return false; commState.idx++; case 1: - if (!commState.putBoolean(isCancelled)) + if (!commState.putBoolean(null, isCancelled)) return false; commState.idx++; case 2: - if (!commState.putByteArray(jobAttrsBytes)) + if (!commState.putByteArray(null, jobAttrsBytes)) return false; commState.idx++; case 3: - if (!commState.putGridUuid(jobId)) + if (!commState.putGridUuid(null, jobId)) return false; commState.idx++; case 4: - if (!commState.putUuid(nodeId)) + if (!commState.putUuid(null, nodeId)) return false; commState.idx++; case 5: - if (!commState.putByteArray(resBytes)) + if (!commState.putByteArray(null, resBytes)) return false; commState.idx++; case 6: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; @@ -282,7 +282,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] gridExBytes0 = commState.getByteArray(); + byte[] gridExBytes0 = commState.getByteArray(null); if (gridExBytes0 == BYTE_ARR_NOT_READ) return false; @@ -295,12 +295,12 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - isCancelled = commState.getBoolean(); + isCancelled = commState.getBoolean(null); commState.idx++; case 2: - byte[] jobAttrsBytes0 = commState.getByteArray(); + byte[] jobAttrsBytes0 = commState.getByteArray(null); if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -310,7 +310,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 3: - IgniteUuid jobId0 = commState.getGridUuid(); + IgniteUuid jobId0 = commState.getGridUuid(null); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -320,7 +320,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - UUID nodeId0 = commState.getUuid(); + UUID nodeId0 = commState.getUuid(null); if (nodeId0 == UUID_NOT_READ) return false; @@ -330,7 +330,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 5: - byte[] resBytes0 = commState.getByteArray(); + byte[] resBytes0 = commState.getByteArray(null); if (resBytes0 == BYTE_ARR_NOT_READ) return false; @@ -340,7 +340,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 6: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java index 663a122..a852d23 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java @@ -100,7 +100,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -108,13 +108,13 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; case 1: - if (!commState.putByteArray(topicBytes)) + if (!commState.putByteArray(null, topicBytes)) return false; commState.idx++; @@ -131,7 +131,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -141,7 +141,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray(); + byte[] topicBytes0 = commState.getByteArray(null); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java index b72b03d..55e17f5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java @@ -92,7 +92,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -100,7 +100,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putByteArray(siblingsBytes)) + if (!commState.putByteArray(null, siblingsBytes)) return false; commState.idx++; @@ -117,7 +117,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - byte[] siblingsBytes0 = commState.getByteArray(); + byte[] siblingsBytes0 = commState.getByteArray(null); if (siblingsBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java index 226ebc1..15ae1ad 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java @@ -75,7 +75,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -83,7 +83,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; @@ -100,7 +100,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java index f9f79e0..86457da 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java @@ -115,7 +115,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -123,19 +123,19 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putByteArray(attrsBytes)) + if (!commState.putByteArray(null, attrsBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(jobId)) + if (!commState.putGridUuid(null, jobId)) return false; commState.idx++; case 2: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; @@ -152,7 +152,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] attrsBytes0 = commState.getByteArray(); + byte[] attrsBytes0 = commState.getByteArray(null); if (attrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -162,7 +162,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i commState.idx++; case 1: - IgniteUuid jobId0 = commState.getGridUuid(); + IgniteUuid jobId0 = commState.getGridUuid(null); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -172,7 +172,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java index d054a73..c7ca93c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java @@ -100,7 +100,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -108,19 +108,19 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putString(cpSpi)) + if (!commState.putString(null, cpSpi)) return false; commState.idx++; case 1: - if (!commState.putString(key)) + if (!commState.putString(null, key)) return false; commState.idx++; case 2: - if (!commState.putGridUuid(sesId)) + if (!commState.putGridUuid(null, sesId)) return false; commState.idx++; @@ -137,7 +137,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String cpSpi0 = commState.getString(); + String cpSpi0 = commState.getString(null); if (cpSpi0 == STR_NOT_READ) return false; @@ -147,7 +147,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - String key0 = commState.getString(); + String key0 = commState.getString(null); if (key0 == STR_NOT_READ) return false; @@ -157,7 +157,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid(); + IgniteUuid sesId0 = commState.getGridUuid(null); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java index dc5c91c..d9c11a5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java @@ -214,7 +214,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -222,43 +222,43 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putMessage(msg)) + if (!commState.putMessage(null, msg)) return false; commState.idx++; case 1: - if (!commState.putLong(msgId)) + if (!commState.putLong(null, msgId)) return false; commState.idx++; case 2: - if (!commState.putEnum(plc)) + if (!commState.putEnum(null, plc)) return false; commState.idx++; case 3: - if (!commState.putBoolean(skipOnTimeout)) + if (!commState.putBoolean(null, skipOnTimeout)) return false; commState.idx++; case 4: - if (!commState.putLong(timeout)) + if (!commState.putLong(null, timeout)) return false; commState.idx++; case 5: - if (!commState.putByteArray(topicBytes)) + if (!commState.putByteArray(null, topicBytes)) return false; commState.idx++; case 6: - if (!commState.putInt(topicOrd)) + if (!commState.putInt(null, topicOrd)) return false; commState.idx++; @@ -275,7 +275,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - Object msg0 = commState.getMessage(); + Object msg0 = commState.getMessage(null); if (msg0 == MSG_NOT_READ) return false; @@ -288,7 +288,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - msgId = commState.getLong(); + msgId = commState.getLong(null); commState.idx++; @@ -296,7 +296,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte plc0 = commState.getByte(); + byte plc0 = commState.getByte(null); plc = GridIoPolicy.fromOrdinal(plc0); @@ -306,7 +306,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - skipOnTimeout = commState.getBoolean(); + skipOnTimeout = commState.getBoolean(null); commState.idx++; @@ -314,12 +314,12 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - timeout = commState.getLong(); + timeout = commState.getLong(null); commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray(); + byte[] topicBytes0 = commState.getByteArray(null); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -332,7 +332,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - topicOrd = commState.getInt(); + topicOrd = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java index 4b49798..2859016 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java @@ -226,7 +226,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -234,25 +234,25 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(bodyBytes)) + if (!commState.putByteArray(null, bodyBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putString(depClsName)) + if (!commState.putString(null, depClsName)) return false; commState.idx++; case 3: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; @@ -260,7 +260,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { case 4: if (ldrParties != null) { if (commState.it == null) { - if (!commState.putInt(ldrParties.size())) + if (!commState.putInt(null, ldrParties.size())) return false; commState.it = ldrParties.entrySet().iterator(); @@ -273,13 +273,13 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -289,20 +289,20 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 5: - if (!commState.putByteArray(topicBytes)) + if (!commState.putByteArray(null, topicBytes)) return false; commState.idx++; case 6: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -319,7 +319,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] bodyBytes0 = commState.getByteArray(); + byte[] bodyBytes0 = commState.getByteArray(null); if (bodyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -329,7 +329,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -339,7 +339,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 2: - String depClsName0 = commState.getString(); + String depClsName0 = commState.getString(null); if (depClsName0 == STR_NOT_READ) return false; @@ -352,7 +352,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -363,7 +363,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -372,7 +372,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -381,7 +381,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -401,7 +401,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray(); + byte[] topicBytes0 = commState.getByteArray(null); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -411,7 +411,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 6: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java index e978940..c294a8c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java @@ -156,7 +156,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -164,19 +164,19 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; case 2: - if (!commState.putBoolean(locDepOwner)) + if (!commState.putBoolean(null, locDepOwner)) return false; commState.idx++; @@ -184,7 +184,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i case 3: if (participants != null) { if (commState.it == null) { - if (!commState.putInt(participants.size())) + if (!commState.putInt(null, participants.size())) return false; commState.it = participants.entrySet().iterator(); @@ -197,13 +197,13 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -213,14 +213,14 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 4: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -237,7 +237,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -250,7 +250,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -260,7 +260,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - locDepOwner = commState.getBoolean(); + locDepOwner = commState.getBoolean(null); commState.idx++; @@ -269,7 +269,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -278,7 +278,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -287,7 +287,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -307,7 +307,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java index 6565ea0..ffcd805 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java @@ -175,7 +175,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -183,13 +183,13 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putBoolean(isUndeploy)) + if (!commState.putBoolean(null, isUndeploy)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(ldrId)) + if (!commState.putGridUuid(null, ldrId)) return false; commState.idx++; @@ -197,7 +197,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { case 2: if (nodeIds != null) { if (commState.it == null) { - if (!commState.putInt(nodeIds.size())) + if (!commState.putInt(null, nodeIds.size())) return false; commState.it = nodeIds.iterator(); @@ -207,7 +207,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putUuid((UUID)commState.cur)) + if (!commState.putUuid(null, (UUID)commState.cur)) return false; commState.cur = NULL; @@ -215,20 +215,20 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 3: - if (!commState.putByteArray(resTopicBytes)) + if (!commState.putByteArray(null, resTopicBytes)) return false; commState.idx++; case 4: - if (!commState.putString(rsrcName)) + if (!commState.putString(null, rsrcName)) return false; commState.idx++; @@ -248,12 +248,12 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - isUndeploy = commState.getBoolean(); + isUndeploy = commState.getBoolean(null); commState.idx++; case 1: - IgniteUuid ldrId0 = commState.getGridUuid(); + IgniteUuid ldrId0 = commState.getGridUuid(null); if (ldrId0 == GRID_UUID_NOT_READ) return false; @@ -267,7 +267,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -275,7 +275,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { nodeIds = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -292,7 +292,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 3: - byte[] resTopicBytes0 = commState.getByteArray(); + byte[] resTopicBytes0 = commState.getByteArray(null); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -302,7 +302,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 4: - String rsrcName0 = commState.getString(); + String rsrcName0 = commState.getString(null); if (rsrcName0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java index ea30da8..3d8e7ac 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java @@ -123,7 +123,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -131,19 +131,19 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArrayList(byteSrc)) + if (!commState.putByteArrayList(null, byteSrc)) return false; commState.idx++; case 1: - if (!commState.putString(errMsg)) + if (!commState.putString(null, errMsg)) return false; commState.idx++; case 2: - if (!commState.putBoolean(success)) + if (!commState.putBoolean(null, success)) return false; commState.idx++; @@ -160,7 +160,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - GridByteArrayList byteSrc0 = commState.getByteArrayList(); + GridByteArrayList byteSrc0 = commState.getByteArrayList(null); if (byteSrc0 == BYTE_ARR_LIST_NOT_READ) return false; @@ -170,7 +170,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - String errMsg0 = commState.getString(); + String errMsg0 = commState.getString(null); if (errMsg0 == STR_NOT_READ) return false; @@ -183,7 +183,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - success = commState.getBoolean(); + success = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java index ae0436a..f80707a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java @@ -286,7 +286,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -294,37 +294,37 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; case 2: - if (!commState.putByteArray(evtsBytes)) + if (!commState.putByteArray(null, evtsBytes)) return false; commState.idx++; case 3: - if (!commState.putByteArray(exBytes)) + if (!commState.putByteArray(null, exBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(filter)) + if (!commState.putByteArray(null, filter)) return false; commState.idx++; case 5: - if (!commState.putString(filterClsName)) + if (!commState.putString(null, filterClsName)) return false; commState.idx++; @@ -332,7 +332,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter case 6: if (ldrParties != null) { if (commState.it == null) { - if (!commState.putInt(ldrParties.size())) + if (!commState.putInt(null, ldrParties.size())) return false; commState.it = ldrParties.entrySet().iterator(); @@ -345,13 +345,13 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -361,20 +361,20 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 7: - if (!commState.putByteArray(resTopicBytes)) + if (!commState.putByteArray(null, resTopicBytes)) return false; commState.idx++; case 8: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -391,7 +391,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -404,14 +404,14 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 2: - byte[] evtsBytes0 = commState.getByteArray(); + byte[] evtsBytes0 = commState.getByteArray(null); if (evtsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -421,7 +421,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 3: - byte[] exBytes0 = commState.getByteArray(); + byte[] exBytes0 = commState.getByteArray(null); if (exBytes0 == BYTE_ARR_NOT_READ) return false; @@ -431,7 +431,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 4: - byte[] filter0 = commState.getByteArray(); + byte[] filter0 = commState.getByteArray(null); if (filter0 == BYTE_ARR_NOT_READ) return false; @@ -441,7 +441,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 5: - String filterClsName0 = commState.getString(); + String filterClsName0 = commState.getString(null); if (filterClsName0 == STR_NOT_READ) return false; @@ -455,7 +455,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -464,7 +464,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -473,7 +473,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -493,7 +493,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 7: - byte[] resTopicBytes0 = commState.getByteArray(); + byte[] resTopicBytes0 = commState.getByteArray(null); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -503,7 +503,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 8: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java index fd36e15..8a1f0b9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java @@ -161,7 +161,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -169,19 +169,19 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple switch (commState.idx) { case 3: - if (!commState.putByteArray(entriesBytes)) + if (!commState.putByteArray(null, entriesBytes)) return false; commState.idx++; case 4: - if (!commState.putLong(futId)) + if (!commState.putLong(null, futId)) return false; commState.idx++; case 5: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; @@ -201,7 +201,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray(); + byte[] entriesBytes0 = commState.getByteArray(null); if (entriesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -214,7 +214,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple if (buf.remaining() < 8) return false; - futId = commState.getLong(); + futId = commState.getLong(null); commState.idx++; @@ -222,7 +222,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java index b241043..203b99d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java @@ -151,7 +151,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -159,13 +159,13 @@ public class GridCacheEvictionResponse extends GridCacheMessage { switch (commState.idx) { case 3: - if (!commState.putBoolean(err)) + if (!commState.putBoolean(null, err)) return false; commState.idx++; case 4: - if (!commState.putLong(futId)) + if (!commState.putLong(null, futId)) return false; commState.idx++; @@ -173,7 +173,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { case 5: if (rejectedKeyBytes != null) { if (commState.it == null) { - if (!commState.putInt(rejectedKeyBytes.size())) + if (!commState.putInt(null, rejectedKeyBytes.size())) return false; commState.it = rejectedKeyBytes.iterator(); @@ -183,7 +183,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -191,7 +191,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -215,7 +215,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (buf.remaining() < 1) return false; - err = commState.getBoolean(); + err = commState.getBoolean(null); commState.idx++; @@ -223,7 +223,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (buf.remaining() < 8) return false; - futId = commState.getLong(); + futId = commState.getLong(null); commState.idx++; @@ -232,7 +232,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -240,7 +240,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { rejectedKeyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java index 71eac41..ea7987d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java @@ -586,7 +586,7 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -594,19 +594,19 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage switch (commState.idx) { case 0: - if (!commState.putInt(cacheId)) + if (!commState.putInt(null, cacheId)) return false; commState.idx++; case 1: - if (!commState.putMessage(depInfo)) + if (!commState.putMessage(null, depInfo)) return false; commState.idx++; case 2: - if (!commState.putLong(msgId)) + if (!commState.putLong(null, msgId)) return false; commState.idx++; @@ -626,12 +626,12 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage if (buf.remaining() < 4) return false; - cacheId = commState.getInt(); + cacheId = commState.getInt(null); commState.idx++; case 1: - Object depInfo0 = commState.getMessage(); + Object depInfo0 = commState.getMessage(null); if (depInfo0 == MSG_NOT_READ) return false; @@ -644,7 +644,7 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage if (buf.remaining() < 8) return false; - msgId = commState.getLong(); + msgId = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index 693f1ff..88c087f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -118,7 +118,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -126,25 +126,25 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib switch (commState.idx) { case 8: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(nearXidVer)) + if (!commState.putCacheVersion(null, nearXidVer)) return false; commState.idx++; case 11: - if (!commState.putInt(txNum)) + if (!commState.putInt(null, txNum)) return false; commState.idx++; @@ -164,7 +164,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -174,7 +174,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -184,7 +184,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -197,7 +197,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib if (buf.remaining() < 4) return false; - txNum = commState.getInt(); + txNum = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index 21c2256..1baa17a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -106,7 +106,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -114,19 +114,19 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri switch (commState.idx) { case 8: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 10: - if (!commState.putBoolean(success)) + if (!commState.putBoolean(null, success)) return false; commState.idx++; @@ -146,7 +146,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -156,7 +156,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -169,7 +169,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri if (buf.remaining() < 1) return false; - success = commState.getBoolean(); + success = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index b7f8c2a..89b1a4b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -153,7 +153,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -161,37 +161,37 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr switch (commState.idx) { case 8: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(nearXidVer)) + if (!commState.putCacheVersion(null, nearXidVer)) return false; commState.idx++; case 11: - if (!commState.putUuid(originatingNodeId)) + if (!commState.putUuid(null, originatingNodeId)) return false; commState.idx++; case 12: - if (!commState.putLong(originatingThreadId)) + if (!commState.putLong(null, originatingThreadId)) return false; commState.idx++; case 13: - if (!commState.putBoolean(nearOnlyCheck)) + if (!commState.putBoolean(null, nearOnlyCheck)) return false; commState.idx++; @@ -211,7 +211,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -221,7 +221,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -231,7 +231,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -241,7 +241,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 11: - UUID originatingNodeId0 = commState.getUuid(); + UUID originatingNodeId0 = commState.getUuid(null); if (originatingNodeId0 == UUID_NOT_READ) return false; @@ -254,7 +254,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr if (buf.remaining() < 8) return false; - originatingThreadId = commState.getLong(); + originatingThreadId = commState.getLong(null); commState.idx++; @@ -262,7 +262,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr if (buf.remaining() < 1) return false; - nearOnlyCheck = commState.getBoolean(); + nearOnlyCheck = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 529edcb..88f354b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -137,7 +137,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -145,19 +145,19 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist switch (commState.idx) { case 8: - if (!commState.putByteArray(committedTxInfoBytes)) + if (!commState.putByteArray(null, committedTxInfoBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 10: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -177,7 +177,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist switch (commState.idx) { case 8: - byte[] committedTxInfoBytes0 = commState.getByteArray(); + byte[] committedTxInfoBytes0 = commState.getByteArray(null); if (committedTxInfoBytes0 == BYTE_ARR_NOT_READ) return false; @@ -187,7 +187,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -197,7 +197,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist commState.idx++; case 10: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java index fd96d32..3a0a86f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -255,7 +255,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -263,13 +263,13 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< switch (commState.idx) { case 3: - if (!commState.putByteArray(candsByIdxBytes)) + if (!commState.putByteArray(null, candsByIdxBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(candsByKeyBytes)) + if (!commState.putByteArray(null, candsByKeyBytes)) return false; commState.idx++; @@ -277,7 +277,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< case 5: if (committedVers != null) { if (commState.it == null) { - if (!commState.putInt(committedVers.size())) + if (!commState.putInt(null, committedVers.size())) return false; commState.it = committedVers.iterator(); @@ -287,7 +287,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -295,7 +295,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -304,7 +304,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< case 6: if (rolledbackVers != null) { if (commState.it == null) { - if (!commState.putInt(rolledbackVers.size())) + if (!commState.putInt(null, rolledbackVers.size())) return false; commState.it = rolledbackVers.iterator(); @@ -314,7 +314,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -322,14 +322,14 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 7: - if (!commState.putCacheVersion(ver)) + if (!commState.putCacheVersion(null, ver)) return false; commState.idx++; @@ -349,7 +349,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< switch (commState.idx) { case 3: - byte[] candsByIdxBytes0 = commState.getByteArray(); + byte[] candsByIdxBytes0 = commState.getByteArray(null); if (candsByIdxBytes0 == BYTE_ARR_NOT_READ) return false; @@ -359,7 +359,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 4: - byte[] candsByKeyBytes0 = commState.getByteArray(); + byte[] candsByKeyBytes0 = commState.getByteArray(null); if (candsByKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -373,7 +373,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -381,7 +381,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< committedVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -402,7 +402,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -410,7 +410,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< rolledbackVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -427,7 +427,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 7: - GridCacheVersion ver0 = commState.getCacheVersion(); + GridCacheVersion ver0 = commState.getCacheVersion(null); if (ver0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java index 519c3b7..add0721 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java @@ -463,7 +463,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -473,7 +473,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage case 8: if (drVersByIdx != null) { if (commState.it == null) { - if (!commState.putInt(drVersByIdx.length)) + if (!commState.putInt(null, drVersByIdx.length)) return false; commState.it = arrayIterator(drVersByIdx); @@ -483,7 +483,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -491,44 +491,44 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 9: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 10: - if (!commState.putByteArray(grpLockKeyBytes)) + if (!commState.putByteArray(null, grpLockKeyBytes)) return false; commState.idx++; case 11: - if (!commState.putBoolean(isInTx)) + if (!commState.putBoolean(null, isInTx)) return false; commState.idx++; case 12: - if (!commState.putBoolean(isInvalidate)) + if (!commState.putBoolean(null, isInvalidate)) return false; commState.idx++; case 13: - if (!commState.putBoolean(isRead)) + if (!commState.putBoolean(null, isRead)) return false; commState.idx++; case 14: - if (!commState.putEnum(isolation)) + if (!commState.putEnum(null, isolation)) return false; commState.idx++; @@ -536,7 +536,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage case 15: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.iterator(); @@ -546,7 +546,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -554,56 +554,56 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 16: - if (!commState.putCacheVersion(nearXidVer)) + if (!commState.putCacheVersion(null, nearXidVer)) return false; commState.idx++; case 17: - if (!commState.putUuid(nodeId)) + if (!commState.putUuid(null, nodeId)) return false; commState.idx++; case 18: - if (!commState.putBoolean(partLock)) + if (!commState.putBoolean(null, partLock)) return false; commState.idx++; case 19: - if (!commState.putBooleanArray(retVals)) + if (!commState.putBooleanArray(null, retVals)) return false; commState.idx++; case 20: - if (!commState.putLong(threadId)) + if (!commState.putLong(null, threadId)) return false; commState.idx++; case 21: - if (!commState.putLong(timeout)) + if (!commState.putLong(null, timeout)) return false; commState.idx++; case 22: - if (!commState.putInt(txSize)) + if (!commState.putInt(null, txSize)) return false; commState.idx++; case 23: - if (!commState.putByteArray(writeEntriesBytes)) + if (!commState.putByteArray(null, writeEntriesBytes)) return false; commState.idx++; @@ -627,7 +627,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -635,7 +635,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage drVersByIdx = new GridCacheVersion[commState.readSize]; for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -652,7 +652,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -662,7 +662,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 10: - byte[] grpLockKeyBytes0 = commState.getByteArray(); + byte[] grpLockKeyBytes0 = commState.getByteArray(null); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -675,7 +675,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isInTx = commState.getBoolean(); + isInTx = commState.getBoolean(null); commState.idx++; @@ -683,7 +683,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isInvalidate = commState.getBoolean(); + isInvalidate = commState.getBoolean(null); commState.idx++; @@ -691,7 +691,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isRead = commState.getBoolean(); + isRead = commState.getBoolean(null); commState.idx++; @@ -699,7 +699,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(); + byte isolation0 = commState.getByte(null); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); @@ -710,7 +710,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -718,7 +718,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage keyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -735,7 +735,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 16: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -745,7 +745,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 17: - UUID nodeId0 = commState.getUuid(); + UUID nodeId0 = commState.getUuid(null); if (nodeId0 == UUID_NOT_READ) return false; @@ -758,12 +758,12 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - partLock = commState.getBoolean(); + partLock = commState.getBoolean(null); commState.idx++; case 19: - boolean[] retVals0 = commState.getBooleanArray(); + boolean[] retVals0 = commState.getBooleanArray(null); if (retVals0 == BOOLEAN_ARR_NOT_READ) return false; @@ -776,7 +776,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 8) return false; - threadId = commState.getLong(); + threadId = commState.getLong(null); commState.idx++; @@ -784,7 +784,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 8) return false; - timeout = commState.getLong(); + timeout = commState.getLong(null); commState.idx++; @@ -792,12 +792,12 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 4) return false; - txSize = commState.getInt(); + txSize = commState.getInt(null); commState.idx++; case 23: - byte[] writeEntriesBytes0 = commState.getByteArray(); + byte[] writeEntriesBytes0 = commState.getByteArray(null); if (writeEntriesBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java index 8edfc7c..cf94059 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java @@ -287,7 +287,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -295,13 +295,13 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag switch (commState.idx) { case 8: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -309,7 +309,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag case 10: if (valBytes != null) { if (commState.it == null) { - if (!commState.putInt(valBytes.size())) + if (!commState.putInt(null, valBytes.size())) return false; commState.it = valBytes.iterator(); @@ -319,7 +319,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putValueBytes((GridCacheValueBytes)commState.cur)) + if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) return false; commState.cur = NULL; @@ -327,7 +327,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -348,7 +348,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag switch (commState.idx) { case 8: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -358,7 +358,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -372,7 +372,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -380,7 +380,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag valBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(); + GridCacheValueBytes _val = commState.getValueBytes(null); if (_val == VAL_BYTES_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java index d2093c2..8ffbc3d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -361,7 +361,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -369,49 +369,49 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes switch (commState.idx) { case 8: - if (!commState.putCacheVersion(baseVer)) + if (!commState.putCacheVersion(null, baseVer)) return false; commState.idx++; case 9: - if (!commState.putBoolean(commit)) + if (!commState.putBoolean(null, commit)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(commitVer)) + if (!commState.putCacheVersion(null, commitVer)) return false; commState.idx++; case 11: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 12: - if (!commState.putByteArray(grpLockKeyBytes)) + if (!commState.putByteArray(null, grpLockKeyBytes)) return false; commState.idx++; case 13: - if (!commState.putBoolean(invalidate)) + if (!commState.putBoolean(null, invalidate)) return false; commState.idx++; case 14: - if (!commState.putBoolean(syncCommit)) + if (!commState.putBoolean(null, syncCommit)) return false; commState.idx++; case 15: - if (!commState.putBoolean(syncRollback)) + if (!commState.putBoolean(null, syncRollback)) return false; commState.idx++; @@ -419,7 +419,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes case 16: if (recoveryWritesBytes != null) { if (commState.it == null) { - if (!commState.putInt(recoveryWritesBytes.size())) + if (!commState.putInt(null, recoveryWritesBytes.size())) return false; commState.it = recoveryWritesBytes.iterator(); @@ -429,7 +429,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -437,20 +437,20 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 17: - if (!commState.putLong(threadId)) + if (!commState.putLong(null, threadId)) return false; commState.idx++; case 18: - if (!commState.putInt(txSize)) + if (!commState.putInt(null, txSize)) return false; commState.idx++; @@ -458,7 +458,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes case 19: if (writeEntriesBytes != null) { if (commState.it == null) { - if (!commState.putInt(writeEntriesBytes.size())) + if (!commState.putInt(null, writeEntriesBytes.size())) return false; commState.it = writeEntriesBytes.iterator(); @@ -468,7 +468,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -476,7 +476,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -497,7 +497,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes switch (commState.idx) { case 8: - GridCacheVersion baseVer0 = commState.getCacheVersion(); + GridCacheVersion baseVer0 = commState.getCacheVersion(null); if (baseVer0 == CACHE_VER_NOT_READ) return false; @@ -510,12 +510,12 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - commit = commState.getBoolean(); + commit = commState.getBoolean(null); commState.idx++; case 10: - GridCacheVersion commitVer0 = commState.getCacheVersion(); + GridCacheVersion commitVer0 = commState.getCacheVersion(null); if (commitVer0 == CACHE_VER_NOT_READ) return false; @@ -525,7 +525,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -535,7 +535,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 12: - byte[] grpLockKeyBytes0 = commState.getByteArray(); + byte[] grpLockKeyBytes0 = commState.getByteArray(null); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -548,7 +548,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - invalidate = commState.getBoolean(); + invalidate = commState.getBoolean(null); commState.idx++; @@ -556,7 +556,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - syncCommit = commState.getBoolean(); + syncCommit = commState.getBoolean(null); commState.idx++; @@ -564,7 +564,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - syncRollback = commState.getBoolean(); + syncRollback = commState.getBoolean(null); commState.idx++; @@ -573,7 +573,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -581,7 +581,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes recoveryWritesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -601,7 +601,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 8) return false; - threadId = commState.getLong(); + threadId = commState.getLong(null); commState.idx++; @@ -609,7 +609,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 4) return false; - txSize = commState.getInt(); + txSize = commState.getInt(null); commState.idx++; @@ -618,7 +618,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -626,7 +626,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes writeEntriesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java index 4481668..eb68e05 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -94,7 +94,7 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedBaseMe return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -434,43 +434,43 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe switch (commState.idx) { case 8: - if (!commState.putCacheVersion(commitVer)) + if (!commState.putCacheVersion(null, commitVer)) return false; commState.idx++; case 9: - if (!commState.putEnum(concurrency)) + if (!commState.putEnum(null, concurrency)) return false; commState.idx++; case 10: - if (!commState.putByteArray(dhtVersBytes)) + if (!commState.putByteArray(null, dhtVersBytes)) return false; commState.idx++; case 11: - if (!commState.putByteArray(grpLockKeyBytes)) + if (!commState.putByteArray(null, grpLockKeyBytes)) return false; commState.idx++; case 12: - if (!commState.putBoolean(invalidate)) + if (!commState.putBoolean(null, invalidate)) return false; commState.idx++; case 13: - if (!commState.putEnum(isolation)) + if (!commState.putEnum(null, isolation)) return false; commState.idx++; case 14: - if (!commState.putBoolean(partLock)) + if (!commState.putBoolean(null, partLock)) return false; commState.idx++; @@ -478,7 +478,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe case 15: if (readsBytes != null) { if (commState.it == null) { - if (!commState.putInt(readsBytes.size())) + if (!commState.putInt(null, readsBytes.size())) return false; commState.it = readsBytes.iterator(); @@ -488,7 +488,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -496,32 +496,32 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 16: - if (!commState.putLong(threadId)) + if (!commState.putLong(null, threadId)) return false; commState.idx++; case 17: - if (!commState.putLong(timeout)) + if (!commState.putLong(null, timeout)) return false; commState.idx++; case 18: - if (!commState.putByteArray(txNodesBytes)) + if (!commState.putByteArray(null, txNodesBytes)) return false; commState.idx++; case 19: - if (!commState.putInt(txSize)) + if (!commState.putInt(null, txSize)) return false; commState.idx++; @@ -529,7 +529,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe case 20: if (writesBytes != null) { if (commState.it == null) { - if (!commState.putInt(writesBytes.size())) + if (!commState.putInt(null, writesBytes.size())) return false; commState.it = writesBytes.iterator(); @@ -539,7 +539,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -547,7 +547,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -568,7 +568,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe switch (commState.idx) { case 8: - GridCacheVersion commitVer0 = commState.getCacheVersion(); + GridCacheVersion commitVer0 = commState.getCacheVersion(null); if (commitVer0 == CACHE_VER_NOT_READ) return false; @@ -581,14 +581,14 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - byte concurrency0 = commState.getByte(); + byte concurrency0 = commState.getByte(null); concurrency = GridCacheTxConcurrency.fromOrdinal(concurrency0); commState.idx++; case 10: - byte[] dhtVersBytes0 = commState.getByteArray(); + byte[] dhtVersBytes0 = commState.getByteArray(null); if (dhtVersBytes0 == BYTE_ARR_NOT_READ) return false; @@ -598,7 +598,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; case 11: - byte[] grpLockKeyBytes0 = commState.getByteArray(); + byte[] grpLockKeyBytes0 = commState.getByteArray(null); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -611,7 +611,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - invalidate = commState.getBoolean(); + invalidate = commState.getBoolean(null); commState.idx++; @@ -619,7 +619,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(); + byte isolation0 = commState.getByte(null); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); @@ -629,7 +629,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - partLock = commState.getBoolean(); + partLock = commState.getBoolean(null); commState.idx++; @@ -638,7 +638,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -646,7 +646,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe readsBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -666,7 +666,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 8) return false; - threadId = commState.getLong(); + threadId = commState.getLong(null); commState.idx++; @@ -674,12 +674,12 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 8) return false; - timeout = commState.getLong(); + timeout = commState.getLong(null); commState.idx++; case 18: - byte[] txNodesBytes0 = commState.getByteArray(); + byte[] txNodesBytes0 = commState.getByteArray(null); if (txNodesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -692,7 +692,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 4) return false; - txSize = commState.getInt(); + txSize = commState.getInt(null); commState.idx++; @@ -701,7 +701,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -709,7 +709,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe writesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index 2987382..2754c9e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -171,7 +171,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -179,13 +179,13 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM switch (commState.idx) { case 8: - if (!commState.putByteArray(candsBytes)) + if (!commState.putByteArray(null, candsBytes)) return false; commState.idx++; case 9: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; @@ -205,7 +205,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM switch (commState.idx) { case 8: - byte[] candsBytes0 = commState.getByteArray(); + byte[] candsBytes0 = commState.getByteArray(null); if (candsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -215,7 +215,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM commState.idx++; case 9: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java index 93e3ccf..aa0772e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -136,7 +136,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -146,7 +146,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa case 8: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.iterator(); @@ -156,7 +156,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -164,7 +164,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -189,7 +189,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -197,7 +197,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa keyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index fc580ea..ef4e7ba 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -85,7 +85,7 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -348,13 +348,13 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { switch (commState.idx) { case 24: - if (!commState.putBitSet(invalidateEntries)) + if (!commState.putBitSet(null, invalidateEntries)) return false; commState.idx++; case 25: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -362,7 +362,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { case 26: if (nearKeyBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearKeyBytes.size())) + if (!commState.putInt(null, nearKeyBytes.size())) return false; commState.it = nearKeyBytes.iterator(); @@ -372,7 +372,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -380,38 +380,38 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 27: - if (!commState.putByteArray(ownedBytes)) + if (!commState.putByteArray(null, ownedBytes)) return false; commState.idx++; case 28: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 29: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 30: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; case 31: - if (!commState.putBitSet(preloadKeys)) + if (!commState.putBitSet(null, preloadKeys)) return false; commState.idx++; @@ -431,7 +431,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { switch (commState.idx) { case 24: - BitSet invalidateEntries0 = commState.getBitSet(); + BitSet invalidateEntries0 = commState.getBitSet(null); if (invalidateEntries0 == BIT_SET_NOT_READ) return false; @@ -441,7 +441,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -455,7 +455,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -463,7 +463,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { nearKeyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -480,7 +480,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 27: - byte[] ownedBytes0 = commState.getByteArray(); + byte[] ownedBytes0 = commState.getByteArray(null); if (ownedBytes0 == BYTE_ARR_NOT_READ) return false; @@ -493,12 +493,12 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 29: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -511,12 +511,12 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; case 31: - BitSet preloadKeys0 = commState.getBitSet(); + BitSet preloadKeys0 = commState.getBitSet(null); if (preloadKeys0 == BIT_SET_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java index 3a86b4e..2563a31 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -222,7 +222,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -232,7 +232,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 11: if (invalidParts != null) { if (commState.it == null) { - if (!commState.putInt(invalidParts.size())) + if (!commState.putInt(null, invalidParts.size())) return false; commState.it = invalidParts.iterator(); @@ -242,7 +242,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -250,14 +250,14 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 12: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -265,7 +265,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 13: if (nearEvictedBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearEvictedBytes.size())) + if (!commState.putInt(null, nearEvictedBytes.size())) return false; commState.it = nearEvictedBytes.iterator(); @@ -275,7 +275,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -283,7 +283,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -292,7 +292,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 14: if (preloadEntriesBytes != null) { if (commState.it == null) { - if (!commState.putInt(preloadEntriesBytes.size())) + if (!commState.putInt(null, preloadEntriesBytes.size())) return false; commState.it = preloadEntriesBytes.iterator(); @@ -302,7 +302,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -310,7 +310,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -335,7 +335,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -346,7 +346,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); invalidParts.add((Integer)_val); @@ -360,7 +360,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -374,7 +374,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -382,7 +382,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse nearEvictedBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -403,7 +403,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -411,7 +411,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse preloadEntriesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index c5db862..105787f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -315,7 +315,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -323,19 +323,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest switch (commState.idx) { case 20: - if (!commState.putEnum(isolation)) + if (!commState.putEnum(null, isolation)) return false; commState.idx++; case 21: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 22: - if (!commState.putUuid(nearNodeId)) + if (!commState.putUuid(null, nearNodeId)) return false; commState.idx++; @@ -343,7 +343,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 23: if (nearWritesBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearWritesBytes.size())) + if (!commState.putInt(null, nearWritesBytes.size())) return false; commState.it = nearWritesBytes.iterator(); @@ -353,7 +353,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -361,14 +361,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 24: - if (!commState.putBoolean(onePhaseCommit)) + if (!commState.putBoolean(null, onePhaseCommit)) return false; commState.idx++; @@ -376,7 +376,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 25: if (pendingVers != null) { if (commState.it == null) { - if (!commState.putInt(pendingVers.size())) + if (!commState.putInt(null, pendingVers.size())) return false; commState.it = pendingVers.iterator(); @@ -386,7 +386,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -394,38 +394,38 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 26: - if (!commState.putBoolean(sysInvalidate)) + if (!commState.putBoolean(null, sysInvalidate)) return false; commState.idx++; case 27: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 28: - if (!commState.putCacheVersion(writeVer)) + if (!commState.putCacheVersion(null, writeVer)) return false; commState.idx++; case 29: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 30: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -448,14 +448,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(); + byte isolation0 = commState.getByte(null); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); commState.idx++; case 21: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -465,7 +465,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 22: - UUID nearNodeId0 = commState.getUuid(); + UUID nearNodeId0 = commState.getUuid(null); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -479,7 +479,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -487,7 +487,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest nearWritesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -507,7 +507,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - onePhaseCommit = commState.getBoolean(); + onePhaseCommit = commState.getBoolean(null); commState.idx++; @@ -516,7 +516,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -524,7 +524,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest pendingVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -544,7 +544,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - sysInvalidate = commState.getBoolean(); + sysInvalidate = commState.getBoolean(null); commState.idx++; @@ -552,12 +552,12 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 28: - GridCacheVersion writeVer0 = commState.getCacheVersion(); + GridCacheVersion writeVer0 = commState.getCacheVersion(null); if (writeVer0 == CACHE_VER_NOT_READ) return false; @@ -567,7 +567,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 29: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -580,7 +580,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index bab9219..b64e780 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -88,7 +88,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -96,7 +96,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon switch (commState.idx) { case 5: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -116,7 +116,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon switch (commState.idx) { case 5: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java index 61dfe70..1455e5d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java @@ -345,7 +345,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -353,31 +353,31 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 21: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 22: - if (!commState.putBitSet(invalidateNearEntries)) + if (!commState.putBitSet(null, invalidateNearEntries)) return false; commState.idx++; case 23: - if (!commState.putBoolean(last)) + if (!commState.putBoolean(null, last)) return false; commState.idx++; case 24: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 25: - if (!commState.putUuid(nearNodeId)) + if (!commState.putUuid(null, nearNodeId)) return false; commState.idx++; @@ -385,7 +385,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque case 26: if (nearWritesBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearWritesBytes.size())) + if (!commState.putInt(null, nearWritesBytes.size())) return false; commState.it = nearWritesBytes.iterator(); @@ -395,7 +395,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -403,44 +403,44 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 27: - if (!commState.putCacheVersion(nearXidVer)) + if (!commState.putCacheVersion(null, nearXidVer)) return false; commState.idx++; case 28: - if (!commState.putByteArray(ownedBytes)) + if (!commState.putByteArray(null, ownedBytes)) return false; commState.idx++; case 29: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 30: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 31: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; case 32: - if (!commState.putBitSet(preloadKeys)) + if (!commState.putBitSet(null, preloadKeys)) return false; commState.idx++; @@ -460,7 +460,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 21: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -470,7 +470,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 22: - BitSet invalidateNearEntries0 = commState.getBitSet(); + BitSet invalidateNearEntries0 = commState.getBitSet(null); if (invalidateNearEntries0 == BIT_SET_NOT_READ) return false; @@ -483,12 +483,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 1) return false; - last = commState.getBoolean(); + last = commState.getBoolean(null); commState.idx++; case 24: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -498,7 +498,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 25: - UUID nearNodeId0 = commState.getUuid(); + UUID nearNodeId0 = commState.getUuid(null); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -512,7 +512,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -520,7 +520,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque nearWritesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -537,7 +537,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 27: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -547,7 +547,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 28: - byte[] ownedBytes0 = commState.getByteArray(); + byte[] ownedBytes0 = commState.getByteArray(null); if (ownedBytes0 == BYTE_ARR_NOT_READ) return false; @@ -560,12 +560,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 30: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -578,12 +578,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; case 32: - BitSet preloadKeys0 = commState.getBitSet(); + BitSet preloadKeys0 = commState.getBitSet(null); if (preloadKeys0 == BIT_SET_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index 1ada909..d541b58 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -229,7 +229,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -237,7 +237,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp switch (commState.idx) { case 10: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -245,7 +245,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 11: if (invalidParts != null) { if (commState.it == null) { - if (!commState.putInt(invalidParts.size())) + if (!commState.putInt(null, invalidParts.size())) return false; commState.it = invalidParts.iterator(); @@ -255,7 +255,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -263,14 +263,14 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 12: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -278,7 +278,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 13: if (nearEvictedBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearEvictedBytes.size())) + if (!commState.putInt(null, nearEvictedBytes.size())) return false; commState.it = nearEvictedBytes.iterator(); @@ -288,7 +288,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -296,7 +296,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -305,7 +305,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 14: if (preloadEntriesBytes != null) { if (commState.it == null) { - if (!commState.putInt(preloadEntriesBytes.size())) + if (!commState.putInt(null, preloadEntriesBytes.size())) return false; commState.it = preloadEntriesBytes.iterator(); @@ -315,7 +315,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -323,7 +323,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -344,7 +344,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp switch (commState.idx) { case 10: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -358,7 +358,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -369,7 +369,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); invalidParts.add((Integer)_val); @@ -383,7 +383,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -397,7 +397,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -405,7 +405,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp nearEvictedBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -426,7 +426,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -434,7 +434,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp preloadEntriesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 4a5a5a0..3a4c289 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -124,7 +124,7 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest= 0) { @@ -185,7 +185,7 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java index e04099c..f86a28c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java @@ -91,7 +91,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -101,7 +101,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< case 3: if (futVers != null) { if (commState.it == null) { - if (!commState.putInt(futVers.size())) + if (!commState.putInt(null, futVers.size())) return false; commState.it = futVers.iterator(); @@ -111,7 +111,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -119,7 +119,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -144,7 +144,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -152,7 +152,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< futVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index ad3f8da..6e084f3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -644,7 +644,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -652,13 +652,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp switch (commState.idx) { case 3: - if (!commState.putLongList(drExpireTimes)) + if (!commState.putLongList(null, drExpireTimes)) return false; commState.idx++; case 4: - if (!commState.putLongList(drTtls)) + if (!commState.putLongList(null, drTtls)) return false; commState.idx++; @@ -666,7 +666,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 5: if (drVers != null) { if (commState.it == null) { - if (!commState.putInt(drVers.size())) + if (!commState.putInt(null, drVers.size())) return false; commState.it = drVers.iterator(); @@ -676,7 +676,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -684,14 +684,14 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 6: - if (!commState.putCacheVersion(futVer)) + if (!commState.putCacheVersion(null, futVer)) return false; commState.idx++; @@ -699,7 +699,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 7: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.iterator(); @@ -709,7 +709,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -717,32 +717,32 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 8: - if (!commState.putUuid(nodeId)) + if (!commState.putUuid(null, nodeId)) return false; commState.idx++; case 9: - if (!commState.putEnum(syncMode)) + if (!commState.putEnum(null, syncMode)) return false; commState.idx++; case 10: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 11: - if (!commState.putLong(ttl)) + if (!commState.putLong(null, ttl)) return false; commState.idx++; @@ -750,7 +750,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 12: if (valBytes != null) { if (commState.it == null) { - if (!commState.putInt(valBytes.size())) + if (!commState.putInt(null, valBytes.size())) return false; commState.it = valBytes.iterator(); @@ -760,7 +760,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putValueBytes((GridCacheValueBytes)commState.cur)) + if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) return false; commState.cur = NULL; @@ -768,14 +768,14 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 13: - if (!commState.putCacheVersion(writeVer)) + if (!commState.putCacheVersion(null, writeVer)) return false; commState.idx++; @@ -783,7 +783,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 14: if (nearKeyBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearKeyBytes.size())) + if (!commState.putInt(null, nearKeyBytes.size())) return false; commState.it = nearKeyBytes.iterator(); @@ -793,7 +793,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -801,7 +801,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -810,7 +810,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 15: if (nearValBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearValBytes.size())) + if (!commState.putInt(null, nearValBytes.size())) return false; commState.it = nearValBytes.iterator(); @@ -820,7 +820,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putValueBytes((GridCacheValueBytes)commState.cur)) + if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) return false; commState.cur = NULL; @@ -828,14 +828,14 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 16: - if (!commState.putBoolean(forceTransformBackups)) + if (!commState.putBoolean(null, forceTransformBackups)) return false; commState.idx++; @@ -843,7 +843,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 17: if (nearTransformClosBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearTransformClosBytes.size())) + if (!commState.putInt(null, nearTransformClosBytes.size())) return false; commState.it = nearTransformClosBytes.iterator(); @@ -853,7 +853,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -861,7 +861,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -870,7 +870,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 18: if (transformClosBytes != null) { if (commState.it == null) { - if (!commState.putInt(transformClosBytes.size())) + if (!commState.putInt(null, transformClosBytes.size())) return false; commState.it = transformClosBytes.iterator(); @@ -880,7 +880,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -888,20 +888,20 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 19: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 20: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -921,7 +921,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList(); + GridLongList drExpireTimes0 = commState.getLongList(null); if (drExpireTimes0 == LONG_LIST_NOT_READ) return false; @@ -931,7 +931,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList(); + GridLongList drTtls0 = commState.getLongList(null); if (drTtls0 == LONG_LIST_NOT_READ) return false; @@ -945,7 +945,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -953,7 +953,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp drVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -970,7 +970,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 6: - GridCacheVersion futVer0 = commState.getCacheVersion(); + GridCacheVersion futVer0 = commState.getCacheVersion(null); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -984,7 +984,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -992,7 +992,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp keyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -1009,7 +1009,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - UUID nodeId0 = commState.getUuid(); + UUID nodeId0 = commState.getUuid(null); if (nodeId0 == UUID_NOT_READ) return false; @@ -1022,7 +1022,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 1) return false; - byte syncMode0 = commState.getByte(); + byte syncMode0 = commState.getByte(null); syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); @@ -1032,7 +1032,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; @@ -1040,7 +1040,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 8) return false; - ttl = commState.getLong(); + ttl = commState.getLong(null); commState.idx++; @@ -1049,7 +1049,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1057,7 +1057,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp valBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(); + GridCacheValueBytes _val = commState.getValueBytes(null); if (_val == VAL_BYTES_NOT_READ) return false; @@ -1074,7 +1074,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 13: - GridCacheVersion writeVer0 = commState.getCacheVersion(); + GridCacheVersion writeVer0 = commState.getCacheVersion(null); if (writeVer0 == CACHE_VER_NOT_READ) return false; @@ -1088,7 +1088,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1096,7 +1096,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp nearKeyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -1117,7 +1117,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1125,7 +1125,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp nearValBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(); + GridCacheValueBytes _val = commState.getValueBytes(null); if (_val == VAL_BYTES_NOT_READ) return false; @@ -1145,7 +1145,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 1) return false; - forceTransformBackups = commState.getBoolean(); + forceTransformBackups = commState.getBoolean(null); commState.idx++; @@ -1154,7 +1154,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1162,7 +1162,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp nearTransformClosBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -1183,7 +1183,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1191,7 +1191,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp transformClosBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -1208,7 +1208,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 19: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -1221,7 +1221,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 81b0a89..5d3ba59 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -203,7 +203,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -211,19 +211,19 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im switch (commState.idx) { case 3: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(failedKeysBytes)) + if (!commState.putByteArray(null, failedKeysBytes)) return false; commState.idx++; case 5: - if (!commState.putCacheVersion(futVer)) + if (!commState.putCacheVersion(null, futVer)) return false; commState.idx++; @@ -231,7 +231,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im case 6: if (nearEvictedBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearEvictedBytes.size())) + if (!commState.putInt(null, nearEvictedBytes.size())) return false; commState.it = nearEvictedBytes.iterator(); @@ -241,7 +241,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -249,7 +249,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -270,7 +270,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -280,7 +280,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray(); + byte[] failedKeysBytes0 = commState.getByteArray(null); if (failedKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -290,7 +290,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion(); + GridCacheVersion futVer0 = commState.getCacheVersion(null); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -304,7 +304,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -312,7 +312,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im nearEvictedBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 00512ff..446a521 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -545,7 +545,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -553,13 +553,13 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im switch (commState.idx) { case 3: - if (!commState.putLongList(drExpireTimes)) + if (!commState.putLongList(null, drExpireTimes)) return false; commState.idx++; case 4: - if (!commState.putLongList(drTtls)) + if (!commState.putLongList(null, drTtls)) return false; commState.idx++; @@ -567,7 +567,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 5: if (drVers != null) { if (commState.it == null) { - if (!commState.putInt(drVers.size())) + if (!commState.putInt(null, drVers.size())) return false; commState.it = drVers.iterator(); @@ -577,7 +577,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -585,14 +585,14 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 6: - if (!commState.putBoolean(fastMap)) + if (!commState.putBoolean(null, fastMap)) return false; commState.idx++; @@ -600,7 +600,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 7: if (filterBytes != null) { if (commState.it == null) { - if (!commState.putInt(filterBytes.length)) + if (!commState.putInt(null, filterBytes.length)) return false; commState.it = arrayIterator(filterBytes); @@ -610,7 +610,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -618,20 +618,20 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 8: - if (!commState.putCacheVersion(futVer)) + if (!commState.putCacheVersion(null, futVer)) return false; commState.idx++; case 9: - if (!commState.putBoolean(hasPrimary)) + if (!commState.putBoolean(null, hasPrimary)) return false; commState.idx++; @@ -639,7 +639,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 10: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.iterator(); @@ -649,7 +649,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -657,44 +657,44 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 11: - if (!commState.putEnum(op)) + if (!commState.putEnum(null, op)) return false; commState.idx++; case 12: - if (!commState.putBoolean(retval)) + if (!commState.putBoolean(null, retval)) return false; commState.idx++; case 13: - if (!commState.putEnum(syncMode)) + if (!commState.putEnum(null, syncMode)) return false; commState.idx++; case 14: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 15: - if (!commState.putLong(ttl)) + if (!commState.putLong(null, ttl)) return false; commState.idx++; case 16: - if (!commState.putCacheVersion(updateVer)) + if (!commState.putCacheVersion(null, updateVer)) return false; commState.idx++; @@ -702,7 +702,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 17: if (valBytes != null) { if (commState.it == null) { - if (!commState.putInt(valBytes.size())) + if (!commState.putInt(null, valBytes.size())) return false; commState.it = valBytes.iterator(); @@ -712,7 +712,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putValueBytes((GridCacheValueBytes)commState.cur)) + if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) return false; commState.cur = NULL; @@ -720,26 +720,26 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 18: - if (!commState.putBoolean(forceTransformBackups)) + if (!commState.putBoolean(null, forceTransformBackups)) return false; commState.idx++; case 19: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 20: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -759,7 +759,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList(); + GridLongList drExpireTimes0 = commState.getLongList(null); if (drExpireTimes0 == LONG_LIST_NOT_READ) return false; @@ -769,7 +769,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList(); + GridLongList drTtls0 = commState.getLongList(null); if (drTtls0 == LONG_LIST_NOT_READ) return false; @@ -783,7 +783,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -791,7 +791,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im drVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -811,7 +811,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - fastMap = commState.getBoolean(); + fastMap = commState.getBoolean(null); commState.idx++; @@ -820,7 +820,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -828,7 +828,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im filterBytes = new byte[commState.readSize][]; for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -845,7 +845,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 8: - GridCacheVersion futVer0 = commState.getCacheVersion(); + GridCacheVersion futVer0 = commState.getCacheVersion(null); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -858,7 +858,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - hasPrimary = commState.getBoolean(); + hasPrimary = commState.getBoolean(null); commState.idx++; @@ -867,7 +867,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -875,7 +875,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im keyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -895,7 +895,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - byte op0 = commState.getByte(); + byte op0 = commState.getByte(null); op = GridCacheOperation.fromOrdinal(op0); @@ -905,7 +905,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - retval = commState.getBoolean(); + retval = commState.getBoolean(null); commState.idx++; @@ -913,7 +913,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - byte syncMode0 = commState.getByte(); + byte syncMode0 = commState.getByte(null); syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); @@ -923,7 +923,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; @@ -931,12 +931,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 8) return false; - ttl = commState.getLong(); + ttl = commState.getLong(null); commState.idx++; case 16: - GridCacheVersion updateVer0 = commState.getCacheVersion(); + GridCacheVersion updateVer0 = commState.getCacheVersion(null); if (updateVer0 == CACHE_VER_NOT_READ) return false; @@ -950,7 +950,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -958,7 +958,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im valBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(); + GridCacheValueBytes _val = commState.getValueBytes(null); if (_val == VAL_BYTES_NOT_READ) return false; @@ -978,12 +978,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - forceTransformBackups = commState.getBoolean(); + forceTransformBackups = commState.getBoolean(null); commState.idx++; case 19: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -996,7 +996,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index fe16214..ba683c3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -396,7 +396,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -404,31 +404,31 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i switch (commState.idx) { case 3: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(failedKeysBytes)) + if (!commState.putByteArray(null, failedKeysBytes)) return false; commState.idx++; case 5: - if (!commState.putCacheVersion(futVer)) + if (!commState.putCacheVersion(null, futVer)) return false; commState.idx++; case 6: - if (!commState.putByteArray(remapKeysBytes)) + if (!commState.putByteArray(null, remapKeysBytes)) return false; commState.idx++; case 7: - if (!commState.putByteArray(retValBytes)) + if (!commState.putByteArray(null, retValBytes)) return false; commState.idx++; @@ -436,7 +436,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 8: if (nearSkipIdxs != null) { if (commState.it == null) { - if (!commState.putInt(nearSkipIdxs.size())) + if (!commState.putInt(null, nearSkipIdxs.size())) return false; commState.it = nearSkipIdxs.iterator(); @@ -446,7 +446,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -454,14 +454,14 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 9: - if (!commState.putLong(nearTtl)) + if (!commState.putLong(null, nearTtl)) return false; commState.idx++; @@ -469,7 +469,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 10: if (nearValBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearValBytes.size())) + if (!commState.putInt(null, nearValBytes.size())) return false; commState.it = nearValBytes.iterator(); @@ -479,7 +479,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putValueBytes((GridCacheValueBytes)commState.cur)) + if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) return false; commState.cur = NULL; @@ -487,7 +487,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -496,7 +496,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 11: if (nearValsIdxs != null) { if (commState.it == null) { - if (!commState.putInt(nearValsIdxs.size())) + if (!commState.putInt(null, nearValsIdxs.size())) return false; commState.it = nearValsIdxs.iterator(); @@ -506,7 +506,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -514,14 +514,14 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 12: - if (!commState.putCacheVersion(nearVer)) + if (!commState.putCacheVersion(null, nearVer)) return false; commState.idx++; @@ -541,7 +541,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -551,7 +551,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray(); + byte[] failedKeysBytes0 = commState.getByteArray(null); if (failedKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -561,7 +561,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion(); + GridCacheVersion futVer0 = commState.getCacheVersion(null); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -571,7 +571,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 6: - byte[] remapKeysBytes0 = commState.getByteArray(); + byte[] remapKeysBytes0 = commState.getByteArray(null); if (remapKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -581,7 +581,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 7: - byte[] retValBytes0 = commState.getByteArray(); + byte[] retValBytes0 = commState.getByteArray(null); if (retValBytes0 == BYTE_ARR_NOT_READ) return false; @@ -595,7 +595,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -606,7 +606,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); nearSkipIdxs.add((Integer)_val); @@ -623,7 +623,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 8) return false; - nearTtl = commState.getLong(); + nearTtl = commState.getLong(null); commState.idx++; @@ -632,7 +632,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -640,7 +640,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i nearValBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(); + GridCacheValueBytes _val = commState.getValueBytes(null); if (_val == VAL_BYTES_NOT_READ) return false; @@ -661,7 +661,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -672,7 +672,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); nearValsIdxs.add((Integer)_val); @@ -686,7 +686,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 12: - GridCacheVersion nearVer0 = commState.getCacheVersion(); + GridCacheVersion nearVer0 = commState.getCacheVersion(null); if (nearVer0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 3bd7d5e..30c18cc 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -185,7 +185,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -193,7 +193,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem switch (commState.idx) { case 3: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -201,7 +201,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem case 4: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.iterator(); @@ -211,7 +211,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -219,20 +219,20 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 5: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 6: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; @@ -252,7 +252,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -266,7 +266,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -274,7 +274,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem keyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -291,7 +291,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -304,7 +304,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index df1afec..e333a95 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -189,7 +189,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -197,19 +197,19 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple switch (commState.idx) { case 3: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 4: - if (!commState.putByteArray(infosBytes)) + if (!commState.putByteArray(null, infosBytes)) return false; commState.idx++; case 5: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -217,7 +217,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple case 6: if (missedKeyBytes != null) { if (commState.it == null) { - if (!commState.putInt(missedKeyBytes.size())) + if (!commState.putInt(null, missedKeyBytes.size())) return false; commState.it = missedKeyBytes.iterator(); @@ -227,7 +227,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -235,7 +235,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -256,7 +256,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -266,7 +266,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple commState.idx++; case 4: - byte[] infosBytes0 = commState.getByteArray(); + byte[] infosBytes0 = commState.getByteArray(null); if (infosBytes0 == BYTE_ARR_NOT_READ) return false; @@ -276,7 +276,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -290,7 +290,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -298,7 +298,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple missedKeyBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index 01ceb9d..f77adc5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -215,7 +215,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -225,7 +225,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage case 3: if (parts != null) { if (commState.it == null) { - if (!commState.putInt(parts.size())) + if (!commState.putInt(null, parts.size())) return false; commState.it = parts.iterator(); @@ -235,7 +235,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -243,38 +243,38 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 4: - if (!commState.putLong(timeout)) + if (!commState.putLong(null, timeout)) return false; commState.idx++; case 5: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 6: - if (!commState.putByteArray(topicBytes)) + if (!commState.putByteArray(null, topicBytes)) return false; commState.idx++; case 7: - if (!commState.putLong(updateSeq)) + if (!commState.putLong(null, updateSeq)) return false; commState.idx++; case 8: - if (!commState.putInt(workerId)) + if (!commState.putInt(null, workerId)) return false; commState.idx++; @@ -298,7 +298,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -309,7 +309,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); parts.add((Integer)_val); @@ -326,7 +326,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - timeout = commState.getLong(); + timeout = commState.getLong(null); commState.idx++; @@ -334,12 +334,12 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 6: - byte[] topicBytes0 = commState.getByteArray(); + byte[] topicBytes0 = commState.getByteArray(null); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -352,7 +352,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - updateSeq = commState.getLong(); + updateSeq = commState.getLong(null); commState.idx++; @@ -360,7 +360,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - workerId = commState.getInt(); + workerId = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java index 57c8e52..bf3b606 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java @@ -300,7 +300,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -308,13 +308,13 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage switch (commState.idx) { case 3: - if (!commState.putBoolean(ack)) + if (!commState.putBoolean(null, ack)) return false; commState.idx++; case 4: - if (!commState.putByteArray(infoBytes)) + if (!commState.putByteArray(null, infoBytes)) return false; commState.idx++; @@ -322,7 +322,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage case 5: if (last != null) { if (commState.it == null) { - if (!commState.putInt(last.size())) + if (!commState.putInt(null, last.size())) return false; commState.it = last.iterator(); @@ -332,7 +332,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -340,7 +340,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -349,7 +349,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage case 6: if (missed != null) { if (commState.it == null) { - if (!commState.putInt(missed.size())) + if (!commState.putInt(null, missed.size())) return false; commState.it = missed.iterator(); @@ -359,7 +359,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -367,20 +367,20 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 7: - if (!commState.putLong(updateSeq)) + if (!commState.putLong(null, updateSeq)) return false; commState.idx++; case 8: - if (!commState.putInt(workerId)) + if (!commState.putInt(null, workerId)) return false; commState.idx++; @@ -403,12 +403,12 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 1) return false; - ack = commState.getBoolean(); + ack = commState.getBoolean(null); commState.idx++; case 4: - byte[] infoBytes0 = commState.getByteArray(); + byte[] infoBytes0 = commState.getByteArray(null); if (infoBytes0 == BYTE_ARR_NOT_READ) return false; @@ -422,7 +422,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -433,7 +433,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); last.add((Integer)_val); @@ -451,7 +451,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -462,7 +462,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); missed.add((Integer)_val); @@ -479,7 +479,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - updateSeq = commState.getLong(); + updateSeq = commState.getLong(null); commState.idx++; @@ -487,7 +487,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - workerId = commState.getInt(); + workerId = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java index 28cb6bb..e275f17 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java @@ -84,7 +84,7 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDhtPartitionsAbstrac return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -173,19 +173,19 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac switch (commState.idx) { case 5: - if (!commState.putByteArray(affAssignmentBytes)) + if (!commState.putByteArray(null, affAssignmentBytes)) return false; commState.idx++; case 6: - if (!commState.putByteArray(partsBytes)) + if (!commState.putByteArray(null, partsBytes)) return false; commState.idx++; case 7: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; @@ -205,7 +205,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac switch (commState.idx) { case 5: - byte[] affAssignmentBytes0 = commState.getByteArray(); + byte[] affAssignmentBytes0 = commState.getByteArray(null); if (affAssignmentBytes0 == BYTE_ARR_NOT_READ) return false; @@ -215,7 +215,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac commState.idx++; case 6: - byte[] partsBytes0 = commState.getByteArray(); + byte[] partsBytes0 = commState.getByteArray(null); if (partsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -228,7 +228,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java index 350da08..0671800 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java @@ -114,7 +114,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -122,7 +122,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr switch (commState.idx) { case 5: - if (!commState.putByteArray(partsBytes)) + if (!commState.putByteArray(null, partsBytes)) return false; commState.idx++; @@ -142,7 +142,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr switch (commState.idx) { case 5: - byte[] partsBytes0 = commState.getByteArray(); + byte[] partsBytes0 = commState.getByteArray(null); if (partsBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java index 2015225..853cc51 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java @@ -61,7 +61,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java index 12aacb7..61815b0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java @@ -250,7 +250,7 @@ public class GridNearGetRequest extends GridCacheMessage implements return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -260,7 +260,7 @@ public class GridNearGetRequest extends GridCacheMessage implements case 3: if (filterBytes != null) { if (commState.it == null) { - if (!commState.putInt(filterBytes.length)) + if (!commState.putInt(null, filterBytes.length)) return false; commState.it = arrayIterator(filterBytes); @@ -270,7 +270,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -278,14 +278,14 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 4: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -293,7 +293,7 @@ public class GridNearGetRequest extends GridCacheMessage implements case 5: if (keyBytes != null) { if (commState.it == null) { - if (!commState.putInt(keyBytes.size())) + if (!commState.putInt(null, keyBytes.size())) return false; commState.it = keyBytes.entrySet().iterator(); @@ -306,13 +306,13 @@ public class GridNearGetRequest extends GridCacheMessage implements Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putByteArray(e.getKey())) + if (!commState.putByteArray(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putBoolean(e.getValue())) + if (!commState.putBoolean(null, e.getValue())) return false; commState.keyDone = false; @@ -322,44 +322,44 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 6: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 7: - if (!commState.putBoolean(reload)) + if (!commState.putBoolean(null, reload)) return false; commState.idx++; case 8: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 9: - if (!commState.putCacheVersion(ver)) + if (!commState.putCacheVersion(null, ver)) return false; commState.idx++; case 10: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 11: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -383,7 +383,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -391,7 +391,7 @@ public class GridNearGetRequest extends GridCacheMessage implements filterBytes = new byte[commState.readSize][]; for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -408,7 +408,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 4: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -422,7 +422,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -431,7 +431,7 @@ public class GridNearGetRequest extends GridCacheMessage implements for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -443,7 +443,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 1) return false; - boolean _val = commState.getBoolean(); + boolean _val = commState.getBoolean(null); keyBytes.put((byte[])commState.cur, _val); @@ -460,7 +460,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -473,7 +473,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 1) return false; - reload = commState.getBoolean(); + reload = commState.getBoolean(null); commState.idx++; @@ -481,12 +481,12 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion(); + GridCacheVersion ver0 = commState.getCacheVersion(null); if (ver0 == CACHE_VER_NOT_READ) return false; @@ -496,7 +496,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 10: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -509,7 +509,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java index 5d171bc..1eba548 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java @@ -226,7 +226,7 @@ public class GridNearGetResponse extends GridCacheMessage implements return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -234,19 +234,19 @@ public class GridNearGetResponse extends GridCacheMessage implements switch (commState.idx) { case 3: - if (!commState.putByteArray(entriesBytes)) + if (!commState.putByteArray(null, entriesBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 5: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -254,7 +254,7 @@ public class GridNearGetResponse extends GridCacheMessage implements case 6: if (invalidParts != null) { if (commState.it == null) { - if (!commState.putInt(invalidParts.size())) + if (!commState.putInt(null, invalidParts.size())) return false; commState.it = invalidParts.iterator(); @@ -264,7 +264,7 @@ public class GridNearGetResponse extends GridCacheMessage implements if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -272,26 +272,26 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 7: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 8: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 9: - if (!commState.putCacheVersion(ver)) + if (!commState.putCacheVersion(null, ver)) return false; commState.idx++; @@ -311,7 +311,7 @@ public class GridNearGetResponse extends GridCacheMessage implements switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray(); + byte[] entriesBytes0 = commState.getByteArray(null); if (entriesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -321,7 +321,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -331,7 +331,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 5: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -345,7 +345,7 @@ public class GridNearGetResponse extends GridCacheMessage implements if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -356,7 +356,7 @@ public class GridNearGetResponse extends GridCacheMessage implements if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); invalidParts.add((Integer)_val); @@ -370,7 +370,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 7: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -383,12 +383,12 @@ public class GridNearGetResponse extends GridCacheMessage implements if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion(); + GridCacheVersion ver0 = commState.getCacheVersion(null); if (ver0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java index d9217d5..6f80471 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java @@ -327,7 +327,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -337,7 +337,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest case 24: if (dhtVers != null) { if (commState.it == null) { - if (!commState.putInt(dhtVers.length)) + if (!commState.putInt(null, dhtVers.length)) return false; commState.it = arrayIterator(dhtVers); @@ -347,7 +347,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -355,7 +355,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -364,7 +364,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest case 25: if (filterBytes != null) { if (commState.it == null) { - if (!commState.putInt(filterBytes.length)) + if (!commState.putInt(null, filterBytes.length)) return false; commState.it = arrayIterator(filterBytes); @@ -374,7 +374,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -382,56 +382,56 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 26: - if (!commState.putBoolean(implicitSingleTx)) + if (!commState.putBoolean(null, implicitSingleTx)) return false; commState.idx++; case 27: - if (!commState.putBoolean(implicitTx)) + if (!commState.putBoolean(null, implicitTx)) return false; commState.idx++; case 28: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 29: - if (!commState.putBoolean(onePhaseCommit)) + if (!commState.putBoolean(null, onePhaseCommit)) return false; commState.idx++; case 30: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 31: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 32: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; case 33: - if (!commState.putBoolean(hasTransforms)) + if (!commState.putBoolean(null, hasTransforms)) return false; commState.idx++; @@ -455,7 +455,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -463,7 +463,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest dhtVers = new GridCacheVersion[commState.readSize]; for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -484,7 +484,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -492,7 +492,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest filterBytes = new byte[commState.readSize][]; for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -512,7 +512,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - implicitSingleTx = commState.getBoolean(); + implicitSingleTx = commState.getBoolean(null); commState.idx++; @@ -520,12 +520,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - implicitTx = commState.getBoolean(); + implicitTx = commState.getBoolean(null); commState.idx++; case 28: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -538,7 +538,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - onePhaseCommit = commState.getBoolean(); + onePhaseCommit = commState.getBoolean(null); commState.idx++; @@ -546,12 +546,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 31: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -564,7 +564,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; @@ -572,7 +572,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - hasTransforms = commState.getBoolean(); + hasTransforms = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java index 7a0c2fd..f5476fc 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java @@ -202,7 +202,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { @@ -329,7 +329,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { @@ -368,7 +368,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { @@ -407,7 +407,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java index 90cdfe6..b63b038 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java @@ -168,7 +168,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -176,31 +176,31 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques switch (commState.idx) { case 20: - if (!commState.putBoolean(explicitLock)) + if (!commState.putBoolean(null, explicitLock)) return false; commState.idx++; case 21: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 22: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 23: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 24: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -223,12 +223,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 1) return false; - explicitLock = commState.getBoolean(); + explicitLock = commState.getBoolean(null); commState.idx++; case 21: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -241,12 +241,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 23: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -259,7 +259,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java index 52825bc..b093106 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -135,7 +135,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -143,19 +143,19 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo switch (commState.idx) { case 5: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 6: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 7: - if (!commState.putLong(nearThreadId)) + if (!commState.putLong(null, nearThreadId)) return false; commState.idx++; @@ -175,7 +175,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo switch (commState.idx) { case 5: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -185,7 +185,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -198,7 +198,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo if (buf.remaining() < 8) return false; - nearThreadId = commState.getLong(); + nearThreadId = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java index 30b7aef..7decc5e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java @@ -235,7 +235,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -243,13 +243,13 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 21: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 22: - if (!commState.putBoolean(last)) + if (!commState.putBoolean(null, last)) return false; commState.idx++; @@ -257,7 +257,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ case 23: if (lastBackups != null) { if (commState.it == null) { - if (!commState.putInt(lastBackups.size())) + if (!commState.putInt(null, lastBackups.size())) return false; commState.it = lastBackups.iterator(); @@ -267,7 +267,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putUuid((UUID)commState.cur)) + if (!commState.putUuid(null, (UUID)commState.cur)) return false; commState.cur = NULL; @@ -275,38 +275,38 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 24: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 25: - if (!commState.putBoolean(near)) + if (!commState.putBoolean(null, near)) return false; commState.idx++; case 26: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 27: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 28: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -326,7 +326,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 21: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -339,7 +339,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - last = commState.getBoolean(); + last = commState.getBoolean(null); commState.idx++; @@ -348,7 +348,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -356,7 +356,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ lastBackups = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -373,7 +373,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 24: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -386,7 +386,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - near = commState.getBoolean(); + near = commState.getBoolean(null); commState.idx++; @@ -394,12 +394,12 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 27: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -412,7 +412,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java index 08d7967..ea475a9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java @@ -247,7 +247,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -255,13 +255,13 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes switch (commState.idx) { case 10: - if (!commState.putCacheVersion(dhtVer)) + if (!commState.putCacheVersion(null, dhtVer)) return false; commState.idx++; case 11: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -269,7 +269,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 12: if (invalidParts != null) { if (commState.it == null) { - if (!commState.putInt(invalidParts.size())) + if (!commState.putInt(null, invalidParts.size())) return false; commState.it = invalidParts.iterator(); @@ -279,7 +279,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putInt((int)commState.cur)) + if (!commState.putInt(null, (int)commState.cur)) return false; commState.cur = NULL; @@ -287,14 +287,14 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 13: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; @@ -302,7 +302,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 14: if (ownedValsBytes != null) { if (commState.it == null) { - if (!commState.putInt(ownedValsBytes.size())) + if (!commState.putInt(null, ownedValsBytes.size())) return false; commState.it = ownedValsBytes.iterator(); @@ -312,7 +312,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -320,7 +320,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -329,7 +329,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 15: if (pending != null) { if (commState.it == null) { - if (!commState.putInt(pending.size())) + if (!commState.putInt(null, pending.size())) return false; commState.it = pending.iterator(); @@ -339,7 +339,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -347,7 +347,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -368,7 +368,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes switch (commState.idx) { case 10: - GridCacheVersion dhtVer0 = commState.getCacheVersion(); + GridCacheVersion dhtVer0 = commState.getCacheVersion(null); if (dhtVer0 == CACHE_VER_NOT_READ) return false; @@ -378,7 +378,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -392,7 +392,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -403,7 +403,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (buf.remaining() < 4) return false; - int _val = commState.getInt(); + int _val = commState.getInt(null); invalidParts.add((Integer)_val); @@ -417,7 +417,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 13: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -431,7 +431,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -439,7 +439,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes ownedValsBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -460,7 +460,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -468,7 +468,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes pending = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearUnlockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearUnlockRequest.java index 818ba66..1e2fe21 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearUnlockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearUnlockRequest.java @@ -63,7 +63,7 @@ public class GridNearUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage implemen return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -494,115 +494,115 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen switch (commState.idx) { case 3: - if (!commState.putBoolean(all)) + if (!commState.putBoolean(null, all)) return false; commState.idx++; case 4: - if (!commState.putByteArray(argsBytes)) + if (!commState.putByteArray(null, argsBytes)) return false; commState.idx++; case 5: - if (!commState.putString(cacheName)) + if (!commState.putString(null, cacheName)) return false; commState.idx++; case 6: - if (!commState.putBoolean(cancel)) + if (!commState.putBoolean(null, cancel)) return false; commState.idx++; case 7: - if (!commState.putString(clause)) + if (!commState.putString(null, clause)) return false; commState.idx++; case 8: - if (!commState.putString(clsName)) + if (!commState.putString(null, clsName)) return false; commState.idx++; case 9: - if (!commState.putBoolean(fields)) + if (!commState.putBoolean(null, fields)) return false; commState.idx++; case 10: - if (!commState.putLong(id)) + if (!commState.putLong(null, id)) return false; commState.idx++; case 11: - if (!commState.putBoolean(incBackups)) + if (!commState.putBoolean(null, incBackups)) return false; commState.idx++; case 12: - if (!commState.putBoolean(incMeta)) + if (!commState.putBoolean(null, incMeta)) return false; commState.idx++; case 13: - if (!commState.putByteArray(keyValFilterBytes)) + if (!commState.putByteArray(null, keyValFilterBytes)) return false; commState.idx++; case 14: - if (!commState.putInt(pageSize)) + if (!commState.putInt(null, pageSize)) return false; commState.idx++; case 15: - if (!commState.putByteArray(prjFilterBytes)) + if (!commState.putByteArray(null, prjFilterBytes)) return false; commState.idx++; case 16: - if (!commState.putByteArray(rdcBytes)) + if (!commState.putByteArray(null, rdcBytes)) return false; commState.idx++; case 17: - if (!commState.putByteArray(transBytes)) + if (!commState.putByteArray(null, transBytes)) return false; commState.idx++; case 18: - if (!commState.putEnum(type)) + if (!commState.putEnum(null, type)) return false; commState.idx++; case 19: - if (!commState.putBoolean(keepPortable)) + if (!commState.putBoolean(null, keepPortable)) return false; commState.idx++; case 20: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 21: - if (!commState.putInt(taskHash)) + if (!commState.putInt(null, taskHash)) return false; commState.idx++; @@ -625,12 +625,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - all = commState.getBoolean(); + all = commState.getBoolean(null); commState.idx++; case 4: - byte[] argsBytes0 = commState.getByteArray(); + byte[] argsBytes0 = commState.getByteArray(null); if (argsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -640,7 +640,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 5: - String cacheName0 = commState.getString(); + String cacheName0 = commState.getString(null); if (cacheName0 == STR_NOT_READ) return false; @@ -653,12 +653,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - cancel = commState.getBoolean(); + cancel = commState.getBoolean(null); commState.idx++; case 7: - String clause0 = commState.getString(); + String clause0 = commState.getString(null); if (clause0 == STR_NOT_READ) return false; @@ -668,7 +668,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 8: - String clsName0 = commState.getString(); + String clsName0 = commState.getString(null); if (clsName0 == STR_NOT_READ) return false; @@ -681,7 +681,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - fields = commState.getBoolean(); + fields = commState.getBoolean(null); commState.idx++; @@ -689,7 +689,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 8) return false; - id = commState.getLong(); + id = commState.getLong(null); commState.idx++; @@ -697,7 +697,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - incBackups = commState.getBoolean(); + incBackups = commState.getBoolean(null); commState.idx++; @@ -705,12 +705,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - incMeta = commState.getBoolean(); + incMeta = commState.getBoolean(null); commState.idx++; case 13: - byte[] keyValFilterBytes0 = commState.getByteArray(); + byte[] keyValFilterBytes0 = commState.getByteArray(null); if (keyValFilterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -723,12 +723,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 4) return false; - pageSize = commState.getInt(); + pageSize = commState.getInt(null); commState.idx++; case 15: - byte[] prjFilterBytes0 = commState.getByteArray(); + byte[] prjFilterBytes0 = commState.getByteArray(null); if (prjFilterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -738,7 +738,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 16: - byte[] rdcBytes0 = commState.getByteArray(); + byte[] rdcBytes0 = commState.getByteArray(null); if (rdcBytes0 == BYTE_ARR_NOT_READ) return false; @@ -748,7 +748,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 17: - byte[] transBytes0 = commState.getByteArray(); + byte[] transBytes0 = commState.getByteArray(null); if (transBytes0 == BYTE_ARR_NOT_READ) return false; @@ -761,7 +761,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - byte type0 = commState.getByte(); + byte type0 = commState.getByte(null); type = GridCacheQueryType.fromOrdinal(type0); @@ -771,12 +771,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - keepPortable = commState.getBoolean(); + keepPortable = commState.getBoolean(null); commState.idx++; case 20: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -789,7 +789,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 4) return false; - taskHash = commState.getInt(); + taskHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java index caf783c..0254c6d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java @@ -229,7 +229,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -239,7 +239,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme case 3: if (dataBytes != null) { if (commState.it == null) { - if (!commState.putInt(dataBytes.size())) + if (!commState.putInt(null, dataBytes.size())) return false; commState.it = dataBytes.iterator(); @@ -249,7 +249,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -257,26 +257,26 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 4: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 5: - if (!commState.putBoolean(fields)) + if (!commState.putBoolean(null, fields)) return false; commState.idx++; case 6: - if (!commState.putBoolean(finished)) + if (!commState.putBoolean(null, finished)) return false; commState.idx++; @@ -284,7 +284,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme case 7: if (metaDataBytes != null) { if (commState.it == null) { - if (!commState.putInt(metaDataBytes.size())) + if (!commState.putInt(null, metaDataBytes.size())) return false; commState.it = metaDataBytes.iterator(); @@ -294,7 +294,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -302,14 +302,14 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 8: - if (!commState.putLong(reqId)) + if (!commState.putLong(null, reqId)) return false; commState.idx++; @@ -333,7 +333,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -341,7 +341,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme dataBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -358,7 +358,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -371,7 +371,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 1) return false; - fields = commState.getBoolean(); + fields = commState.getBoolean(null); commState.idx++; @@ -379,7 +379,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 1) return false; - finished = commState.getBoolean(); + finished = commState.getBoolean(null); commState.idx++; @@ -388,7 +388,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -396,7 +396,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme metaDataBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -416,7 +416,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 8) return false; - reqId = commState.getLong(); + reqId = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java index 28bddd8..f3a61c8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java @@ -87,7 +87,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -97,7 +97,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd case 0: if (deltas != null) { if (commState.it == null) { - if (!commState.putInt(deltas.size())) + if (!commState.putInt(null, deltas.size())) return false; commState.it = deltas.entrySet().iterator(); @@ -110,13 +110,13 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putLong(e.getValue())) + if (!commState.putLong(null, e.getValue())) return false; commState.keyDone = false; @@ -126,14 +126,14 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 1: - if (!commState.putClockDeltaVersion(snapVer)) + if (!commState.putClockDeltaVersion(null, snapVer)) return false; commState.idx++; @@ -154,7 +154,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -163,7 +163,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -175,7 +175,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd if (buf.remaining() < 8) return false; - long _val = commState.getLong(); + long _val = commState.getLong(null); deltas.put((UUID)commState.cur, _val); @@ -192,7 +192,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.idx++; case 1: - GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion(); + GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion(null); if (snapVer0 == CLOCK_DELTA_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java index 09b7171..e87e972 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java @@ -129,7 +129,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -137,19 +137,19 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(dataBytes)) + if (!commState.putByteArray(null, dataBytes)) return false; commState.idx++; case 1: - if (!commState.putUuid(routineId)) + if (!commState.putUuid(null, routineId)) return false; commState.idx++; case 2: - if (!commState.putEnum(type)) + if (!commState.putEnum(null, type)) return false; commState.idx++; @@ -166,7 +166,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] dataBytes0 = commState.getByteArray(); + byte[] dataBytes0 = commState.getByteArray(null); if (dataBytes0 == BYTE_ARR_NOT_READ) return false; @@ -176,7 +176,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - UUID routineId0 = commState.getUuid(); + UUID routineId0 = commState.getUuid(null); if (routineId0 == UUID_NOT_READ) return false; @@ -189,7 +189,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte type0 = commState.getByte(); + byte type0 = commState.getByte(null); type = GridContinuousMessageType.fromOrdinal(type0); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java index efaa153..7810633 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java @@ -206,7 +206,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -214,37 +214,37 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putString(cacheName)) + if (!commState.putString(null, cacheName)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putByteArray(colBytes)) + if (!commState.putByteArray(null, colBytes)) return false; commState.idx++; case 3: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; case 4: - if (!commState.putBoolean(forceLocDep)) + if (!commState.putBoolean(null, forceLocDep)) return false; commState.idx++; case 5: - if (!commState.putBoolean(ignoreDepOwnership)) + if (!commState.putBoolean(null, ignoreDepOwnership)) return false; commState.idx++; @@ -252,7 +252,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte case 6: if (ldrParticipants != null) { if (commState.it == null) { - if (!commState.putInt(ldrParticipants.size())) + if (!commState.putInt(null, ldrParticipants.size())) return false; commState.it = ldrParticipants.entrySet().iterator(); @@ -265,13 +265,13 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -281,38 +281,38 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 7: - if (!commState.putLong(reqId)) + if (!commState.putLong(null, reqId)) return false; commState.idx++; case 8: - if (!commState.putByteArray(resTopicBytes)) + if (!commState.putByteArray(null, resTopicBytes)) return false; commState.idx++; case 9: - if (!commState.putString(sampleClsName)) + if (!commState.putString(null, sampleClsName)) return false; commState.idx++; case 10: - if (!commState.putByteArray(updaterBytes)) + if (!commState.putByteArray(null, updaterBytes)) return false; commState.idx++; case 11: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -328,7 +328,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - String cacheName0 = commState.getString(); + String cacheName0 = commState.getString(null); if (cacheName0 == STR_NOT_READ) return false; @@ -338,7 +338,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -348,7 +348,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 2: - byte[] colBytes0 = commState.getByteArray(); + byte[] colBytes0 = commState.getByteArray(null); if (colBytes0 == BYTE_ARR_NOT_READ) return false; @@ -361,7 +361,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -371,7 +371,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(); + forceLocDep = commState.getBoolean(null); commState.idx++; @@ -379,7 +379,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - ignoreDepOwnership = commState.getBoolean(); + ignoreDepOwnership = commState.getBoolean(null); commState.idx++; @@ -388,7 +388,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -397,7 +397,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -406,7 +406,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -429,12 +429,12 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - reqId = commState.getLong(); + reqId = commState.getLong(null); commState.idx++; case 8: - byte[] resTopicBytes0 = commState.getByteArray(); + byte[] resTopicBytes0 = commState.getByteArray(null); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -444,7 +444,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 9: - String sampleClsName0 = commState.getString(); + String sampleClsName0 = commState.getString(null); if (sampleClsName0 == STR_NOT_READ) return false; @@ -454,7 +454,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 10: - byte[] updaterBytes0 = commState.getByteArray(); + byte[] updaterBytes0 = commState.getByteArray(null); if (updaterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -464,7 +464,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 11: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java index 4c94bd2..f726db8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java @@ -99,7 +99,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -107,19 +107,19 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 1: - if (!commState.putBoolean(forceLocDep)) + if (!commState.putBoolean(null, forceLocDep)) return false; commState.idx++; case 2: - if (!commState.putLong(reqId)) + if (!commState.putLong(null, reqId)) return false; commState.idx++; @@ -136,7 +136,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -149,7 +149,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(); + forceLocDep = commState.getBoolean(null); commState.idx++; @@ -157,7 +157,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - reqId = commState.getLong(); + reqId = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java index d47c661..f01b397 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java @@ -125,7 +125,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -133,19 +133,19 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(fileId)) + if (!commState.putGridUuid(null, fileId)) return false; commState.idx++; case 2: - if (!commState.putLong(id)) + if (!commState.putLong(null, id)) return false; commState.idx++; @@ -165,7 +165,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -175,7 +175,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid(); + IgniteUuid fileId0 = commState.getGridUuid(null); if (fileId0 == GRID_UUID_NOT_READ) return false; @@ -188,7 +188,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - id = commState.getLong(); + id = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java index 3e64ee5..563c458 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java @@ -176,7 +176,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -184,25 +184,25 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putGridUuid(affKey)) + if (!commState.putGridUuid(null, affKey)) return false; commState.idx++; case 1: - if (!commState.putLong(blockId)) + if (!commState.putLong(null, blockId)) return false; commState.idx++; case 2: - if (!commState.putBoolean(evictExclude)) + if (!commState.putBoolean(null, evictExclude)) return false; commState.idx++; case 3: - if (!commState.putGridUuid(fileId)) + if (!commState.putGridUuid(null, fileId)) return false; commState.idx++; @@ -219,7 +219,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid(); + IgniteUuid affKey0 = commState.getGridUuid(null); if (affKey0 == GRID_UUID_NOT_READ) return false; @@ -232,7 +232,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 8) return false; - blockId = commState.getLong(); + blockId = commState.getLong(null); commState.idx++; @@ -240,12 +240,12 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 1) return false; - evictExclude = commState.getBoolean(); + evictExclude = commState.getBoolean(null); commState.idx++; case 3: - IgniteUuid fileId0 = commState.getGridUuid(); + IgniteUuid fileId0 = commState.getGridUuid(null); if (fileId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java index 8f1de61..2f9ea60 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java @@ -106,7 +106,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -116,7 +116,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { case 0: if (blocks != null) { if (commState.it == null) { - if (!commState.putInt(blocks.size())) + if (!commState.putInt(null, blocks.size())) return false; commState.it = blocks.entrySet().iterator(); @@ -129,13 +129,13 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putMessage(e.getKey())) + if (!commState.putMessage(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putByteArray(e.getValue())) + if (!commState.putByteArray(null, e.getValue())) return false; commState.keyDone = false; @@ -145,20 +145,20 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 1: - if (!commState.putGridUuid(fileId)) + if (!commState.putGridUuid(null, fileId)) return false; commState.idx++; case 2: - if (!commState.putLong(id)) + if (!commState.putLong(null, id)) return false; commState.idx++; @@ -182,7 +182,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -191,7 +191,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - Object _val = commState.getMessage(); + Object _val = commState.getMessage(null); if (_val == MSG_NOT_READ) return false; @@ -200,7 +200,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.keyDone = true; } - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -220,7 +220,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid(); + IgniteUuid fileId0 = commState.getGridUuid(null); if (fileId0 == GRID_UUID_NOT_READ) return false; @@ -233,7 +233,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - id = commState.getLong(); + id = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsCommunicationMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsCommunicationMessage.java index a905c52..6bd43e9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsCommunicationMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsCommunicationMessage.java @@ -49,7 +49,7 @@ public abstract class GridGgfsCommunicationMessage extends GridTcpCommunicationM commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java index c74c5e6..c913132 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java @@ -128,7 +128,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -136,13 +136,13 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(id)) + if (!commState.putGridUuid(null, id)) return false; commState.idx++; @@ -162,7 +162,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -172,7 +172,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid id0 = commState.getGridUuid(); + IgniteUuid id0 = commState.getGridUuid(null); if (id0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java index 77d188b..46975bb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java @@ -281,7 +281,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -289,31 +289,31 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putGridUuid(affKey)) + if (!commState.putGridUuid(null, affKey)) return false; commState.idx++; case 1: - if (!commState.putBoolean(done)) + if (!commState.putBoolean(null, done)) return false; commState.idx++; case 2: - if (!commState.putLong(endOff)) + if (!commState.putLong(null, endOff)) return false; commState.idx++; case 3: - if (!commState.putLong(startOff)) + if (!commState.putLong(null, startOff)) return false; commState.idx++; case 4: - if (!commState.putInt(status)) + if (!commState.putInt(null, status)) return false; commState.idx++; @@ -330,7 +330,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid(); + IgniteUuid affKey0 = commState.getGridUuid(null); if (affKey0 == GRID_UUID_NOT_READ) return false; @@ -343,7 +343,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - done = commState.getBoolean(); + done = commState.getBoolean(null); commState.idx++; @@ -351,7 +351,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - endOff = commState.getLong(); + endOff = commState.getLong(null); commState.idx++; @@ -359,7 +359,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - startOff = commState.getLong(); + startOff = commState.getLong(null); commState.idx++; @@ -367,7 +367,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 4) return false; - status = commState.getInt(); + status = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java index d6329cc..80b4621 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java @@ -99,7 +99,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -107,7 +107,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putGridUuid(fileId)) + if (!commState.putGridUuid(null, fileId)) return false; commState.idx++; @@ -115,7 +115,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { case 1: if (fragmentRanges != null) { if (commState.it == null) { - if (!commState.putInt(fragmentRanges.size())) + if (!commState.putInt(null, fragmentRanges.size())) return false; commState.it = fragmentRanges.iterator(); @@ -125,7 +125,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putMessage((GridGgfsFileAffinityRange)commState.cur)) + if (!commState.putMessage(null, (GridGgfsFileAffinityRange)commState.cur)) return false; commState.cur = NULL; @@ -133,7 +133,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -154,7 +154,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid(); + IgniteUuid fileId0 = commState.getGridUuid(null); if (fileId0 == GRID_UUID_NOT_READ) return false; @@ -168,7 +168,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -176,7 +176,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { fragmentRanges = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - Object _val = commState.getMessage(); + Object _val = commState.getMessage(null); if (_val == MSG_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java index 18024b3..9d71c9c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java @@ -74,7 +74,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -82,7 +82,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putGridUuid(fileId)) + if (!commState.putGridUuid(null, fileId)) return false; commState.idx++; @@ -102,7 +102,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid(); + IgniteUuid fileId0 = commState.getGridUuid(null); if (fileId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java index f1ab657..06fbcef 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java @@ -92,7 +92,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -100,13 +100,13 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putLong(order)) + if (!commState.putLong(null, order)) return false; commState.idx++; case 1: - if (!commState.putBoolean(res)) + if (!commState.putBoolean(null, res)) return false; commState.idx++; @@ -129,7 +129,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - order = commState.getLong(); + order = commState.getLong(null); commState.idx++; @@ -137,7 +137,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 1) return false; - res = commState.getBoolean(); + res = commState.getBoolean(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/portable/GridPortableOutputStream.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/portable/GridPortableOutputStream.java index c72ddd7..a71be26 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/portable/GridPortableOutputStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/portable/GridPortableOutputStream.java @@ -151,13 +151,6 @@ public interface GridPortableOutputStream extends GridPortableStream, AutoClosea public void write(long addr, int cnt); /** - * Ensure capacity. - * - * @param cnt Required byte count. - */ - public void ensureCapacity(int cnt); - - /** * Close the stream releasing resources. */ @Override public void close(); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index 7adca40..601428c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -54,7 +54,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -62,7 +62,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa switch (commState.idx) { case 0: - if (!commState.putByteArrayClient(bytes)) + if (!commState.putByteArray(null, bytes)) return false; commState.idx++; @@ -78,12 +78,12 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa switch (commState.idx) { case 0: - byte[] bytes0 = commState.getByteArrayClient(GridClientHandshakeRequest.PACKET_SIZE); - - if (bytes0 == BYTE_ARR_NOT_READ) - return false; - - bytes = bytes0; +// byte[] bytes0 = commState.getByteArray(null, GridClientHandshakeRequest.PACKET_SIZE); +// +// if (bytes0 == BYTE_ARR_NOT_READ) +// return false; +// +// bytes = bytes0; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index bc5b7af..c77964b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -43,7 +43,7 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java index 99e1306..4779afb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java @@ -125,7 +125,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -133,32 +133,32 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putIntClient(msgSize)) + if (!commState.putInt(null, msgSize)) return false; commState.idx++; case 1: - if (!commState.putLongClient(reqId)) + if (!commState.putLong(null, reqId)) return false; commState.idx++; case 2: - if (!commState.putUuidClient(clientId)) + if (!commState.putUuid(null, clientId)) return false; commState.idx++; case 3: - if (!commState.putUuidClient(destId)) + if (!commState.putUuid(null, destId)) return false; commState.idx++; case 4: - if (!commState.putByteBufferClient(msg)) - return false; +// if (!commState.putByteBuffer(null, msg)) +// return false; commState.idx++; @@ -176,7 +176,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 4) return false; - msgSize = commState.getIntClient(); + msgSize = commState.getInt(null); if (msgSize == 0) // Ping message. return true; @@ -187,12 +187,12 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 8) return false; - reqId = commState.getLongClient(); + reqId = commState.getLong(null); commState.idx++; case 2: - UUID clientId0 = commState.getUuidClient(); + UUID clientId0 = commState.getUuid(null); if (clientId0 == UUID_NOT_READ) return false; @@ -202,7 +202,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 3: - UUID destId0 = commState.getUuidClient(); + UUID destId0 = commState.getUuid(null); if (destId0 == UUID_NOT_READ) return false; @@ -212,14 +212,14 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 4: - byte[] msg0 = commState.getByteArrayClient(msgSize - 40); - - if (msg0 == BYTE_ARR_NOT_READ) - return false; - - msg = ByteBuffer.wrap(msg0); - - commState.idx++; +// byte[] msg0 = commState.getByteArray(null, msgSize - 40); +// +// if (msg0 == BYTE_ARR_NOT_READ) +// return false; +// +// msg = ByteBuffer.wrap(msg0); +// +// commState.idx++; } return true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java index 517b804..b719531 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -29,7 +29,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -37,7 +37,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - if (!commState.putIntClient(size)) + if (!commState.putInt(null, size)) return false; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java index 0485f3f..2b66ef6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -115,7 +115,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -123,13 +123,13 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(taskId)) + if (!commState.putGridUuid(null, taskId)) return false; commState.idx++; case 1: - if (!commState.putByteArray(topicBytes)) + if (!commState.putByteArray(null, topicBytes)) return false; commState.idx++; @@ -146,7 +146,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid taskId0 = commState.getGridUuid(); + IgniteUuid taskId0 = commState.getGridUuid(null); if (taskId0 == GRID_UUID_NOT_READ) return false; @@ -156,7 +156,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray(); + byte[] topicBytes0 = commState.getByteArray(null); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java index 91cb28f..ad9e42f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -135,7 +135,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -143,25 +143,25 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putString(err)) + if (!commState.putString(null, err)) return false; commState.idx++; case 1: - if (!commState.putBoolean(finished)) + if (!commState.putBoolean(null, finished)) return false; commState.idx++; case 2: - if (!commState.putBoolean(found)) + if (!commState.putBoolean(null, found)) return false; commState.idx++; case 3: - if (!commState.putByteArray(resBytes)) + if (!commState.putByteArray(null, resBytes)) return false; commState.idx++; @@ -178,7 +178,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String err0 = commState.getString(); + String err0 = commState.getString(null); if (err0 == STR_NOT_READ) return false; @@ -191,7 +191,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - finished = commState.getBoolean(); + finished = commState.getBoolean(null); commState.idx++; @@ -199,12 +199,12 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - found = commState.getBoolean(); + found = commState.getBoolean(null); commState.idx++; case 3: - byte[] resBytes0 = commState.getByteArray(); + byte[] resBytes0 = commState.getByteArray(null); if (resBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 40c0331..077aa93 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -58,7 +58,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -66,7 +66,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - if (!commState.putByteArrayClient(bytes)) + if (!commState.putByteArray(null, bytes)) return false; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java index d42c762..99dcd44 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java @@ -38,20 +38,16 @@ public class GridTcpRestDirectParser implements GridNioParser { /** Protocol handler. */ private final GridTcpRestProtocol proto; - /** Message reader. */ - private final GridNioMessageReader msgReader; - /** * @param proto Protocol handler. - * @param msgReader Message reader. */ - public GridTcpRestDirectParser(GridTcpRestProtocol proto, GridNioMessageReader msgReader) { + public GridTcpRestDirectParser(GridTcpRestProtocol proto) { this.proto = proto; - this.msgReader = msgReader; } /** {@inheritDoc} */ - @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException { + @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) + throws IOException, IgniteCheckedException { ParserState state = ses.removeMeta(PARSER_STATE.ordinal()); if (state != null) { @@ -100,7 +96,7 @@ public class GridTcpRestDirectParser implements GridNioParser { boolean finished = false; if (buf.hasRemaining()) - finished = msgReader.read(null, msg, buf); + finished = msg.readFrom(buf); if (finished) { if (msg instanceof GridClientMessageWrapper) { diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestProtocol.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestProtocol.java index 24e259f..1974347 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestProtocol.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestProtocol.java @@ -22,7 +22,6 @@ import org.gridgain.grid.kernal.*; import org.gridgain.grid.kernal.processors.rest.*; import org.gridgain.grid.kernal.processors.rest.client.message.*; import org.gridgain.grid.kernal.processors.rest.protocols.*; -import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.nio.*; import org.gridgain.grid.util.nio.ssl.*; import org.gridgain.grid.util.typedef.internal.*; @@ -49,59 +48,6 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter { /** NIO server listener. */ private GridTcpRestNioListener lsnr; - /** Message reader. */ - private final GridNioMessageReader msgReader = new GridNioMessageReader() { - @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageReader(this, nodeId); - - return msg.readFrom(buf); - } - - @Nullable @Override public GridTcpMessageFactory messageFactory() { - return null; - } - }; - - /** Message writer. */ - private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() { - @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) { - assert msg != null; - assert buf != null; - - msg.messageWriter(this, nodeId); - - return msg.writeTo(buf); - } - - @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out, - ByteBuffer buf) throws IOException { - assert msg != null; - assert out != null; - assert buf != null; - assert buf.hasArray(); - - msg.messageWriter(this, nodeId); - - boolean finished = false; - int cnt = 0; - - while (!finished) { - finished = msg.writeTo(buf); - - out.write(buf.array(), 0, buf.position()); - - cnt += buf.position(); - - buf.clear(); - } - - return cnt; - } - }; - /** @param ctx Context. */ public GridTcpRestProtocol(GridKernalContext ctx) { super(ctx); @@ -152,7 +98,7 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter { lsnr = new GridTcpRestNioListener(log, this, hnd, ctx); - GridNioParser parser = new GridTcpRestDirectParser(this, msgReader); + GridNioParser parser = new GridTcpRestDirectParser(this); try { host = resolveRestTcpHost(ctx.config()); @@ -291,7 +237,6 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter { .sendQueueLimit(cfg.getRestTcpSendQueueLimit()) .filters(filters) .directMode(true) - .messageWriter(msgWriter) .build(); srv.idleTimeout(cfg.getRestIdleTimeout()); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java index be602db..cc56dc8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java @@ -69,7 +69,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -77,7 +77,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putGridUuid(cancelledFutId)) + if (!commState.putGridUuid(null, cancelledFutId)) return false; commState.idx++; @@ -94,7 +94,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid cancelledFutId0 = commState.getGridUuid(); + IgniteUuid cancelledFutId0 = commState.getGridUuid(null); if (cancelledFutId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java index 40e8d5a..39c8cf2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java @@ -170,7 +170,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -178,25 +178,25 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda switch (commState.idx) { case 0: - if (!commState.putByteArray(batchBytes)) + if (!commState.putByteArray(null, batchBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(clsLdrId)) + if (!commState.putGridUuid(null, clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putEnum(depMode)) + if (!commState.putEnum(null, depMode)) return false; commState.idx++; case 3: - if (!commState.putBoolean(forceLocDep)) + if (!commState.putBoolean(null, forceLocDep)) return false; commState.idx++; @@ -204,7 +204,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda case 4: if (ldrParticipants != null) { if (commState.it == null) { - if (!commState.putInt(ldrParticipants.size())) + if (!commState.putInt(null, ldrParticipants.size())) return false; commState.it = ldrParticipants.entrySet().iterator(); @@ -217,13 +217,13 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda Map.Entry e = (Map.Entry)commState.cur; if (!commState.keyDone) { - if (!commState.putUuid(e.getKey())) + if (!commState.putUuid(null, e.getKey())) return false; commState.keyDone = true; } - if (!commState.putGridUuid(e.getValue())) + if (!commState.putGridUuid(null, e.getValue())) return false; commState.keyDone = false; @@ -233,20 +233,20 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 5: - if (!commState.putString(sampleClsName)) + if (!commState.putString(null, sampleClsName)) return false; commState.idx++; case 6: - if (!commState.putString(userVer)) + if (!commState.putString(null, userVer)) return false; commState.idx++; @@ -263,7 +263,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda switch (commState.idx) { case 0: - byte[] batchBytes0 = commState.getByteArray(); + byte[] batchBytes0 = commState.getByteArray(null); if (batchBytes0 == BYTE_ARR_NOT_READ) return false; @@ -273,7 +273,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(); + IgniteUuid clsLdrId0 = commState.getGridUuid(null); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -286,7 +286,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(); + byte depMode0 = commState.getByte(null); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -296,7 +296,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(); + forceLocDep = commState.getBoolean(null); commState.idx++; @@ -305,7 +305,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -314,7 +314,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -323,7 +323,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.keyDone = true; } - IgniteUuid _val = commState.getGridUuid(); + IgniteUuid _val = commState.getGridUuid(null); if (_val == GRID_UUID_NOT_READ) return false; @@ -343,7 +343,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 5: - String sampleClsName0 = commState.getString(); + String sampleClsName0 = commState.getString(null); if (sampleClsName0 == STR_NOT_READ) return false; @@ -353,7 +353,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 6: - String userVer0 = commState.getString(); + String userVer0 = commState.getString(null); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java index 2933e45..fc3cfcb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java @@ -90,7 +90,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -98,13 +98,13 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(errBytes)) + if (!commState.putByteArray(null, errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; @@ -121,7 +121,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(); + byte[] errBytes0 = commState.getByteArray(null); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -131,7 +131,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/GridLongList.java b/modules/core/src/main/java/org/gridgain/grid/util/GridLongList.java index f740ad9..857f80a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/GridLongList.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/GridLongList.java @@ -369,10 +369,14 @@ public class GridLongList implements Externalizable { } /** - * @return Internal array. + * @return Array copy. */ - public long[] internalArray() { - return arr; + public long[] array() { + long[] res = new long[idx]; + + System.arraycopy(arr, 0, res, 0, idx); + + return res; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java b/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java index 803badd..3e9f61c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java @@ -27,6 +27,7 @@ import org.gridgain.grid.kernal.managers.deployment.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.streamer.*; import org.apache.ignite.spi.discovery.*; +import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.io.*; import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.typedef.*; @@ -9027,4 +9028,37 @@ public abstract class GridUtils { return list; } + + /** + * Fully writes communication message to provided stream. + * + * @param msg Message. + * @param out Stream to write to. + * @param buf Byte buffer that will be passed to {@link GridTcpCommunicationMessageAdapter#writeTo(ByteBuffer)} + * method. + * @return Number of written bytes. + * @throws IOException In case of error. + */ + public static int writeMessageFully(GridTcpCommunicationMessageAdapter msg, OutputStream out, ByteBuffer buf) + throws IOException { + assert msg != null; + assert out != null; + assert buf != null; + assert buf.hasArray(); + + boolean finished = false; + int cnt = 0; + + while (!finished) { + finished = msg.writeTo(buf); + + out.write(buf.array(), 0, buf.position()); + + cnt += buf.position(); + + buf.clear(); + } + + return cnt; + } } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java new file mode 100644 index 0000000..4433cbf --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java @@ -0,0 +1,726 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.gridgain.grid.kernal.processors.portable.*; +import org.gridgain.grid.util.*; +import sun.misc.*; +import sun.nio.ch.*; + +import java.nio.*; + +import static org.gridgain.grid.util.direct.GridTcpCommunicationMessageAdapter.*; + +/** + * Portable stream based on {@link ByteBuffer}. + */ +public class GridPortableByteBufferStream implements GridPortableOutputStream, GridPortableInputStream { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** */ + private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); + + /** */ + private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); + + /** */ + private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); + + /** */ + private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); + + /** */ + private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); + + /** */ + private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); + + /** */ + private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); + + /** */ + private static final byte[] BYTE_ARR_EMPTY = new byte[0]; + + /** */ + private static final short[] SHORT_ARR_EMPTY = new short[0]; + + /** */ + private static final int[] INT_ARR_EMPTY = new int[0]; + + /** */ + private static final long[] LONG_ARR_EMPTY = new long[0]; + + /** */ + private static final float[] FLOAT_ARR_EMPTY = new float[0]; + + /** */ + private static final double[] DOUBLE_ARR_EMPTY = new double[0]; + + /** */ + private static final char[] CHAR_ARR_EMPTY = new char[0]; + + /** */ + private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; + + /** */ + private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { + @Override public byte[] create(int len) { + switch (len) { + case -1: + return BYTE_ARR_NOT_READ; + + case 0: + return BYTE_ARR_EMPTY; + + default: + return new byte[len]; + } + } + }; + + /** */ + private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { + @Override public short[] create(int len) { + switch (len) { + case -1: + return SHORT_ARR_NOT_READ; + + case 0: + return SHORT_ARR_EMPTY; + + default: + return new short[len]; + } + } + }; + + /** */ + private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { + @Override public int[] create(int len) { + switch (len) { + case -1: + return INT_ARR_NOT_READ; + + case 0: + return INT_ARR_EMPTY; + + default: + return new int[len]; + } + } + }; + + /** */ + private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { + @Override public long[] create(int len) { + switch (len) { + case -1: + return LONG_ARR_NOT_READ; + + case 0: + return LONG_ARR_EMPTY; + + default: + return new long[len]; + } + } + }; + + /** */ + private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { + @Override public float[] create(int len) { + switch (len) { + case -1: + return FLOAT_ARR_NOT_READ; + + case 0: + return FLOAT_ARR_EMPTY; + + default: + return new float[len]; + } + } + }; + + /** */ + private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { + @Override public double[] create(int len) { + switch (len) { + case -1: + return DOUBLE_ARR_NOT_READ; + + case 0: + return DOUBLE_ARR_EMPTY; + + default: + return new double[len]; + } + } + }; + + /** */ + private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { + @Override public char[] create(int len) { + switch (len) { + case -1: + return CHAR_ARR_NOT_READ; + + case 0: + return CHAR_ARR_EMPTY; + + default: + return new char[len]; + } + } + }; + + /** */ + private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { + @Override public boolean[] create(int len) { + switch (len) { + case -1: + return BOOLEAN_ARR_NOT_READ; + + case 0: + return BOOLEAN_ARR_EMPTY; + + default: + return new boolean[len]; + } + } + }; + + /** */ + private ByteBuffer buf; + + /** */ + private byte[] heapArr; + + /** */ + private long baseOff; + + /** */ + private int arrOff; + + /** */ + private Object tmpArr; + + /** */ + private int tmpArrOff; + + /** */ + private int tmpArrBytes; + + /** */ + private boolean msgTypeDone; + + /** */ + private GridTcpCommunicationMessageAdapter msg; + + /** */ + private boolean lastWritten; + + /** + * @param buf Buffer. + */ + public final void setBuffer(ByteBuffer buf) { + assert buf != null; + + if (this.buf != buf) { + this.buf = buf; + + heapArr = buf.isDirect() ? null : buf.array(); + baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; + } + } + + /** + * @return Whether last object was fully written. + */ + public boolean lastWritten() { + boolean lastWritten0 = lastWritten; + + lastWritten = false; + + return lastWritten0; + } + + /** + * @param msg Message. + */ + public void writeMessage(GridTcpCommunicationMessageAdapter msg) { + assert msg != null; + + lastWritten = msg.writeTo(buf); + } + + /** + * @return Message. + */ + public GridTcpCommunicationMessageAdapter readMessage() { + if (!msgTypeDone) { + if (!buf.hasRemaining()) + return MSG_NOT_READ; + + byte type = readByte(); + + msg = GridTcpCommunicationMessageFactory.create(type); + + msgTypeDone = true; + } + + if (msg.readFrom(buf)) { + GridTcpCommunicationMessageAdapter msg0 = msg; + + msgTypeDone = false; + msg = null; + + return msg0; + } + else + return MSG_NOT_READ; + } + + /** {@inheritDoc} */ + @Override public void writeByte(byte val) { + int pos = buf.position(); + + UNSAFE.putByte(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + @Override public void writeByteArray(byte[] val) { + assert val != null; + + lastWritten = writeArray(val, BYTE_ARR_OFF, val.length); + } + + /** {@inheritDoc} */ + @Override public void writeBoolean(boolean val) { + int pos = buf.position(); + + UNSAFE.putBoolean(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + @Override public void writeBooleanArray(boolean[] val) { + assert val != null; + + lastWritten = writeArray(val, BOOLEAN_ARR_OFF, val.length); + } + + /** {@inheritDoc} */ + @Override public void writeShort(short val) { + int pos = buf.position(); + + UNSAFE.putShort(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + @Override public void writeShortArray(short[] val) { + assert val != null; + + lastWritten = writeArray(val, SHORT_ARR_OFF, val.length << 1); + } + + /** {@inheritDoc} */ + @Override public void writeChar(char val) { + int pos = buf.position(); + + UNSAFE.putChar(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + @Override public void writeCharArray(char[] val) { + assert val != null; + + lastWritten = writeArray(val, CHAR_ARR_OFF, val.length << 1); + } + + /** {@inheritDoc} */ + @Override public void writeInt(int val) { + int pos = buf.position(); + + UNSAFE.putInt(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + @Override public void writeInt(int pos, int val) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeIntArray(int[] val) { + assert val != null; + + lastWritten = writeArray(val, INT_ARR_OFF, val.length << 2); + } + + /** {@inheritDoc} */ + @Override public void writeFloat(float val) { + int pos = buf.position(); + + UNSAFE.putFloat(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + @Override public void writeFloatArray(float[] val) { + assert val != null; + + lastWritten = writeArray(val, FLOAT_ARR_OFF, val.length << 2); + } + + /** {@inheritDoc} */ + @Override public void writeLong(long val) { + int pos = buf.position(); + + UNSAFE.putLong(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + @Override public void writeLongArray(long[] val) { + assert val != null; + + lastWritten = writeArray(val, LONG_ARR_OFF, val.length << 3); + } + + /** {@inheritDoc} */ + @Override public void writeDouble(double val) { + int pos = buf.position(); + + UNSAFE.putDouble(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + @Override public void writeDoubleArray(double[] val) { + assert val != null; + + lastWritten = writeArray(val, DOUBLE_ARR_OFF, val.length << 3); + } + + /** {@inheritDoc} */ + @Override public void write(byte[] arr, int off, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void write(long addr, int cnt) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public byte readByte() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getByte(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public byte[] readByteArray(int cnt) { + return readArray(BYTE_ARR_CREATOR, cnt, 0, BYTE_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public boolean readBoolean() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getBoolean(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public boolean[] readBooleanArray(int cnt) { + return readArray(BOOLEAN_ARR_CREATOR, cnt, 0, BOOLEAN_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public short readShort() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getShort(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public short[] readShortArray(int cnt) { + return readArray(SHORT_ARR_CREATOR, cnt, 1, SHORT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public char readChar() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getChar(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public char[] readCharArray(int cnt) { + return readArray(CHAR_ARR_CREATOR, cnt, 1, CHAR_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public int readInt() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getInt(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public int readInt(int pos) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int[] readIntArray(int cnt) { + return readArray(INT_ARR_CREATOR, cnt, 2, INT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public float readFloat() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getFloat(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public float[] readFloatArray(int cnt) { + return readArray(FLOAT_ARR_CREATOR, cnt, 2, FLOAT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public long readLong() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getLong(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public long[] readLongArray(int cnt) { + return readArray(LONG_ARR_CREATOR, cnt, 3, LONG_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public double readDouble() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getDouble(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public double[] readDoubleArray(int cnt) { + return readArray(DOUBLE_ARR_CREATOR, cnt, 3, DOUBLE_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public int read(byte[] arr, int off, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int read(long addr, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int position() { + return buf.position(); + } + + /** {@inheritDoc} */ + @Override public void position(int pos) { + buf.position(pos); + } + + /** {@inheritDoc} */ + public int remaining() { + return buf.remaining(); + } + + /** {@inheritDoc} */ + @Override public void close() { + // No-op. + } + + /** {@inheritDoc} */ + @Override public byte[] array() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public byte[] arrayCopy() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public long offheapPointer() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean hasArray() { + throw new UnsupportedOperationException(); + } + + /** + * @param arr Array. + * @param off Offset. + * @param bytes Length in bytes. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int bytes) { + assert arr != null; + assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); + assert off > 0; + assert bytes >= 0; + assert bytes >= arrOff; + + if (!buf.hasRemaining()) + return false; + + int toWrite = bytes - arrOff; + int pos = buf.position(); + int remaining = buf.remaining(); + + if (toWrite <= remaining) { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); + + pos += toWrite; + + buf.position(pos); + + arrOff = 0; + + return true; + } + else { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); + + pos += remaining; + + buf.position(pos); + + arrOff += remaining; + + return false; + } + } + + /** + * @param creator Array creator. + * @param len Array Array length. + * @param lenShift Array length shift size. + * @param off Base offset. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int len, int lenShift, long off) { + assert creator != null; + + if (tmpArr == null) { + assert len >= 0; + + switch (len) { + case 0: + return creator.create(0); + + default: + tmpArr = creator.create(len); + tmpArrBytes = len << lenShift; + } + } + + int toRead = tmpArrBytes - tmpArrOff; + int remaining = buf.remaining(); + int pos = buf.position(); + + if (remaining < toRead) { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); + + buf.position(pos + remaining); + + tmpArrOff += remaining; + + return creator.create(-1); + } + else { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); + + buf.position(pos + toRead); + + T arr = (T)tmpArr; + + tmpArr = null; + tmpArrBytes = 0; + tmpArrOff = 0; + + return arr; + } + } + + /** + * Array creator. + */ + private static interface ArrayCreator { + /** + * @param len Array length or {@code -1} if array was not fully read. + * @return New array. + */ + public T create(int len); + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java index af63a2f..8961688 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java @@ -14,8 +14,6 @@ import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; import org.gridgain.grid.kernal.processors.clock.*; import org.gridgain.grid.util.*; -import org.gridgain.grid.util.nio.*; -import org.jetbrains.annotations.*; import java.io.*; import java.nio.*; @@ -120,26 +118,6 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); /** - * @param msgWriter Message writer. - * @param nodeId Node ID (provided only if versions are different). - */ - public void messageWriter(GridNioMessageWriter msgWriter, @Nullable UUID nodeId) { - assert msgWriter != null; - - commState.messageWriter(msgWriter, nodeId); - } - - /** - * @param msgReader Message reader. - * @param nodeId Node ID (provided only if versions are different). - */ - public void messageReader(GridNioMessageReader msgReader, @Nullable UUID nodeId) { - assert msgReader != null; - - commState.messageReader(msgReader, nodeId); - } - - /** * @param buf Byte buffer. * @return Whether message was fully written. */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index abd0d3b..a5df710 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -10,15 +10,13 @@ package org.gridgain.grid.util.direct; import org.apache.ignite.lang.*; +import org.apache.ignite.portables.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; import org.gridgain.grid.kernal.processors.clock.*; import org.gridgain.grid.util.*; -import org.gridgain.grid.util.nio.*; -import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; import sun.misc.*; -import sun.nio.ch.*; import java.nio.*; import java.util.*; @@ -37,225 +35,19 @@ public class GridTcpCommunicationMessageState { private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); /** */ - private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); + private static final int FIELD_HDR_LEN = 9; /** */ - private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); + private final GridPortableByteBufferStream stream = new GridPortableByteBufferStream(); /** */ - private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); + private final PortableWriter writer = null;//new org.gridgain.grid.util.portable.GridPortableWriterImpl(); /** */ - private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); + private final PortableReader reader = null;//new org.gridgain.grid.util.portable.GridPortableReaderImpl(); /** */ - private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); - - /** */ - private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); - - /** */ - private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); - - /** */ - private static final byte[] BYTE_ARR_EMPTY = new byte[0]; - - /** */ - private static final short[] SHORT_ARR_EMPTY = new short[0]; - - /** */ - private static final int[] INT_ARR_EMPTY = new int[0]; - - /** */ - private static final long[] LONG_ARR_EMPTY = new long[0]; - - /** */ - private static final float[] FLOAT_ARR_EMPTY = new float[0]; - - /** */ - private static final double[] DOUBLE_ARR_EMPTY = new double[0]; - - /** */ - private static final char[] CHAR_ARR_EMPTY = new char[0]; - - /** */ - private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; - - /** */ - private static final byte[] EMPTY_UUID_BYTES = new byte[16]; - - /** */ - private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { - @Override public byte[] create(int len) { - switch (len) { - case -1: - return BYTE_ARR_NOT_READ; - - case 0: - return BYTE_ARR_EMPTY; - - default: - return new byte[len]; - } - } - }; - - /** */ - private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { - @Override public short[] create(int len) { - switch (len) { - case -1: - return SHORT_ARR_NOT_READ; - - case 0: - return SHORT_ARR_EMPTY; - - default: - return new short[len]; - } - } - }; - - /** */ - private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { - @Override public int[] create(int len) { - switch (len) { - case -1: - return INT_ARR_NOT_READ; - - case 0: - return INT_ARR_EMPTY; - - default: - return new int[len]; - } - } - }; - - /** */ - private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { - @Override public long[] create(int len) { - switch (len) { - case -1: - return LONG_ARR_NOT_READ; - - case 0: - return LONG_ARR_EMPTY; - - default: - return new long[len]; - } - } - }; - - /** */ - private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { - @Override public float[] create(int len) { - switch (len) { - case -1: - return FLOAT_ARR_NOT_READ; - - case 0: - return FLOAT_ARR_EMPTY; - - default: - return new float[len]; - } - } - }; - - /** */ - private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { - @Override public double[] create(int len) { - switch (len) { - case -1: - return DOUBLE_ARR_NOT_READ; - - case 0: - return DOUBLE_ARR_EMPTY; - - default: - return new double[len]; - } - } - }; - - /** */ - private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { - @Override public char[] create(int len) { - switch (len) { - case -1: - return CHAR_ARR_NOT_READ; - - case 0: - return CHAR_ARR_EMPTY; - - default: - return new char[len]; - } - } - }; - - /** */ - private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { - @Override public boolean[] create(int len) { - switch (len) { - case -1: - return BOOLEAN_ARR_NOT_READ; - - case 0: - return BOOLEAN_ARR_EMPTY; - - default: - return new boolean[len]; - } - } - }; - - /** */ - private GridNioMessageWriter msgWriter; - - /** */ - private GridNioMessageReader msgReader; - - /** */ - private UUID nodeId; - - /** */ - private ByteBuffer buf; - - /** */ - private byte[] heapArr; - - /** */ - private long baseOff; - - /** */ - private boolean arrHdrDone; - - /** */ - private int arrOff; - - /** */ - private Object tmpArr; - - /** */ - private int tmpArrOff; - - /** */ - private int tmpArrBytes; - - /** */ - private boolean msgNotNull; - - /** */ - private boolean msgNotNullDone; - - /** */ - private boolean msgTypeDone; - - /** */ - private GridTcpCommunicationMessageAdapter msg; + private boolean hdrDone; /** */ public int idx; @@ -279,494 +71,562 @@ public class GridTcpCommunicationMessageState { public int readItems; /** - * @param msgWriter Message writer. - * @param nodeId Node ID (provided only if versions are different). - */ - public void messageWriter(GridNioMessageWriter msgWriter, @Nullable UUID nodeId) { - assert msgWriter != null; - - this.msgWriter = msgWriter; - this.nodeId = nodeId; - } - - /** - * @param msgReader Message reader. - * @param nodeId Node ID (provided only if versions are different). - */ - public void messageReader(GridNioMessageReader msgReader, @Nullable UUID nodeId) { - assert msgReader != null; - - this.msgReader = msgReader; - this.nodeId = nodeId; - } - - /** * @param buf Buffer. */ public final void setBuffer(ByteBuffer buf) { assert buf != null; - - if (this.buf != buf) { - this.buf = buf; - - heapArr = buf.isDirect() ? null : buf.array(); - baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; - } } /** + * @param name Field name. * @param b Byte value. * @return Whether value was written. */ - public final boolean putByte(byte b) { - assert buf != null; - - if (!buf.hasRemaining()) + public final boolean putByte(String name, byte b) { + if (stream.remaining() < FIELD_HDR_LEN + 1) return false; - int pos = buf.position(); - - UNSAFE.putByte(heapArr, baseOff + pos, b); - - buf.position(pos + 1); + writer.writeByte(name, b); return true; } /** + * @param name Field name. * @return Byte value. */ - public final byte getByte() { - assert buf != null; - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getByte(heapArr, baseOff + pos); + public final byte getByte(String name) { + return reader.readByte(name); } /** + * @param name Field name. * @param s Short value. * @return Whether value was written. */ - public final boolean putShort(short s) { - assert buf != null; - - if (buf.remaining() < 2) + public final boolean putShort(String name, short s) { + if (stream.remaining() < FIELD_HDR_LEN + 2) return false; - int pos = buf.position(); - - UNSAFE.putShort(heapArr, baseOff + pos, s); - - buf.position(pos + 2); + writer.writeShort(name, s); return true; } /** + * @param name Field name. * @return Short value. */ - public final short getShort() { - assert buf != null; - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getShort(heapArr, baseOff + pos); + public final short getShort(String name) { + return reader.readShort(name); } /** + * @param name Field name. * @param i Integer value. * @return Whether value was written. */ - public final boolean putInt(int i) { - assert buf != null; - - if (buf.remaining() < 4) + public final boolean putInt(String name, int i) { + if (stream.remaining() < FIELD_HDR_LEN + 4) return false; - int pos = buf.position(); - - UNSAFE.putInt(heapArr, baseOff + pos, i); - - buf.position(pos + 4); + writer.writeInt(name, i); return true; } /** + * @param name Field name. * @return Integer value. */ - public final int getInt() { - assert buf != null; - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getInt(heapArr, baseOff + pos); + public final int getInt(String name) { + return reader.readInt(name); } /** + * @param name Field name. * @param l Long value. * @return Whether value was written. */ - public final boolean putLong(long l) { - assert buf != null; - - if (buf.remaining() < 8) + public final boolean putLong(String name, long l) { + if (stream.remaining() < FIELD_HDR_LEN + 8) return false; - int pos = buf.position(); - - UNSAFE.putLong(heapArr, baseOff + pos, l); - - buf.position(pos + 8); + writer.writeLong(name, l); return true; } /** + * @param name Field name. * @return Long value. */ - public final long getLong() { - assert buf != null; - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getLong(heapArr, baseOff + pos); + public final long getLong(String name) { + return reader.readLong(name); } /** + * @param name Field name. * @param f Float value. * @return Whether value was written. */ - public final boolean putFloat(float f) { - assert buf != null; - - if (buf.remaining() < 4) + public final boolean putFloat(String name, float f) { + if (stream.remaining() < FIELD_HDR_LEN + 4) return false; - int pos = buf.position(); - - UNSAFE.putFloat(heapArr, baseOff + pos, f); - - buf.position(pos + 4); + writer.writeFloat(name, f); return true; } /** + * @param name Field name. * @return Float value. */ - public final float getFloat() { - assert buf != null; - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getFloat(heapArr, baseOff + pos); + public final float getFloat(String name) { + return reader.readFloat(name); } /** + * @param name Field name. * @param d Double value. * @return Whether value was written. */ - public final boolean putDouble(double d) { - assert buf != null; - - if (buf.remaining() < 8) + public final boolean putDouble(String name, double d) { + if (stream.remaining() < FIELD_HDR_LEN + 8) return false; - int pos = buf.position(); - - UNSAFE.putDouble(heapArr, baseOff + pos, d); - - buf.position(pos + 8); + writer.writeDouble(name, d); return true; } /** + * @param name Field name. * @return Double value. */ - public final double getDouble() { - assert buf != null; - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getDouble(heapArr, baseOff + pos); + public final double getDouble(String name) { + return reader.readDouble(name); } /** + * @param name Field name. * @param c Char value. * @return Whether value was written. */ - public final boolean putChar(char c) { - assert buf != null; - - if (buf.remaining() < 2) + public final boolean putChar(String name, char c) { + if (stream.remaining() < FIELD_HDR_LEN + 2) return false; - int pos = buf.position(); - - UNSAFE.putChar(heapArr, baseOff + pos, c); - - buf.position(pos + 2); + writer.writeChar(name, c); return true; } /** + * @param name Field name. * @return Char value. */ - public final char getChar() { - assert buf != null; - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getChar(heapArr, baseOff + pos); + public final char getChar(String name) { + return reader.readChar(name); } /** + * @param name Field name. * @param b Boolean value. * @return Whether value was written. */ - public final boolean putBoolean(boolean b) { - assert buf != null; - - if (buf.remaining() < 1) + public final boolean putBoolean(String name, boolean b) { + if (stream.remaining() < FIELD_HDR_LEN + 1) return false; - int pos = buf.position(); - - UNSAFE.putBoolean(heapArr, baseOff + pos, b); - - buf.position(pos + 1); + writer.writeBoolean(name, b); return true; } /** + * @param name Field name. * @return Boolean value. */ - public final boolean getBoolean() { - assert buf != null; - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getBoolean(heapArr, baseOff + pos); + public final boolean getBoolean(String name) { + return reader.readBoolean(name); } /** + * @param name Field name. * @param arr Byte array. * @return Whether array was fully written. */ - public final boolean putByteArray(@Nullable byte[] arr) { - assert buf != null; + public final boolean putByteArray(String name, @Nullable byte[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; + + writer.writeByteArray(name, arr); - int len = arr != null ? arr.length : 0; + hdrDone = true; + } + else + stream.writeByteArray(arr); - return putArray(arr, BYTE_ARR_OFF, len, len); + return lastWritten(); } /** + * @param name Field name. * @return Byte array or special * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_NOT_READ} * value if it was not fully read. */ - public final byte[] getByteArray() { - assert buf != null; + public final byte[] getByteArray(String name) { + byte[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return BYTE_ARR_NOT_READ; + + arr = reader.readByteArray(name); + + hdrDone = true; + } + else + arr = stream.readByteArray(-1); - return getArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF); + if (arr != BYTE_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Short array. * @return Whether array was fully written. */ - public final boolean putShortArray(short[] arr) { - assert buf != null; + public final boolean putShortArray(String name, short[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; - int len = arr != null ? arr.length : 0; + writer.writeShortArray(name, arr); - return putArray(arr, SHORT_ARR_OFF, len, len << 1); + hdrDone = true; + } + else + stream.writeShortArray(arr); + + return lastWritten(); } /** + * @param name Field name. * @return Short array or special * {@link GridTcpCommunicationMessageAdapter#SHORT_ARR_NOT_READ} * value if it was not fully read. */ - public final short[] getShortArray() { - assert buf != null; + public final short[] getShortArray(String name) { + short[] arr; - return getArray(SHORT_ARR_CREATOR, 1, SHORT_ARR_OFF); + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return SHORT_ARR_NOT_READ; + + arr = reader.readShortArray(name); + + hdrDone = true; + } + else + arr = stream.readShortArray(-1); + + if (arr != SHORT_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Integer array. * @return Whether array was fully written. */ - public final boolean putIntArray(int[] arr) { - assert buf != null; + public final boolean putIntArray(String name, int[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; - int len = arr != null ? arr.length : 0; + writer.writeIntArray(name, arr); - return putArray(arr, INT_ARR_OFF, len, len << 2); + hdrDone = true; + } + else + stream.writeIntArray(arr); + + return lastWritten(); } /** + * @param name Field name. * @return Integer array or special * {@link GridTcpCommunicationMessageAdapter#INT_ARR_NOT_READ} * value if it was not fully read. */ - public final int[] getIntArray() { - assert buf != null; + public final int[] getIntArray(String name) { + int[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return INT_ARR_NOT_READ; + + arr = reader.readIntArray(name); + + hdrDone = true; + } + else + arr = stream.readIntArray(-1); - return getArray(INT_ARR_CREATOR, 2, INT_ARR_OFF); + if (arr != INT_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Long array. * @return Whether array was fully written. */ - public final boolean putLongArray(long[] arr) { - assert buf != null; + public final boolean putLongArray(String name, long[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; + + writer.writeLongArray(name, arr); - int len = arr != null ? arr.length : 0; + hdrDone = true; + } + else + stream.writeLongArray(arr); - return putArray(arr, LONG_ARR_OFF, len, len << 3); + return lastWritten(); } /** + * @param name Field name. * @return Long array or special * {@link GridTcpCommunicationMessageAdapter#LONG_ARR_NOT_READ} * value if it was not fully read. */ - public final long[] getLongArray() { - assert buf != null; + public final long[] getLongArray(String name) { + long[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return LONG_ARR_NOT_READ; + + arr = reader.readLongArray(name); + + hdrDone = true; + } + else + arr = stream.readLongArray(-1); + + if (arr != LONG_ARR_NOT_READ) + hdrDone = false; - return getArray(LONG_ARR_CREATOR, 3, LONG_ARR_OFF); + return arr; } /** + * @param name Field name. * @param arr Float array. * @return Whether array was fully written. */ - public final boolean putFloatArray(float[] arr) { - assert buf != null; + public final boolean putFloatArray(String name, float[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; - int len = arr != null ? arr.length : 0; + writer.writeFloatArray(name, arr); + + hdrDone = true; + } + else + stream.writeFloatArray(arr); - return putArray(arr, FLOAT_ARR_OFF, len, len << 2); + return lastWritten(); } /** + * @param name Field name. * @return Float array or special * {@link GridTcpCommunicationMessageAdapter#FLOAT_ARR_NOT_READ} * value if it was not fully read. */ - public final float[] getFloatArray() { - assert buf != null; + public final float[] getFloatArray(String name) { + float[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return FLOAT_ARR_NOT_READ; + + arr = reader.readFloatArray(name); - return getArray(FLOAT_ARR_CREATOR, 2, FLOAT_ARR_OFF); + hdrDone = true; + } + else + arr = stream.readFloatArray(-1); + + if (arr != FLOAT_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Double array. * @return Whether array was fully written. */ - public final boolean putDoubleArray(double[] arr) { - assert buf != null; + public final boolean putDoubleArray(String name, double[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; + + writer.writeDoubleArray(name, arr); - int len = arr != null ? arr.length : 0; + hdrDone = true; + } + else + stream.writeDoubleArray(arr); - return putArray(arr, DOUBLE_ARR_OFF, len, len << 3); + return lastWritten(); } /** + * @param name Field name. * @return Double array or special * {@link GridTcpCommunicationMessageAdapter#DOUBLE_ARR_NOT_READ} * value if it was not fully read. */ - public final double[] getDoubleArray() { - assert buf != null; + public final double[] getDoubleArray(String name) { + double[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return DOUBLE_ARR_NOT_READ; + + arr = reader.readDoubleArray(name); + + hdrDone = true; + } + else + arr = stream.readDoubleArray(-1); - return getArray(DOUBLE_ARR_CREATOR, 3, DOUBLE_ARR_OFF); + if (arr != DOUBLE_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Char array. * @return Whether array was fully written. */ - public final boolean putCharArray(char[] arr) { - assert buf != null; + public final boolean putCharArray(String name, char[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; - int len = arr != null ? arr.length : 0; + writer.writeCharArray(name, arr); - return putArray(arr, CHAR_ARR_OFF, len, len << 1); + hdrDone = true; + } + else + stream.writeCharArray(arr); + + return lastWritten(); } /** + * @param name Field name. * @return Char array or special * {@link GridTcpCommunicationMessageAdapter#CHAR_ARR_NOT_READ} * value if it was not fully read. */ - public final char[] getCharArray() { - assert buf != null; + public final char[] getCharArray(String name) { + char[] arr; - return getArray(CHAR_ARR_CREATOR, 1, CHAR_ARR_OFF); + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return CHAR_ARR_NOT_READ; + + arr = reader.readCharArray(name); + + hdrDone = true; + } + else + arr = stream.readCharArray(-1); + + if (arr != CHAR_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param arr Boolean array. * @return Whether array was fully written. */ - public final boolean putBooleanArray(boolean[] arr) { - assert buf != null; + public final boolean putBooleanArray(String name, boolean[] arr) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return false; - int len = arr != null ? arr.length : 0; + writer.writeBooleanArray(name, arr); - return putArray(arr, BOOLEAN_ARR_OFF, len, len); + hdrDone = true; + } + else + stream.writeBooleanArray(arr); + + return lastWritten(); } /** + * @param name Field name. * @return Boolean array or special * {@link GridTcpCommunicationMessageAdapter#BOOLEAN_ARR_NOT_READ} * value if it was not fully read. */ - public final boolean[] getBooleanArray() { - assert buf != null; + public final boolean[] getBooleanArray(String name) { + boolean[] arr; + + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN + 4) + return BOOLEAN_ARR_NOT_READ; + + arr = reader.readBooleanArray(name); + + hdrDone = true; + } + else + arr = stream.readBooleanArray(-1); - return getArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF); + if (arr != BOOLEAN_ARR_NOT_READ) + hdrDone = false; + + return arr; } /** + * @param name Field name. * @param uuid {@link UUID}. * @return Whether value was fully written. */ - public final boolean putUuid(@Nullable UUID uuid) { + public final boolean putUuid(String name, @Nullable UUID uuid) { byte[] arr = null; if (uuid != null) { @@ -776,16 +636,17 @@ public class GridTcpCommunicationMessageState { UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link UUID} or special * {@link GridTcpCommunicationMessageAdapter#UUID_NOT_READ} * value if it was not fully read. */ - public final UUID getUuid() { - byte[] arr = getByteArray(); + public final UUID getUuid(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return UUID_NOT_READ; @@ -800,10 +661,11 @@ public class GridTcpCommunicationMessageState { } /** - * @param uuid {@link org.apache.ignite.lang.IgniteUuid}. + * @param name Field name. + * @param uuid {@link IgniteUuid}. * @return Whether value was fully written. */ - public final boolean putGridUuid(@Nullable IgniteUuid uuid) { + public final boolean putGridUuid(String name, @Nullable IgniteUuid uuid) { byte[] arr = null; if (uuid != null) { @@ -814,16 +676,17 @@ public class GridTcpCommunicationMessageState { UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link org.apache.ignite.lang.IgniteUuid} or special * {@link GridTcpCommunicationMessageAdapter#GRID_UUID_NOT_READ} * value if it was not fully read. */ - public final IgniteUuid getGridUuid() { - byte[] arr = getByteArray(); + public final IgniteUuid getGridUuid(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return GRID_UUID_NOT_READ; @@ -839,10 +702,11 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param ver {@link GridClockDeltaVersion}. * @return Whether value was fully written. */ - public final boolean putClockDeltaVersion(@Nullable GridClockDeltaVersion ver) { + public final boolean putClockDeltaVersion(String name, @Nullable GridClockDeltaVersion ver) { byte[] arr = null; if (ver != null) { @@ -852,16 +716,17 @@ public class GridTcpCommunicationMessageState { UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link GridClockDeltaVersion} or special * {@link GridTcpCommunicationMessageAdapter#CLOCK_DELTA_VER_NOT_READ} * value if it was not fully read. */ - public final GridClockDeltaVersion getClockDeltaVersion() { - byte[] arr = getByteArray(); + public final GridClockDeltaVersion getClockDeltaVersion(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return CLOCK_DELTA_VER_NOT_READ; @@ -876,24 +741,23 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param list {@link GridByteArrayList}. * @return Whether value was fully written. */ - public final boolean putByteArrayList(@Nullable GridByteArrayList list) { - byte[] arr = list != null ? list.internalArray() : null; - int size = list != null ? list.size() : 0; - - return putArray(arr, BYTE_ARR_OFF, size, size); + public final boolean putByteArrayList(String name, @Nullable GridByteArrayList list) { + return putByteArray(name, list != null ? list.array() : null); } /** + * @param name Field name. * @return {@link GridByteArrayList} or special * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_LIST_NOT_READ} * value if it was not fully read. */ @SuppressWarnings("IfMayBeConditional") - public final GridByteArrayList getByteArrayList() { - byte[] arr = getByteArray(); + public final GridByteArrayList getByteArrayList(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return BYTE_ARR_LIST_NOT_READ; @@ -904,24 +768,23 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param list {@link GridLongList}. * @return Whether value was fully written. */ - public final boolean putLongList(@Nullable GridLongList list) { - long[] arr = list != null ? list.internalArray() : null; - int size = list != null ? list.size() : 0; - - return putArray(arr, LONG_ARR_OFF, size, size << 3); + public final boolean putLongList(String name, @Nullable GridLongList list) { + return putLongArray(name, list != null ? list.array() : null); } /** + * @param name Field name. * @return {@link GridLongList} or special * {@link GridTcpCommunicationMessageAdapter#LONG_LIST_NOT_READ} * value if it was not fully read. */ @SuppressWarnings("IfMayBeConditional") - public final GridLongList getLongList() { - long[] arr = getLongArray(); + public final GridLongList getLongList(String name) { + long[] arr = getLongArray(name); if (arr == LONG_ARR_NOT_READ) return LONG_LIST_NOT_READ; @@ -932,10 +795,11 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param ver {@link GridCacheVersion}. * @return Whether value was fully written. */ - public final boolean putCacheVersion(@Nullable GridCacheVersion ver) { + public final boolean putCacheVersion(String name, @Nullable GridCacheVersion ver) { byte[] arr = null; if (ver != null) { @@ -947,16 +811,17 @@ public class GridTcpCommunicationMessageState { UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link GridCacheVersion} or special * {@link GridTcpCommunicationMessageAdapter#CACHE_VER_NOT_READ} * value if it was not fully read. */ - public final GridCacheVersion getCacheVersion() { - byte[] arr = getByteArray(); + public final GridCacheVersion getCacheVersion(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return CACHE_VER_NOT_READ; @@ -973,10 +838,11 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param id {@link GridDhtPartitionExchangeId}. * @return Whether value was fully written. */ - public final boolean putDhtPartitionExchangeId(@Nullable GridDhtPartitionExchangeId id) { + public final boolean putDhtPartitionExchangeId(String name, @Nullable GridDhtPartitionExchangeId id) { byte[] arr = null; if (id != null) { @@ -988,16 +854,17 @@ public class GridTcpCommunicationMessageState { UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link GridDhtPartitionExchangeId} or special * {@link GridTcpCommunicationMessageAdapter#DHT_PART_EXCHANGE_ID_NOT_READ} * value if it was not fully read. */ - public final GridDhtPartitionExchangeId getDhtPartitionExchangeId() { - byte[] arr = getByteArray(); + public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return DHT_PART_EXCHANGE_ID_NOT_READ; @@ -1014,20 +881,23 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param bytes {@link GridCacheValueBytes}. * @return Whether value was fully written. */ - public final boolean putValueBytes(@Nullable GridCacheValueBytes bytes) { + public final boolean putValueBytes(String name, @Nullable GridCacheValueBytes bytes) { byte[] arr = null; if (bytes != null) { - if (bytes.get() != null) { - int len = bytes.get().length; + byte[] bytes0 = bytes.get(); + + if (bytes0 != null) { + int len = bytes0.length; arr = new byte[len + 2]; UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); - UNSAFE.copyMemory(bytes.get(), BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); + UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); } else { @@ -1037,16 +907,17 @@ public class GridTcpCommunicationMessageState { } } - return putByteArray(arr); + return putByteArray(name, arr); } /** + * @param name Field name. * @return {@link GridCacheValueBytes} or special * {@link GridTcpCommunicationMessageAdapter#VAL_BYTES_NOT_READ} * value if it was not fully read. */ - public final GridCacheValueBytes getValueBytes() { - byte[] arr = getByteArray(); + public final GridCacheValueBytes getValueBytes(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return VAL_BYTES_NOT_READ; @@ -1074,20 +945,22 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param str {@link String}. * @return Whether value was fully written. */ - public final boolean putString(@Nullable String str) { - return putByteArray(str != null ? str.getBytes() : null); + public final boolean putString(String name, @Nullable String str) { + return putByteArray(name, str != null ? str.getBytes() : null); } /** + * @param name Field name. * @return {@link String} or special {@link GridTcpCommunicationMessageAdapter#STR_NOT_READ} * value if it was not fully read. */ @SuppressWarnings("IfMayBeConditional") - public final String getString() { - byte[] arr = getByteArray(); + public final String getString(String name) { + byte[] arr = getByteArray(name); if (arr == BYTE_ARR_NOT_READ) return STR_NOT_READ; @@ -1098,20 +971,22 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param bits {@link BitSet}. * @return Whether value was fully written. */ - public final boolean putBitSet(@Nullable BitSet bits) { - return putLongArray(bits != null ? bits.toLongArray() : null); + public final boolean putBitSet(String name, @Nullable BitSet bits) { + return putLongArray(name, bits != null ? bits.toLongArray() : null); } /** + * @param name Field name. * @return {@link BitSet} or special {@link GridTcpCommunicationMessageAdapter#BIT_SET_NOT_READ} * value if it was not fully read. */ @SuppressWarnings("IfMayBeConditional") - public final BitSet getBitSet() { - long[] arr = getLongArray(); + public final BitSet getBitSet(String name) { + long[] arr = getLongArray(name); if (arr == LONG_ARR_NOT_READ) return BIT_SET_NOT_READ; @@ -1122,469 +997,69 @@ public class GridTcpCommunicationMessageState { } /** + * @param name Field name. * @param e Enum. * @return Whether value was fully written. */ - public final boolean putEnum(@Nullable Enum e) { - return putByte(e != null ? (byte)e.ordinal() : -1); + public final boolean putEnum(String name, @Nullable Enum e) { + return putByte(name, e != null ? (byte)e.ordinal() : -1); } /** + * @param name Field name. * @param msg {@link GridTcpCommunicationMessageAdapter}. * @return Whether value was fully written. */ - public final boolean putMessage(@Nullable GridTcpCommunicationMessageAdapter msg) { - assert buf != null; - - if (!msgNotNullDone) { - if (!putBoolean(msg != null)) + public final boolean putMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN) return false; - msgNotNullDone = true; - } - - if (msg != null) { - if (!msgWriter.write(nodeId, msg, buf)) - return false; + writer.writeObject(name, msg); - msgNotNullDone = false; + hdrDone = true; } + else + stream.writeMessage(msg); - return true; + return lastWritten(); } /** + * @param name Field name. * @return {@link GridTcpCommunicationMessageAdapter} or special - * {@link GridTcpCommunicationMessageAdapter#MSG_NOT_READ} + * {@link GridTcpCommunicationMessageAdapter#MSG_NOT_READ} * value if it was not fully read. */ - public final GridTcpCommunicationMessageAdapter getMessage() { - assert buf != null; + public final GridTcpCommunicationMessageAdapter getMessage(String name) { + GridTcpCommunicationMessageAdapter msg; - if (!msgNotNullDone) { - if (!buf.hasRemaining()) + if (!hdrDone) { + if (stream.remaining() < FIELD_HDR_LEN) return MSG_NOT_READ; - msgNotNull = getBoolean(); - - msgNotNullDone = true; - } - - if (msgNotNull) { - if (!msgTypeDone) { - if (!buf.hasRemaining()) - return MSG_NOT_READ; - - GridTcpMessageFactory factory = msgReader.messageFactory(); - - byte type = getByte(); - - msg = factory != null ? factory.create(type) : GridTcpCommunicationMessageFactory.create(type); - - msgTypeDone = true; - } - - if (msgReader.read(nodeId, msg, buf)) { - GridTcpCommunicationMessageAdapter msg0 = msg; + msg = reader.readObject(name); - msgNotNullDone = false; - msgTypeDone = false; - msg = null; - - return msg0; - } - else - return MSG_NOT_READ; + hdrDone = true; } else - return null; - } - - /** - * @param arr Array. - * @param off Offset. - * @param len Length. - * @param bytes Length in bytes. - * @return Whether array was fully written - */ - private boolean putArray(@Nullable Object arr, long off, int len, int bytes) { - assert off > 0; - assert len >= 0; - assert bytes >= 0; - assert bytes >= arrOff; - - if (!buf.hasRemaining()) - return false; - - int pos = buf.position(); - - if (arr != null) { - assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); - - if (!arrHdrDone) { - if (buf.remaining() < 5) - return false; - - UNSAFE.putBoolean(heapArr, baseOff + pos++, true); - UNSAFE.putInt(heapArr, baseOff + pos, len); - - pos += 4; - - buf.position(pos); - - arrHdrDone = true; - } - - if (!buf.hasRemaining()) - return false; - - int left = bytes - arrOff; - int remaining = buf.remaining(); - - if (left <= remaining) { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, left); - - pos += left; - - buf.position(pos); - - arrHdrDone = false; - arrOff = 0; - } - else { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); - - pos += remaining; - - buf.position(pos); - - arrOff += remaining; - - return false; - } - } - else { - UNSAFE.putBoolean(heapArr, baseOff + pos++, false); - - buf.position(pos); - } - - return true; - } - - /** - * @param creator Array creator. - * @param lenShift Array length shift size. - * @param off Base offset. - * @return Array or special value if it was not fully read. - */ - private T getArray(ArrayCreator creator, int lenShift, long off) { - assert creator != null; - assert lenShift >= 0; - - if (!arrHdrDone) { - if (!buf.hasRemaining()) - return creator.create(-1); - - if (!getBoolean()) - return null; - - arrHdrDone = true; - } - - if (tmpArr == null) { - if (buf.remaining() < 4) - return creator.create(-1); - - int len = getInt(); - - if (len == 0) { - arrHdrDone = false; - - return creator.create(0); - } - - tmpArr = creator.create(len); - tmpArrBytes = len << lenShift; - } - - int toRead = tmpArrBytes - tmpArrOff; - int remaining = buf.remaining(); - int pos = buf.position(); - - if (remaining < toRead) { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); - - buf.position(pos + remaining); - - tmpArrOff += remaining; - - return creator.create(-1); - } - else { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); - - buf.position(pos + toRead); - - T arr = (T)tmpArr; - - arrHdrDone = false; - tmpArr = null; - tmpArrBytes = 0; - tmpArrOff = 0; - - return arr; - } - } - - /** - * @param i Integer value. - * @return Whether value was written. - */ - public final boolean putIntClient(int i) { - assert buf != null; - - if (buf.remaining() < 4) - return false; - - putByte((byte)(0xFF & (i >>> 24))); - putByte((byte)(0xFF & (i >>> 16))); - putByte((byte)(0xFF & (i >>> 8))); - putByte((byte)(0xFF & i)); - - return true; - } - - /** - * @return Integer value. - */ - public final int getIntClient() { - assert buf != null; - assert buf.remaining() >= 4; - - int val = 0; - - val |= (0xFF & getByte()) << 24; - val |= (0xFF & getByte()) << 16; - val |= (0xFF & getByte()) << 8; - val |= (0xFF & getByte()); - - return val; - } - - /** - * @param val Long value. - * @return Whether value was written. - */ - public final boolean putLongClient(long val) { - assert buf != null; - - if (buf.remaining() < 8) - return false; - - putByte((byte)(val >>> 56)); - putByte((byte)(0xFFL & (val >>> 48))); - putByte((byte)(0xFFL & (val >>> 40))); - putByte((byte)(0xFFL & (val >>> 32))); - putByte((byte)(0xFFL & (val >>> 24))); - putByte((byte)(0xFFL & (val >>> 16))); - putByte((byte)(0xFFL & (val >>> 8))); - putByte((byte) (0xFFL & val)); - - return true; - } - - /** - * @return Long value. - */ - public final long getLongClient() { - assert buf != null; - assert buf.remaining() >= 8; - - long x = 0; - - x |= (0xFFL & getByte()) << 56; - x |= (0xFFL & getByte()) << 48; - x |= (0xFFL & getByte()) << 40; - x |= (0xFFL & getByte()) << 32; - x |= (0xFFL & getByte()) << 24; - x |= (0xFFL & getByte()) << 16; - x |= (0xFFL & getByte()) << 8; - x |= (0xFFL & getByte()); - - return x; - } - - /** - * @param uuid {@link UUID}. - * @return Whether value was fully written. - */ - public final boolean putUuidClient(@Nullable UUID uuid) { - byte[] arr = uuid != null ? U.uuidToBytes(uuid) : EMPTY_UUID_BYTES; - - return putByteArrayClient(arr); - } - - /** - * @param arr Byte array. - * @return Whether array was fully written. - */ - public final boolean putByteArrayClient(byte[] arr) { - assert buf != null; - assert arr != null; - - return putArrayClient(arr, BYTE_ARR_OFF, arr.length, arr.length); - } - - /** - * @param src Buffer. - * @return Whether array was fully written - */ - public boolean putByteBufferClient(ByteBuffer src) { - assert src != null; - assert src.hasArray(); + msg = stream.readMessage(); - return putArrayClient(src.array(), BYTE_ARR_OFF + src.position(), src.remaining(), src.remaining()); - } - - /** - * @param arr Array. - * @param off Offset. - * @param len Length. - * @param bytes Length in bytes. - * @return Whether array was fully written - */ - private boolean putArrayClient(Object arr, long off, int len, int bytes) { - assert off > 0; - assert len >= 0; - assert bytes >= 0; - assert bytes >= arrOff; - assert arr != null; - - if (!buf.hasRemaining()) - return false; - - int pos = buf.position(); - - assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); - - if (!arrHdrDone) - arrHdrDone = true; - - if (!buf.hasRemaining()) - return false; - - int left = bytes - arrOff; - int remaining = buf.remaining(); - - if (left <= remaining) { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, left); - - pos += left; - - buf.position(pos); - - arrHdrDone = false; - arrOff = 0; - } - else { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); - - pos += remaining; - - buf.position(pos); - - arrOff += remaining; - - return false; - } - - return true; - } - - /** - * @param len Array length. - * @return Byte array or special {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_NOT_READ} - * value if it was not fully read. - */ - public final byte[] getByteArrayClient(int len) { - assert buf != null; + if (msg != MSG_NOT_READ) + hdrDone = false; - return getArrayClient(BYTE_ARR_CREATOR, BYTE_ARR_OFF, len); + return msg; } /** - * @return {@link UUID} or special - * {@link GridTcpCommunicationMessageAdapter#UUID_NOT_READ} - * value if it was not fully read. + * @return Whether last array was fully written. */ - public final UUID getUuidClient() { - byte[] arr = getByteArrayClient(16); - - assert arr != null; - - return arr == BYTE_ARR_NOT_READ ? UUID_NOT_READ : U.bytesToUuid(arr, 0); - } - - /** - * @param creator Array creator. - * @param off Base offset. - * @param len Length. - * @return Array or special value if it was not fully read. - */ - private T getArrayClient(ArrayCreator creator, long off, int len) { - assert creator != null; - - if (tmpArr == null) { - tmpArr = creator.create(len); - tmpArrBytes = len; - } - - int toRead = tmpArrBytes - tmpArrOff; - int remaining = buf.remaining(); - int pos = buf.position(); - - if (remaining < toRead) { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); - - buf.position(pos + remaining); + private boolean lastWritten() { + boolean written = stream.lastWritten(); - tmpArrOff += remaining; + if (written) + hdrDone = false; - return creator.create(-1); - } - else { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); - - buf.position(pos + toRead); - - T arr = (T)tmpArr; - - arrHdrDone = false; - tmpArr = null; - tmpArrBytes = 0; - tmpArrOff = 0; - - return arr; - } - } - - /** - * Array creator. - */ - private static interface ArrayCreator { - /** - * @param len Array length or {@code -1} if array was not fully read. - * @return New array. - */ - public T create(int len); - } - - /** - * Dummy enum. - */ - private enum DummyEnum { - /** */ - DUMMY + return written; } } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/ipc/GridIpcToNioAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/ipc/GridIpcToNioAdapter.java index 0222add..3f02666 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/ipc/GridIpcToNioAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/ipc/GridIpcToNioAdapter.java @@ -10,9 +10,9 @@ package org.gridgain.grid.util.ipc; import org.apache.ignite.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.nio.*; +import org.gridgain.grid.util.typedef.internal.*; import java.io.*; import java.nio.*; @@ -45,25 +45,19 @@ public class GridIpcToNioAdapter { /** */ private final GridNioMetricsListener metricsLsnr; - /** */ - private final GridNioMessageWriter msgWriter; - /** * @param metricsLsnr Metrics listener. * @param log Log. * @param endp Endpoint. - * @param msgWriter Message writer. * @param lsnr Listener. * @param filters Filters. */ public GridIpcToNioAdapter(GridNioMetricsListener metricsLsnr, IgniteLogger log, GridIpcEndpoint endp, - GridNioMessageWriter msgWriter, GridNioServerListener lsnr, GridNioFilter... filters) { + GridNioServerListener lsnr, GridNioFilter... filters) { assert metricsLsnr != null; - assert msgWriter != null; this.metricsLsnr = metricsLsnr; this.endp = endp; - this.msgWriter = msgWriter; chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters); ses = new GridNioSessionImpl(chain, null, null, true); @@ -145,10 +139,7 @@ public class GridIpcToNioAdapter { assert writeBuf.hasArray(); try { - // This method is called only on handshake, - // so we don't need to provide node ID for - // rolling updates support. - int cnt = msgWriter.writeFully(null, msg, endp.outputStream(), writeBuf); + int cnt = U.writeMessageFully(msg, endp.outputStream(), writeBuf); metricsLsnr.onBytesSent(cnt); } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java index 2a87162..cacb980 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java @@ -16,7 +16,6 @@ import org.jetbrains.annotations.*; import java.io.*; import java.nio.*; -import java.util.*; /** * Parser for direct messages. @@ -25,9 +24,6 @@ public class GridDirectParser implements GridNioParser { /** Message metadata key. */ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - /** Message reader. */ - private final GridNioMessageReader msgReader; - /** */ private IgniteSpiAdapter spi; @@ -35,11 +31,9 @@ public class GridDirectParser implements GridNioParser { private GridTcpMessageFactory msgFactory; /** - * @param msgReader Message reader. * @param spi Spi. */ - public GridDirectParser(GridNioMessageReader msgReader, IgniteSpiAdapter spi) { - this.msgReader = msgReader; + public GridDirectParser(IgniteSpiAdapter spi) { this.spi = spi; } @@ -49,7 +43,6 @@ public class GridDirectParser implements GridNioParser { msgFactory = spi.getSpiContext().messageFactory(); GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY); - UUID nodeId = ses.meta(GridNioServer.DIFF_VER_NODE_ID_META_KEY); if (msg == null && buf.hasRemaining()) msg = msgFactory.create(buf.get()); @@ -57,7 +50,7 @@ public class GridDirectParser implements GridNioParser { boolean finished = false; if (buf.hasRemaining()) - finished = msgReader.read(nodeId, msg, buf); + finished = msg.readFrom(buf); if (finished) return msg; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageReader.java deleted file mode 100644 index 1d9529e..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageReader.java +++ /dev/null @@ -1,34 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.nio; - -import org.gridgain.grid.util.direct.*; -import org.jetbrains.annotations.*; - -import java.nio.*; -import java.util.*; - -/** - * Message reader. - */ -public interface GridNioMessageReader { - /** - * @param nodeId Node ID. - * @param msg Message to read. - * @param buf Buffer. - * @return Whether message was fully read. - */ - public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf); - - /** - * @return Optional message factory. - */ - @Nullable public GridTcpMessageFactory messageFactory(); -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageWriter.java deleted file mode 100644 index 4271d77..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioMessageWriter.java +++ /dev/null @@ -1,41 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.nio; - -import org.gridgain.grid.util.direct.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.nio.*; -import java.util.*; - -/** - * Message writer. - */ -public interface GridNioMessageWriter { - /** - * @param nodeId Node ID. - * @param msg Message to write. - * @param buf Buffer. - * @return Whether message was fully written. - */ - public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf); - - /** - * @param nodeId Node ID. - * @param msg Message to write. - * @param out Output stream to write to. - * @param buf Buffer. - * @return Number of bytes written. - * @throws IOException In case of error. - */ - public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out, - ByteBuffer buf) throws IOException; -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java index b0279ef..03c3763 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java @@ -59,12 +59,9 @@ public class GridNioServer { /** Buffer metadata key. */ private static final int BUF_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - /** SSL sysmtem data buffer metadata key. */ + /** SSL system data buffer metadata key. */ private static final int BUF_SSL_SYSTEM_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - /** Node ID meta key (set only if versions are different). */ - public static final int DIFF_VER_NODE_ID_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - /** Accept worker thread. */ @GridToStringExclude private final IgniteThread acceptThread; @@ -126,9 +123,6 @@ public class GridNioServer { /** Metrics listener. */ private final GridNioMetricsListener metricsLsnr; - /** Message writer. */ - private final GridNioMessageWriter msgWriter; - /** Sessions. */ private final GridConcurrentHashSet sessions = new GridConcurrentHashSet<>(); @@ -162,7 +156,6 @@ public class GridNioServer { * @param directMode Whether direct mode is used. * @param daemon Daemon flag to create threads. * @param metricsLsnr Metrics listener. - * @param msgWriter Message writer. * @param filters Filters for this server. * @throws IgniteCheckedException If failed. */ @@ -182,7 +175,6 @@ public class GridNioServer { boolean directMode, boolean daemon, GridNioMetricsListener metricsLsnr, - GridNioMessageWriter msgWriter, GridNioFilter... filters ) throws IgniteCheckedException { A.notNull(addr, "addr"); @@ -247,7 +239,6 @@ public class GridNioServer { this.directMode = directMode; this.metricsLsnr = metricsLsnr; - this.msgWriter = msgWriter; } /** @@ -855,7 +846,6 @@ public class GridNioServer { ByteBuffer buf = ses.writeBuffer(); NioOperationFuture req = ses.removeMeta(NIO_OPERATION.ordinal()); - UUID nodeId = ses.meta(DIFF_VER_NODE_ID_META_KEY); List> doneFuts = null; @@ -877,9 +867,8 @@ public class GridNioServer { msg = req.directMessage(); assert msg != null; - assert msgWriter != null; - finished = msgWriter.write(nodeId, msg, buf); + finished = msg.writeTo(buf); } // Fill up as many messages as possible to write buffer. @@ -897,9 +886,8 @@ public class GridNioServer { msg = req.directMessage(); assert msg != null; - assert msgWriter != null; - finished = msgWriter.write(nodeId, msg, buf); + finished = msg.writeTo(buf); } buf.flip(); @@ -995,7 +983,6 @@ public class GridNioServer { GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment(); ByteBuffer buf = ses.writeBuffer(); NioOperationFuture req = ses.removeMeta(NIO_OPERATION.ordinal()); - UUID nodeId = ses.meta(DIFF_VER_NODE_ID_META_KEY); List> doneFuts = null; @@ -1017,9 +1004,8 @@ public class GridNioServer { msg = req.directMessage(); assert msg != null; - assert msgWriter != null; - finished = msgWriter.write(nodeId, msg, buf); + finished = msg.writeTo(buf); } // Fill up as many messages as possible to write buffer. @@ -1037,9 +1023,8 @@ public class GridNioServer { msg = req.directMessage(); assert msg != null; - assert msgWriter != null; - finished = msgWriter.write(nodeId, msg, buf); + finished = msg.writeTo(buf); } buf.flip(); @@ -2053,9 +2038,6 @@ public class GridNioServer { /** Metrics listener. */ private GridNioMetricsListener metricsLsnr; - /** Message writer. */ - private GridNioMessageWriter msgWriter; - /** NIO filters. */ private GridNioFilter[] filters; @@ -2091,7 +2073,6 @@ public class GridNioServer { directMode, daemon, metricsLsnr, - msgWriter, filters != null ? Arrays.copyOf(filters, filters.length) : EMPTY_FILTERS ); @@ -2246,16 +2227,6 @@ public class GridNioServer { } /** - * @param msgWriter Message writer. - * @return This for chaining. - */ - public Builder messageWriter(GridNioMessageWriter msgWriter) { - this.msgWriter = msgWriter; - - return this; - } - - /** * @param filters NIO filters. * @return This for chaining. */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridShmemCommunicationClient.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridShmemCommunicationClient.java index 501e7ee..56bbc94 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridShmemCommunicationClient.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridShmemCommunicationClient.java @@ -10,12 +10,11 @@ package org.gridgain.grid.util.nio; import org.apache.ignite.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.direct.*; -import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.ipc.shmem.*; -import org.jetbrains.annotations.*; import org.gridgain.grid.util.lang.*; +import org.gridgain.grid.util.typedef.internal.*; +import org.jetbrains.annotations.*; import java.io.*; import java.nio.*; @@ -31,31 +30,23 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien /** */ private final ByteBuffer writeBuf; - /** */ - private final GridNioMessageWriter msgWriter; - /** * @param metricsLsnr Metrics listener. * @param port Shared memory IPC server port. * @param connTimeout Connection timeout. * @param log Logger. - * @param msgWriter Message writer. * @throws IgniteCheckedException If failed. */ - public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout, IgniteLogger log, - GridNioMessageWriter msgWriter) - throws IgniteCheckedException { + public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout, + IgniteLogger log) throws IgniteCheckedException { super(metricsLsnr); assert metricsLsnr != null; - assert msgWriter != null; assert port > 0 && port < 0xffff; assert connTimeout >= 0; shmem = new GridIpcSharedMemoryClientEndpoint(port, (int)connTimeout, log); - this.msgWriter = msgWriter; - writeBuf = ByteBuffer.allocate(8 << 10); writeBuf.order(ByteOrder.nativeOrder()); @@ -111,7 +102,7 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien assert writeBuf.hasArray(); try { - int cnt = msgWriter.writeFully(nodeId, msg, shmem.outputStream(), writeBuf); + int cnt = U.writeMessageFully(msg, shmem.outputStream(), writeBuf); metricsLsnr.onBytesSent(cnt); } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridTcpCommunicationClient.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridTcpCommunicationClient.java index 632ce35..379e87e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridTcpCommunicationClient.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridTcpCommunicationClient.java @@ -38,14 +38,10 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient private final double bufSizeRatio; /** */ - private final GridNioMessageWriter msgWriter; - - /** */ private final ByteBuffer writeBuf; /** * @param metricsLsnr Metrics listener. - * @param msgWriter Message writer. * @param addr Address. * @param locHost Local address. * @param connTimeout Connect timeout. @@ -59,7 +55,6 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient */ public GridTcpCommunicationClient( GridNioMetricsListener metricsLsnr, - GridNioMessageWriter msgWriter, InetSocketAddress addr, InetAddress locHost, long connTimeout, @@ -73,7 +68,6 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient super(metricsLsnr); assert metricsLsnr != null; - assert msgWriter != null; assert addr != null; assert locHost != null; assert connTimeout >= 0; @@ -84,7 +78,6 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient A.ensure(bufSizeRatio > 0 && bufSizeRatio < 1, "Value of bufSizeRatio property must be between 0 and 1 (exclusive)."); - this.msgWriter = msgWriter; this.minBufferedMsgCnt = minBufferedMsgCnt; this.bufSizeRatio = bufSizeRatio; @@ -190,7 +183,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient assert writeBuf.hasArray(); try { - int cnt = msgWriter.writeFully(nodeId, msg, out, writeBuf); + int cnt = U.writeMessageFully(msg, out, writeBuf); metricsLsnr.onBytesSent(cnt); } diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index 58cb184..a82aecc 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -111,7 +111,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -119,25 +119,25 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putUuid(srcNodeId)) + if (!commState.putUuid(null, srcNodeId)) return false; commState.idx++; case 1: - if (!commState.putLong(msgId)) + if (!commState.putLong(null, msgId)) return false; commState.idx++; case 2: - if (!commState.putLong(resId)) + if (!commState.putLong(null, resId)) return false; commState.idx++; case 3: - if (!commState.putByteArray(payload)) + if (!commState.putByteArray(null, payload)) return false; commState.idx++; @@ -153,7 +153,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - srcNodeId = commState.getUuid(); + srcNodeId = commState.getUuid(null); if (srcNodeId == UUID_NOT_READ) return false; @@ -164,7 +164,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - msgId = commState.getLong(); + msgId = commState.getLong(null); commState.idx++; @@ -172,12 +172,12 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - resId = commState.getLong(); + resId = commState.getLong(null); commState.idx++; case 3: - payload = commState.getByteArray(); + payload = commState.getByteArray(null); if (payload == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/managers/communication/GridCommunicationSendMessageSelfTest.java index 5c3e2ab..e398d9f 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/managers/communication/GridCommunicationSendMessageSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/managers/communication/GridCommunicationSendMessageSelfTest.java @@ -149,7 +149,7 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest @Override public boolean writeTo(ByteBuffer buf) { commState.setBuffer(buf); - return commState.putByte(directType()); + return commState.putByte(null, directType()); } /** {@inheritDoc} */ -- 1.9.3 (Apple Git-50) From ac71f06cba36cae91275bd677c4dff4df692fa89 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 18 Dec 2014 17:03:01 +0300 Subject: [PATCH 02/71] IGNITE-61 - Portable format in direct marshalling --- .../util/direct/GridPortableByteBufferStream.java | 726 --------------------- .../direct/GridTcpCommunicationMessageAdapter.java | 11 - .../direct/GridTcpCommunicationMessageState.java | 10 +- .../direct/GridTcpCommunicationPortableReader.java | 207 ++++++ .../direct/GridTcpCommunicationPortableStream.java | 726 +++++++++++++++++++++ .../direct/GridTcpCommunicationPortableWriter.java | 223 +++++++ 6 files changed, 1161 insertions(+), 742 deletions(-) delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java deleted file mode 100644 index 4433cbf..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridPortableByteBufferStream.java +++ /dev/null @@ -1,726 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.gridgain.grid.kernal.processors.portable.*; -import org.gridgain.grid.util.*; -import sun.misc.*; -import sun.nio.ch.*; - -import java.nio.*; - -import static org.gridgain.grid.util.direct.GridTcpCommunicationMessageAdapter.*; - -/** - * Portable stream based on {@link ByteBuffer}. - */ -public class GridPortableByteBufferStream implements GridPortableOutputStream, GridPortableInputStream { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** */ - private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); - - /** */ - private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); - - /** */ - private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); - - /** */ - private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); - - /** */ - private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); - - /** */ - private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); - - /** */ - private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); - - /** */ - private static final byte[] BYTE_ARR_EMPTY = new byte[0]; - - /** */ - private static final short[] SHORT_ARR_EMPTY = new short[0]; - - /** */ - private static final int[] INT_ARR_EMPTY = new int[0]; - - /** */ - private static final long[] LONG_ARR_EMPTY = new long[0]; - - /** */ - private static final float[] FLOAT_ARR_EMPTY = new float[0]; - - /** */ - private static final double[] DOUBLE_ARR_EMPTY = new double[0]; - - /** */ - private static final char[] CHAR_ARR_EMPTY = new char[0]; - - /** */ - private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; - - /** */ - private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { - @Override public byte[] create(int len) { - switch (len) { - case -1: - return BYTE_ARR_NOT_READ; - - case 0: - return BYTE_ARR_EMPTY; - - default: - return new byte[len]; - } - } - }; - - /** */ - private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { - @Override public short[] create(int len) { - switch (len) { - case -1: - return SHORT_ARR_NOT_READ; - - case 0: - return SHORT_ARR_EMPTY; - - default: - return new short[len]; - } - } - }; - - /** */ - private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { - @Override public int[] create(int len) { - switch (len) { - case -1: - return INT_ARR_NOT_READ; - - case 0: - return INT_ARR_EMPTY; - - default: - return new int[len]; - } - } - }; - - /** */ - private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { - @Override public long[] create(int len) { - switch (len) { - case -1: - return LONG_ARR_NOT_READ; - - case 0: - return LONG_ARR_EMPTY; - - default: - return new long[len]; - } - } - }; - - /** */ - private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { - @Override public float[] create(int len) { - switch (len) { - case -1: - return FLOAT_ARR_NOT_READ; - - case 0: - return FLOAT_ARR_EMPTY; - - default: - return new float[len]; - } - } - }; - - /** */ - private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { - @Override public double[] create(int len) { - switch (len) { - case -1: - return DOUBLE_ARR_NOT_READ; - - case 0: - return DOUBLE_ARR_EMPTY; - - default: - return new double[len]; - } - } - }; - - /** */ - private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { - @Override public char[] create(int len) { - switch (len) { - case -1: - return CHAR_ARR_NOT_READ; - - case 0: - return CHAR_ARR_EMPTY; - - default: - return new char[len]; - } - } - }; - - /** */ - private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { - @Override public boolean[] create(int len) { - switch (len) { - case -1: - return BOOLEAN_ARR_NOT_READ; - - case 0: - return BOOLEAN_ARR_EMPTY; - - default: - return new boolean[len]; - } - } - }; - - /** */ - private ByteBuffer buf; - - /** */ - private byte[] heapArr; - - /** */ - private long baseOff; - - /** */ - private int arrOff; - - /** */ - private Object tmpArr; - - /** */ - private int tmpArrOff; - - /** */ - private int tmpArrBytes; - - /** */ - private boolean msgTypeDone; - - /** */ - private GridTcpCommunicationMessageAdapter msg; - - /** */ - private boolean lastWritten; - - /** - * @param buf Buffer. - */ - public final void setBuffer(ByteBuffer buf) { - assert buf != null; - - if (this.buf != buf) { - this.buf = buf; - - heapArr = buf.isDirect() ? null : buf.array(); - baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; - } - } - - /** - * @return Whether last object was fully written. - */ - public boolean lastWritten() { - boolean lastWritten0 = lastWritten; - - lastWritten = false; - - return lastWritten0; - } - - /** - * @param msg Message. - */ - public void writeMessage(GridTcpCommunicationMessageAdapter msg) { - assert msg != null; - - lastWritten = msg.writeTo(buf); - } - - /** - * @return Message. - */ - public GridTcpCommunicationMessageAdapter readMessage() { - if (!msgTypeDone) { - if (!buf.hasRemaining()) - return MSG_NOT_READ; - - byte type = readByte(); - - msg = GridTcpCommunicationMessageFactory.create(type); - - msgTypeDone = true; - } - - if (msg.readFrom(buf)) { - GridTcpCommunicationMessageAdapter msg0 = msg; - - msgTypeDone = false; - msg = null; - - return msg0; - } - else - return MSG_NOT_READ; - } - - /** {@inheritDoc} */ - @Override public void writeByte(byte val) { - int pos = buf.position(); - - UNSAFE.putByte(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - @Override public void writeByteArray(byte[] val) { - assert val != null; - - lastWritten = writeArray(val, BYTE_ARR_OFF, val.length); - } - - /** {@inheritDoc} */ - @Override public void writeBoolean(boolean val) { - int pos = buf.position(); - - UNSAFE.putBoolean(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - @Override public void writeBooleanArray(boolean[] val) { - assert val != null; - - lastWritten = writeArray(val, BOOLEAN_ARR_OFF, val.length); - } - - /** {@inheritDoc} */ - @Override public void writeShort(short val) { - int pos = buf.position(); - - UNSAFE.putShort(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - @Override public void writeShortArray(short[] val) { - assert val != null; - - lastWritten = writeArray(val, SHORT_ARR_OFF, val.length << 1); - } - - /** {@inheritDoc} */ - @Override public void writeChar(char val) { - int pos = buf.position(); - - UNSAFE.putChar(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - @Override public void writeCharArray(char[] val) { - assert val != null; - - lastWritten = writeArray(val, CHAR_ARR_OFF, val.length << 1); - } - - /** {@inheritDoc} */ - @Override public void writeInt(int val) { - int pos = buf.position(); - - UNSAFE.putInt(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - @Override public void writeInt(int pos, int val) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeIntArray(int[] val) { - assert val != null; - - lastWritten = writeArray(val, INT_ARR_OFF, val.length << 2); - } - - /** {@inheritDoc} */ - @Override public void writeFloat(float val) { - int pos = buf.position(); - - UNSAFE.putFloat(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - @Override public void writeFloatArray(float[] val) { - assert val != null; - - lastWritten = writeArray(val, FLOAT_ARR_OFF, val.length << 2); - } - - /** {@inheritDoc} */ - @Override public void writeLong(long val) { - int pos = buf.position(); - - UNSAFE.putLong(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - @Override public void writeLongArray(long[] val) { - assert val != null; - - lastWritten = writeArray(val, LONG_ARR_OFF, val.length << 3); - } - - /** {@inheritDoc} */ - @Override public void writeDouble(double val) { - int pos = buf.position(); - - UNSAFE.putDouble(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - @Override public void writeDoubleArray(double[] val) { - assert val != null; - - lastWritten = writeArray(val, DOUBLE_ARR_OFF, val.length << 3); - } - - /** {@inheritDoc} */ - @Override public void write(byte[] arr, int off, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void write(long addr, int cnt) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public byte readByte() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getByte(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public byte[] readByteArray(int cnt) { - return readArray(BYTE_ARR_CREATOR, cnt, 0, BYTE_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public boolean readBoolean() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getBoolean(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public boolean[] readBooleanArray(int cnt) { - return readArray(BOOLEAN_ARR_CREATOR, cnt, 0, BOOLEAN_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public short readShort() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getShort(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public short[] readShortArray(int cnt) { - return readArray(SHORT_ARR_CREATOR, cnt, 1, SHORT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public char readChar() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getChar(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public char[] readCharArray(int cnt) { - return readArray(CHAR_ARR_CREATOR, cnt, 1, CHAR_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public int readInt() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getInt(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public int readInt(int pos) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int[] readIntArray(int cnt) { - return readArray(INT_ARR_CREATOR, cnt, 2, INT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public float readFloat() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getFloat(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public float[] readFloatArray(int cnt) { - return readArray(FLOAT_ARR_CREATOR, cnt, 2, FLOAT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public long readLong() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getLong(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public long[] readLongArray(int cnt) { - return readArray(LONG_ARR_CREATOR, cnt, 3, LONG_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public double readDouble() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getDouble(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public double[] readDoubleArray(int cnt) { - return readArray(DOUBLE_ARR_CREATOR, cnt, 3, DOUBLE_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public int read(byte[] arr, int off, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int read(long addr, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int position() { - return buf.position(); - } - - /** {@inheritDoc} */ - @Override public void position(int pos) { - buf.position(pos); - } - - /** {@inheritDoc} */ - public int remaining() { - return buf.remaining(); - } - - /** {@inheritDoc} */ - @Override public void close() { - // No-op. - } - - /** {@inheritDoc} */ - @Override public byte[] array() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public byte[] arrayCopy() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public long offheapPointer() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public boolean hasArray() { - throw new UnsupportedOperationException(); - } - - /** - * @param arr Array. - * @param off Offset. - * @param bytes Length in bytes. - * @return Whether array was fully written - */ - private boolean writeArray(Object arr, long off, int bytes) { - assert arr != null; - assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); - assert off > 0; - assert bytes >= 0; - assert bytes >= arrOff; - - if (!buf.hasRemaining()) - return false; - - int toWrite = bytes - arrOff; - int pos = buf.position(); - int remaining = buf.remaining(); - - if (toWrite <= remaining) { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); - - pos += toWrite; - - buf.position(pos); - - arrOff = 0; - - return true; - } - else { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); - - pos += remaining; - - buf.position(pos); - - arrOff += remaining; - - return false; - } - } - - /** - * @param creator Array creator. - * @param len Array Array length. - * @param lenShift Array length shift size. - * @param off Base offset. - * @return Array or special value if it was not fully read. - */ - private T readArray(ArrayCreator creator, int len, int lenShift, long off) { - assert creator != null; - - if (tmpArr == null) { - assert len >= 0; - - switch (len) { - case 0: - return creator.create(0); - - default: - tmpArr = creator.create(len); - tmpArrBytes = len << lenShift; - } - } - - int toRead = tmpArrBytes - tmpArrOff; - int remaining = buf.remaining(); - int pos = buf.position(); - - if (remaining < toRead) { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); - - buf.position(pos + remaining); - - tmpArrOff += remaining; - - return creator.create(-1); - } - else { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); - - buf.position(pos + toRead); - - T arr = (T)tmpArr; - - tmpArr = null; - tmpArrBytes = 0; - tmpArrOff = 0; - - return arr; - } - } - - /** - * Array creator. - */ - private static interface ArrayCreator { - /** - * @param len Array length or {@code -1} if array was not fully read. - * @return New array. - */ - public T create(int len); - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java index 8961688..d08caea 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java @@ -85,9 +85,6 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable public static final BitSet BIT_SET_NOT_READ = new BitSet(); /** */ - public static final Enum ENUM_NOT_READ = DummyEnum.DUMMY; - - /** */ public static final GridTcpCommunicationMessageAdapter MSG_NOT_READ = new GridTcpCommunicationMessageAdapter() { @SuppressWarnings("CloneDoesntCallSuperClone") @Override public GridTcpCommunicationMessageAdapter clone() { @@ -176,12 +173,4 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable } }; } - - /** - * Dummy enum. - */ - private enum DummyEnum { - /** */ - DUMMY - } } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index a5df710..ee60070 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -35,16 +35,16 @@ public class GridTcpCommunicationMessageState { private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); /** */ - private static final int FIELD_HDR_LEN = 9; + private static final int FIELD_HDR_LEN = 0; /** */ - private final GridPortableByteBufferStream stream = new GridPortableByteBufferStream(); + private final GridTcpCommunicationPortableStream stream = new GridTcpCommunicationPortableStream(); /** */ - private final PortableWriter writer = null;//new org.gridgain.grid.util.portable.GridPortableWriterImpl(); + private final PortableWriter writer = new GridTcpCommunicationPortableWriter(stream); /** */ - private final PortableReader reader = null;//new org.gridgain.grid.util.portable.GridPortableReaderImpl(); + private final PortableReader reader = new GridTcpCommunicationPortableReader(stream); /** */ private boolean hdrDone; @@ -1012,7 +1012,7 @@ public class GridTcpCommunicationMessageState { */ public final boolean putMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN) + if (stream.remaining() < FIELD_HDR_LEN + 1) return false; writer.writeObject(name, msg); diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java new file mode 100644 index 0000000..d4b6e2d --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java @@ -0,0 +1,207 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.apache.ignite.portables.*; +import org.jetbrains.annotations.*; + +import java.math.*; +import java.sql.*; +import java.util.*; +import java.util.Date; + +/** + * Portable reader implementation. + */ +public class GridTcpCommunicationPortableReader implements PortableReader { + /** Stream. */ + private final GridTcpCommunicationPortableStream stream; + + /** + * @param stream Stream. + */ + public GridTcpCommunicationPortableReader(GridTcpCommunicationPortableStream stream) { + this.stream = stream; + } + + /** {@inheritDoc} */ + @Override public byte readByte(String fieldName) throws PortableException { + return stream.readByte(); + } + + /** {@inheritDoc} */ + @Override public short readShort(String fieldName) throws PortableException { + return stream.readShort(); + } + + /** {@inheritDoc} */ + @Override public int readInt(String fieldName) throws PortableException { + return stream.readInt(); + } + + /** {@inheritDoc} */ + @Override public long readLong(String fieldName) throws PortableException { + return stream.readLong(); + } + + /** {@inheritDoc} */ + @Override public float readFloat(String fieldName) throws PortableException { + return stream.readFloat(); + } + + /** {@inheritDoc} */ + @Override public double readDouble(String fieldName) throws PortableException { + return stream.readDouble(); + } + + /** {@inheritDoc} */ + @Override public char readChar(String fieldName) throws PortableException { + return stream.readChar(); + } + + /** {@inheritDoc} */ + @Override public boolean readBoolean(String fieldName) throws PortableException { + return stream.readBoolean(); + } + + /** {@inheritDoc} */ + @Nullable @Override public byte[] readByteArray(String fieldName) throws PortableException { + return stream.readByteArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public short[] readShortArray(String fieldName) throws PortableException { + return stream.readShortArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public int[] readIntArray(String fieldName) throws PortableException { + return stream.readIntArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public long[] readLongArray(String fieldName) throws PortableException { + return stream.readLongArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public float[] readFloatArray(String fieldName) throws PortableException { + return stream.readFloatArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public double[] readDoubleArray(String fieldName) throws PortableException { + return stream.readDoubleArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public char[] readCharArray(String fieldName) throws PortableException { + return stream.readCharArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public boolean[] readBooleanArray(String fieldName) throws PortableException { + return stream.readBooleanArray(stream.readInt()); + } + + /** {@inheritDoc} */ + @Nullable @Override public T readObject(String fieldName) throws PortableException { + return (T)stream.readMessage(); + } + + /** {@inheritDoc} */ + @Nullable @Override public BigDecimal readDecimal(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public String readString(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public UUID readUuid(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Date readDate(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Timestamp readTimestamp(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public BigDecimal[] readDecimalArray(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public String[] readStringArray(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public UUID[] readUuidArray(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Date[] readDateArray(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Object[] readObjectArray(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Collection readCollection(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Collection readCollection(String fieldName, Class> colCls) + throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Map readMap(String fieldName) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public Map readMap(String fieldName, Class> mapCls) + throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public > T readEnum(String fieldName, Class enumCls) + throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public > T[] readEnumArray(String fieldName, Class enumCls) + throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public PortableRawReader rawReader() { + throw new UnsupportedOperationException(); + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java new file mode 100644 index 0000000..c87837f --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java @@ -0,0 +1,726 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.gridgain.grid.kernal.processors.portable.*; +import org.gridgain.grid.util.*; +import sun.misc.*; +import sun.nio.ch.*; + +import java.nio.*; + +import static org.gridgain.grid.util.direct.GridTcpCommunicationMessageAdapter.*; + +/** + * Portable stream based on {@link ByteBuffer}. + */ +public class GridTcpCommunicationPortableStream implements GridPortableOutputStream, GridPortableInputStream { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** */ + private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); + + /** */ + private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); + + /** */ + private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); + + /** */ + private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); + + /** */ + private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); + + /** */ + private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); + + /** */ + private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); + + /** */ + private static final byte[] BYTE_ARR_EMPTY = new byte[0]; + + /** */ + private static final short[] SHORT_ARR_EMPTY = new short[0]; + + /** */ + private static final int[] INT_ARR_EMPTY = new int[0]; + + /** */ + private static final long[] LONG_ARR_EMPTY = new long[0]; + + /** */ + private static final float[] FLOAT_ARR_EMPTY = new float[0]; + + /** */ + private static final double[] DOUBLE_ARR_EMPTY = new double[0]; + + /** */ + private static final char[] CHAR_ARR_EMPTY = new char[0]; + + /** */ + private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; + + /** */ + private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { + @Override public byte[] create(int len) { + switch (len) { + case -1: + return BYTE_ARR_NOT_READ; + + case 0: + return BYTE_ARR_EMPTY; + + default: + return new byte[len]; + } + } + }; + + /** */ + private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { + @Override public short[] create(int len) { + switch (len) { + case -1: + return SHORT_ARR_NOT_READ; + + case 0: + return SHORT_ARR_EMPTY; + + default: + return new short[len]; + } + } + }; + + /** */ + private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { + @Override public int[] create(int len) { + switch (len) { + case -1: + return INT_ARR_NOT_READ; + + case 0: + return INT_ARR_EMPTY; + + default: + return new int[len]; + } + } + }; + + /** */ + private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { + @Override public long[] create(int len) { + switch (len) { + case -1: + return LONG_ARR_NOT_READ; + + case 0: + return LONG_ARR_EMPTY; + + default: + return new long[len]; + } + } + }; + + /** */ + private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { + @Override public float[] create(int len) { + switch (len) { + case -1: + return FLOAT_ARR_NOT_READ; + + case 0: + return FLOAT_ARR_EMPTY; + + default: + return new float[len]; + } + } + }; + + /** */ + private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { + @Override public double[] create(int len) { + switch (len) { + case -1: + return DOUBLE_ARR_NOT_READ; + + case 0: + return DOUBLE_ARR_EMPTY; + + default: + return new double[len]; + } + } + }; + + /** */ + private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { + @Override public char[] create(int len) { + switch (len) { + case -1: + return CHAR_ARR_NOT_READ; + + case 0: + return CHAR_ARR_EMPTY; + + default: + return new char[len]; + } + } + }; + + /** */ + private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { + @Override public boolean[] create(int len) { + switch (len) { + case -1: + return BOOLEAN_ARR_NOT_READ; + + case 0: + return BOOLEAN_ARR_EMPTY; + + default: + return new boolean[len]; + } + } + }; + + /** */ + private ByteBuffer buf; + + /** */ + private byte[] heapArr; + + /** */ + private long baseOff; + + /** */ + private int arrOff; + + /** */ + private Object tmpArr; + + /** */ + private int tmpArrOff; + + /** */ + private int tmpArrBytes; + + /** */ + private boolean msgTypeDone; + + /** */ + private GridTcpCommunicationMessageAdapter msg; + + /** */ + private boolean lastWritten; + + /** + * @param buf Buffer. + */ + public final void setBuffer(ByteBuffer buf) { + assert buf != null; + + if (this.buf != buf) { + this.buf = buf; + + heapArr = buf.isDirect() ? null : buf.array(); + baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; + } + } + + /** + * @return Whether last object was fully written. + */ + public boolean lastWritten() { + boolean lastWritten0 = lastWritten; + + lastWritten = false; + + return lastWritten0; + } + + /** + * @param msg Message. + */ + public void writeMessage(GridTcpCommunicationMessageAdapter msg) { + assert msg != null; + + lastWritten = msg.writeTo(buf); + } + + /** + * @return Message. + */ + public GridTcpCommunicationMessageAdapter readMessage() { + if (!msgTypeDone) { + assert buf.hasRemaining(); + + byte type = readByte(); + + msg = type == Byte.MIN_VALUE ? null : GridTcpCommunicationMessageFactory.create(type); + + msgTypeDone = true; + } + + if (msg == null || msg.readFrom(buf)) { + GridTcpCommunicationMessageAdapter msg0 = msg; + + msgTypeDone = false; + msg = null; + + return msg0; + } + else + return MSG_NOT_READ; + } + + /** {@inheritDoc} */ + @Override public void writeByte(byte val) { + int pos = buf.position(); + + UNSAFE.putByte(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + @Override public void writeByteArray(byte[] val) { + assert val != null; + + lastWritten = writeArray(val, BYTE_ARR_OFF, val.length); + } + + /** {@inheritDoc} */ + @Override public void writeBoolean(boolean val) { + int pos = buf.position(); + + UNSAFE.putBoolean(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + @Override public void writeBooleanArray(boolean[] val) { + assert val != null; + + lastWritten = writeArray(val, BOOLEAN_ARR_OFF, val.length); + } + + /** {@inheritDoc} */ + @Override public void writeShort(short val) { + int pos = buf.position(); + + UNSAFE.putShort(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + @Override public void writeShortArray(short[] val) { + assert val != null; + + lastWritten = writeArray(val, SHORT_ARR_OFF, val.length << 1); + } + + /** {@inheritDoc} */ + @Override public void writeChar(char val) { + int pos = buf.position(); + + UNSAFE.putChar(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + @Override public void writeCharArray(char[] val) { + assert val != null; + + lastWritten = writeArray(val, CHAR_ARR_OFF, val.length << 1); + } + + /** {@inheritDoc} */ + @Override public void writeInt(int val) { + int pos = buf.position(); + + UNSAFE.putInt(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + @Override public void writeInt(int pos, int val) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeIntArray(int[] val) { + assert val != null; + + lastWritten = writeArray(val, INT_ARR_OFF, val.length << 2); + } + + /** {@inheritDoc} */ + @Override public void writeFloat(float val) { + int pos = buf.position(); + + UNSAFE.putFloat(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + @Override public void writeFloatArray(float[] val) { + assert val != null; + + lastWritten = writeArray(val, FLOAT_ARR_OFF, val.length << 2); + } + + /** {@inheritDoc} */ + @Override public void writeLong(long val) { + int pos = buf.position(); + + UNSAFE.putLong(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + @Override public void writeLongArray(long[] val) { + assert val != null; + + lastWritten = writeArray(val, LONG_ARR_OFF, val.length << 3); + } + + /** {@inheritDoc} */ + @Override public void writeDouble(double val) { + int pos = buf.position(); + + UNSAFE.putDouble(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + @Override public void writeDoubleArray(double[] val) { + assert val != null; + + lastWritten = writeArray(val, DOUBLE_ARR_OFF, val.length << 3); + } + + /** {@inheritDoc} */ + @Override public void write(byte[] arr, int off, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void write(long addr, int cnt) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public byte readByte() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getByte(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public byte[] readByteArray(int cnt) { + return readArray(BYTE_ARR_CREATOR, cnt, 0, BYTE_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public boolean readBoolean() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getBoolean(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public boolean[] readBooleanArray(int cnt) { + return readArray(BOOLEAN_ARR_CREATOR, cnt, 0, BOOLEAN_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public short readShort() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getShort(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public short[] readShortArray(int cnt) { + return readArray(SHORT_ARR_CREATOR, cnt, 1, SHORT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public char readChar() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getChar(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public char[] readCharArray(int cnt) { + return readArray(CHAR_ARR_CREATOR, cnt, 1, CHAR_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public int readInt() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getInt(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public int readInt(int pos) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int[] readIntArray(int cnt) { + return readArray(INT_ARR_CREATOR, cnt, 2, INT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public float readFloat() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getFloat(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public float[] readFloatArray(int cnt) { + return readArray(FLOAT_ARR_CREATOR, cnt, 2, FLOAT_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public long readLong() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getLong(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public long[] readLongArray(int cnt) { + return readArray(LONG_ARR_CREATOR, cnt, 3, LONG_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public double readDouble() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getDouble(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + @Override public double[] readDoubleArray(int cnt) { + return readArray(DOUBLE_ARR_CREATOR, cnt, 3, DOUBLE_ARR_OFF); + } + + /** {@inheritDoc} */ + @Override public int read(byte[] arr, int off, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int read(long addr, int len) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public int position() { + return buf.position(); + } + + /** {@inheritDoc} */ + @Override public void position(int pos) { + buf.position(pos); + } + + /** {@inheritDoc} */ + public int remaining() { + return buf.remaining(); + } + + /** {@inheritDoc} */ + @Override public void close() { + // No-op. + } + + /** {@inheritDoc} */ + @Override public byte[] array() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public byte[] arrayCopy() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public long offheapPointer() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean hasArray() { + throw new UnsupportedOperationException(); + } + + /** + * @param arr Array. + * @param off Offset. + * @param bytes Length in bytes. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int bytes) { + assert arr != null; + assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); + assert off > 0; + assert bytes >= 0; + assert bytes >= arrOff; + + if (!buf.hasRemaining()) + return false; + + int toWrite = bytes - arrOff; + int pos = buf.position(); + int remaining = buf.remaining(); + + if (toWrite <= remaining) { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); + + pos += toWrite; + + buf.position(pos); + + arrOff = 0; + + return true; + } + else { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); + + pos += remaining; + + buf.position(pos); + + arrOff += remaining; + + return false; + } + } + + /** + * @param creator Array creator. + * @param len Array Array length. + * @param lenShift Array length shift size. + * @param off Base offset. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int len, int lenShift, long off) { + assert creator != null; + + if (tmpArr == null) { + switch (len) { + case -1: + return null; + + case 0: + return creator.create(0); + + default: + tmpArr = creator.create(len); + tmpArrBytes = len << lenShift; + } + } + + int toRead = tmpArrBytes - tmpArrOff; + int remaining = buf.remaining(); + int pos = buf.position(); + + if (remaining < toRead) { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); + + buf.position(pos + remaining); + + tmpArrOff += remaining; + + return creator.create(-1); + } + else { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); + + buf.position(pos + toRead); + + T arr = (T)tmpArr; + + tmpArr = null; + tmpArrBytes = 0; + tmpArrOff = 0; + + return arr; + } + } + + /** + * Array creator. + */ + private static interface ArrayCreator { + /** + * @param len Array length or {@code -1} if array was not fully read. + * @return New array. + */ + public T create(int len); + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java new file mode 100644 index 0000000..7f7f971 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java @@ -0,0 +1,223 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.apache.ignite.portables.*; +import org.jetbrains.annotations.*; + +import java.math.*; +import java.sql.*; +import java.util.*; +import java.util.Date; + +/** + * Portable writer implementation. + */ +public class GridTcpCommunicationPortableWriter implements PortableWriter { + /** Stream. */ + private final GridTcpCommunicationPortableStream stream; + + /** + * @param stream Stream. + */ + public GridTcpCommunicationPortableWriter(GridTcpCommunicationPortableStream stream) { + this.stream = stream; + } + + /** {@inheritDoc} */ + @Override public void writeByte(String fieldName, byte val) throws PortableException { + stream.writeByte(val); + } + + /** {@inheritDoc} */ + @Override public void writeShort(String fieldName, short val) throws PortableException { + stream.writeShort(val); + } + + /** {@inheritDoc} */ + @Override public void writeInt(String fieldName, int val) throws PortableException { + stream.writeInt(val); + } + + /** {@inheritDoc} */ + @Override public void writeLong(String fieldName, long val) throws PortableException { + stream.writeLong(val); + } + + /** {@inheritDoc} */ + @Override public void writeFloat(String fieldName, float val) throws PortableException { + stream.writeFloat(val); + } + + /** {@inheritDoc} */ + @Override public void writeDouble(String fieldName, double val) throws PortableException { + stream.writeDouble(val); + } + + /** {@inheritDoc} */ + @Override public void writeChar(String fieldName, char val) throws PortableException { + stream.writeChar(val); + } + + /** {@inheritDoc} */ + @Override public void writeBoolean(String fieldName, boolean val) throws PortableException { + stream.writeBoolean(val); + } + + /** {@inheritDoc} */ + @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeByteArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeShortArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeIntArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeLongArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeFloatArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeDoubleArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeCharArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException { + stream.writeInt(val != null ? val.length : -1); + + if (val != null) + stream.writeBooleanArray(val); + } + + /** {@inheritDoc} */ + @Override public void writeObject(String fieldName, @Nullable Object obj) throws PortableException { + if (obj != null) { + assert obj instanceof GridTcpCommunicationMessageAdapter; + + stream.writeMessage((GridTcpCommunicationMessageAdapter)obj); + } + else + stream.writeByte(Byte.MIN_VALUE); + } + + /** {@inheritDoc} */ + @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeString(String fieldName, @Nullable String val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeDate(String fieldName, @Nullable Date val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeCollection(String fieldName, @Nullable Collection col) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void writeMap(String fieldName, @Nullable Map map) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public > void writeEnum(String fieldName, T val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public > void writeEnumArray(String fieldName, T[] val) throws PortableException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public PortableRawWriter rawWriter() { + throw new UnsupportedOperationException(); + } +} -- 1.9.3 (Apple Git-50) From 5ed5176eff3df499014e7084c5bb3f46aa319c6c Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 18 Dec 2014 17:12:26 +0300 Subject: [PATCH 03/71] IGNITE-61 - Portable format in direct marshalling --- .../spi/collision/jobstealing/JobStealingRequest.java | 2 +- .../grid/util/direct/GridTcpCommunicationMessageState.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 6e43563..1b3a91e 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -69,7 +69,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!commState.writeType(directType())) return false; commState.typeWritten = true; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index ee60070..5a3e74d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -78,6 +78,19 @@ public class GridTcpCommunicationMessageState { } /** + * @param type Message type. + * @return Whether message type was written. + */ + public final boolean writeType(byte type) { + if (stream.remaining() == 0) + return false; + + stream.writeByte(type); + + return true; + } + + /** * @param name Field name. * @param b Byte value. * @return Whether value was written. -- 1.9.3 (Apple Git-50) From 1767ba5e69648c3e5d471a73b66b0bf172f28a6f Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 19 Dec 2014 14:56:59 +0300 Subject: [PATCH 04/71] IGNITE-61 - Portable format in direct marshalling --- .../collision/jobstealing/JobStealingRequest.java | 2 +- .../direct/GridTcpCommunicationMessageState.java | 30 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 1b3a91e..73450e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -69,7 +69,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.writeType(directType())) + if (!commState.writeByte(directType())) return false; commState.typeWritten = true; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index 5a3e74d..1357627 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -78,19 +78,39 @@ public class GridTcpCommunicationMessageState { } /** - * @param type Message type. - * @return Whether message type was written. + * @param val Byte value. + * @return Whether value was written. + */ + public final boolean writeByte(byte val) { + if (stream.remaining() < 1) + return false; + + stream.writeByte(val); + + return true; + } + + /** + * @param val Int value. + * @return Whether value was written. */ - public final boolean writeType(byte type) { - if (stream.remaining() == 0) + public final boolean writeInt(int val) { + if (stream.remaining() < 4) return false; - stream.writeByte(type); + stream.writeInt(val); return true; } /** + * @return Int value. + */ + public final int readInt() { + return stream.readInt(); + } + + /** * @param name Field name. * @param b Byte value. * @return Whether value was written. -- 1.9.3 (Apple Git-50) From eb7eb8d0ff8385502784ea43b08ac9dcf21046c3 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 19 Dec 2014 16:38:44 +0300 Subject: [PATCH 05/71] IGNITE-61 - Portable format in direct marshalling --- .../direct/GridTcpCommunicationMessageState.java | 33 ---------------------- 1 file changed, 33 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index 1357627..ee60070 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -78,39 +78,6 @@ public class GridTcpCommunicationMessageState { } /** - * @param val Byte value. - * @return Whether value was written. - */ - public final boolean writeByte(byte val) { - if (stream.remaining() < 1) - return false; - - stream.writeByte(val); - - return true; - } - - /** - * @param val Int value. - * @return Whether value was written. - */ - public final boolean writeInt(int val) { - if (stream.remaining() < 4) - return false; - - stream.writeInt(val); - - return true; - } - - /** - * @return Int value. - */ - public final int readInt() { - return stream.readInt(); - } - - /** * @param name Field name. * @param b Byte value. * @return Whether value was written. -- 1.9.3 (Apple Git-50) From 4abbc39c04c66ff6ad88035ba787b9e496d28275 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 19 Dec 2014 17:27:46 +0300 Subject: [PATCH 06/71] IGNITE-61 - Portable format in direct marshalling --- .../collision/jobstealing/JobStealingRequest.java | 8 ++--- .../direct/GridTcpCommunicationMessageAdapter.java | 3 ++ .../direct/GridTcpCommunicationMessageState.java | 38 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 73450e0..0c4e968 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -69,10 +69,10 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.writeByte(directType())) - return false; - - commState.typeWritten = true; +// if (!commState.writeByte(directType())) +// return false; +// +// commState.typeWritten = true; } switch (commState.idx) { diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java index d08caea..7f5d97c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java @@ -56,6 +56,9 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable public static final UUID UUID_NOT_READ = new UUID(0, 0); /** */ + public static final ByteBuffer BYTE_BUF_NOT_READ = ByteBuffer.allocate(0); + + /** */ public static final IgniteUuid GRID_UUID_NOT_READ = new IgniteUuid(new UUID(0, 0), 0); /** */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index ee60070..c2d8b14 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -623,6 +623,44 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. + * @param buf Buffer. + * @return Whether value was fully written. + */ + public final boolean putByteBuffer(String name, @Nullable ByteBuffer buf) { + byte[] arr = null; + + if (buf != null) { + ByteBuffer buf0 = buf.duplicate(); + + buf0.flip(); + + arr = new byte[buf0.remaining()]; + + buf0.get(arr); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link ByteBuffer} or special + * {@link GridTcpCommunicationMessageAdapter#BYTE_BUF_NOT_READ} + * value if it was not fully read. + */ + public final ByteBuffer getByteBuffer(String name) { + byte[] arr = getByteArray(name); + + if (arr == BYTE_ARR_NOT_READ) + return BYTE_BUF_NOT_READ; + else if (arr == null) + return null; + else + return ByteBuffer.wrap(arr); + } + + /** + * @param name Field name. * @param uuid {@link UUID}. * @return Whether value was fully written. */ -- 1.9.3 (Apple Git-50) From d0ecc3fd21cd2ac07595c78140932f6044ad7d0d Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 19 Dec 2014 19:16:51 +0300 Subject: [PATCH 07/71] IGNITE-61 - Portable format in direct marshalling --- .../gridgain/grid/util/direct/GridTcpCommunicationMessageState.java | 2 +- .../grid/util/direct/GridTcpCommunicationPortableStream.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index c2d8b14..0a3f856 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -74,7 +74,7 @@ public class GridTcpCommunicationMessageState { * @param buf Buffer. */ public final void setBuffer(ByteBuffer buf) { - assert buf != null; + stream.setBuffer(buf); } /** diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java index c87837f..3ec27df 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java @@ -249,11 +249,7 @@ public class GridTcpCommunicationPortableStream implements GridPortableOutputStr * @return Whether last object was fully written. */ public boolean lastWritten() { - boolean lastWritten0 = lastWritten; - - lastWritten = false; - - return lastWritten0; + return lastWritten; } /** -- 1.9.3 (Apple Git-50) From f5b3f26e4ff9f8dbcbd1089aa9ddd309e462edc6 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 22 Dec 2014 14:39:29 -0800 Subject: [PATCH 08/71] IGNITE-61 - Portable format in direct marshalling --- .../collision/jobstealing/JobStealingRequest.java | 12 +-- .../gridgain/grid/kernal/GridJobCancelRequest.java | 12 +-- .../grid/kernal/GridJobExecuteRequest.java | 80 +++++++++---------- .../grid/kernal/GridJobExecuteRequestV2.java | 4 +- .../grid/kernal/GridJobExecuteResponse.java | 28 +++---- .../grid/kernal/GridJobSiblingsRequest.java | 8 +- .../grid/kernal/GridJobSiblingsResponse.java | 4 +- .../grid/kernal/GridTaskCancelRequest.java | 4 +- .../grid/kernal/GridTaskSessionRequest.java | 12 +-- .../managers/checkpoint/GridCheckpointRequest.java | 12 +-- .../managers/communication/GridIoMessage.java | 28 +++---- .../managers/communication/GridIoUserMessage.java | 26 +++---- .../deployment/GridDeploymentInfoBean.java | 18 ++--- .../managers/deployment/GridDeploymentRequest.java | 16 ++-- .../deployment/GridDeploymentResponse.java | 12 +-- .../eventstorage/GridEventStorageMessage.java | 34 ++++---- .../processors/cache/GridCacheEvictionRequest.java | 12 +-- .../cache/GridCacheEvictionResponse.java | 8 +- .../kernal/processors/cache/GridCacheMessage.java | 12 +-- .../GridCacheOptimisticCheckPreparedTxRequest.java | 16 ++-- ...GridCacheOptimisticCheckPreparedTxResponse.java | 12 +-- ...ridCachePessimisticCheckCommittedTxRequest.java | 24 +++--- ...idCachePessimisticCheckCommittedTxResponse.java | 12 +-- .../distributed/GridDistributedBaseMessage.java | 12 +-- .../distributed/GridDistributedLockRequest.java | 56 +++++++------- .../distributed/GridDistributedLockResponse.java | 8 +- .../GridDistributedTxFinishRequest.java | 90 +++++++++++----------- .../GridDistributedTxFinishResponse.java | 8 +- .../GridDistributedTxPrepareRequest.java | 44 +++++------ .../GridDistributedTxPrepareResponse.java | 8 +- .../dht/GridDhtAffinityAssignmentRequest.java | 4 +- .../dht/GridDhtAffinityAssignmentResponse.java | 8 +- .../cache/distributed/dht/GridDhtLockRequest.java | 28 +++---- .../cache/distributed/dht/GridDhtLockResponse.java | 4 +- .../distributed/dht/GridDhtTxFinishRequest.java | 36 ++++----- .../distributed/dht/GridDhtTxFinishResponse.java | 4 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 44 +++++------ .../distributed/dht/GridDhtTxPrepareResponse.java | 8 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 44 +++++------ .../dht/atomic/GridDhtAtomicUpdateResponse.java | 12 +-- .../dht/atomic/GridNearAtomicUpdateRequest.java | 56 +++++++------- .../dht/atomic/GridNearAtomicUpdateResponse.java | 28 +++---- .../dht/preloader/GridDhtForceKeysRequest.java | 12 +-- .../dht/preloader/GridDhtForceKeysResponse.java | 12 +-- .../preloader/GridDhtPartitionDemandMessage.java | 20 ++--- .../preloader/GridDhtPartitionSupplyMessage.java | 16 ++-- .../GridDhtPartitionsAbstractMessage.java | 8 +- .../preloader/GridDhtPartitionsFullMessage.java | 12 +-- .../preloader/GridDhtPartitionsSingleMessage.java | 4 +- .../cache/distributed/near/GridNearGetRequest.java | 28 +++---- .../distributed/near/GridNearGetResponse.java | 24 +++--- .../distributed/near/GridNearLockRequest.java | 32 ++++---- .../distributed/near/GridNearLockResponse.java | 8 +- .../distributed/near/GridNearTxFinishRequest.java | 20 ++--- .../distributed/near/GridNearTxFinishResponse.java | 12 +-- .../distributed/near/GridNearTxPrepareRequest.java | 29 +++---- .../near/GridNearTxPrepareResponse.java | 12 +-- .../cache/query/GridCacheQueryRequest.java | 76 +++++++++--------- .../cache/query/GridCacheQueryResponse.java | 16 ++-- .../clock/GridClockDeltaSnapshotMessage.java | 6 +- .../continuous/GridContinuousMessage.java | 18 ++--- .../processors/dataload/GridDataLoadRequest.java | 46 +++++------ .../processors/dataload/GridDataLoadResponse.java | 12 +-- .../kernal/processors/ggfs/GridGgfsAckMessage.java | 12 +-- .../kernal/processors/ggfs/GridGgfsBlockKey.java | 16 ++-- .../processors/ggfs/GridGgfsBlocksMessage.java | 10 +-- .../processors/ggfs/GridGgfsDeleteMessage.java | 8 +- .../processors/ggfs/GridGgfsFileAffinityRange.java | 20 ++--- .../ggfs/GridGgfsFragmentizerRequest.java | 4 +- .../ggfs/GridGgfsFragmentizerResponse.java | 4 +- .../processors/ggfs/GridGgfsSyncMessage.java | 8 +- .../message/GridClientHandshakeRequestWrapper.java | 14 ++-- .../GridClientHandshakeResponseWrapper.java | 20 +++++ .../client/message/GridClientMessageWrapper.java | 56 +++++++------- .../message/GridClientPingPacketWrapper.java | 17 +++- .../rest/handlers/task/GridTaskResultRequest.java | 8 +- .../rest/handlers/task/GridTaskResultResponse.java | 16 ++-- .../protocols/tcp/GridMemcachedMessageWrapper.java | 19 ++++- .../streamer/GridStreamerCancelRequest.java | 4 +- .../streamer/GridStreamerExecutionRequest.java | 26 +++---- .../processors/streamer/GridStreamerResponse.java | 8 +- .../direct/GridTcpCommunicationMessageState.java | 27 +++++++ 82 files changed, 852 insertions(+), 776 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 0c4e968..a6c3346 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -69,15 +69,15 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { commState.setBuffer(buf); if (!commState.typeWritten) { -// if (!commState.writeByte(directType())) -// return false; -// -// commState.typeWritten = true; + if (!commState.putByte(null, directType())) + return false; + + commState.typeWritten = true; } switch (commState.idx) { case 0: - if (!commState.putInt(null, delta)) + if (!commState.putInt("delta", delta)) return false; commState.idx++; @@ -97,7 +97,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - delta = commState.getInt(null); + delta = commState.getInt("delta"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java index 1c0e1a4..00fc2e5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java @@ -134,19 +134,19 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, jobId)) + if (!commState.putGridUuid("jobId", jobId)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; case 2: - if (!commState.putBoolean(null, sys)) + if (!commState.putBoolean("sys", sys)) return false; commState.idx++; @@ -163,7 +163,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid jobId0 = commState.getGridUuid(null); + IgniteUuid jobId0 = commState.getGridUuid("jobId"); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -173,7 +173,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -186,7 +186,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - sys = commState.getBoolean(null); + sys = commState.getBoolean("sys"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java index 2e3eba7..c7e3bcc 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java @@ -432,8 +432,8 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im _clone.cpSpi = cpSpi; _clone.siblings = siblings; _clone.siblingsBytes = siblingsBytes; - _clone.createTime = createTime; _clone.createTime0 = createTime0; + _clone.createTime = createTime; _clone.clsLdrId = clsLdrId; _clone.depMode = depMode; _clone.dynamicSiblings = dynamicSiblings; @@ -457,61 +457,61 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putString(null, cpSpi)) + if (!commState.putString("cpSpi", cpSpi)) return false; commState.idx++; case 2: - if (!commState.putLong(null, createTime)) + if (!commState.putLong("createTime", createTime)) return false; commState.idx++; case 3: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; case 4: - if (!commState.putBoolean(null, dynamicSiblings)) + if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) return false; commState.idx++; case 5: - if (!commState.putBoolean(null, forceLocDep)) + if (!commState.putBoolean("forceLocDep", forceLocDep)) return false; commState.idx++; case 6: - if (!commState.putBoolean(null, internal)) + if (!commState.putBoolean("internal", internal)) return false; commState.idx++; case 7: - if (!commState.putByteArray(null, jobAttrsBytes)) + if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) return false; commState.idx++; case 8: - if (!commState.putByteArray(null, jobBytes)) + if (!commState.putByteArray("jobBytes", jobBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, jobId)) + if (!commState.putGridUuid("jobId", jobId)) return false; commState.idx++; @@ -555,49 +555,49 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 11: - if (!commState.putByteArray(null, sesAttrsBytes)) + if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) return false; commState.idx++; case 12: - if (!commState.putBoolean(null, sesFullSup)) + if (!commState.putBoolean("sesFullSup", sesFullSup)) return false; commState.idx++; case 13: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; case 14: - if (!commState.putByteArray(null, siblingsBytes)) + if (!commState.putByteArray("siblingsBytes", siblingsBytes)) return false; commState.idx++; case 15: - if (!commState.putLong(null, startTaskTime)) + if (!commState.putLong("startTaskTime", startTaskTime)) return false; commState.idx++; case 16: - if (!commState.putString(null, taskClsName)) + if (!commState.putString("taskClsName", taskClsName)) return false; commState.idx++; case 17: - if (!commState.putString(null, taskName)) + if (!commState.putString("taskName", taskName)) return false; commState.idx++; case 18: - if (!commState.putLong(null, timeout)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; @@ -630,7 +630,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 20: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -647,7 +647,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -657,7 +657,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 1: - String cpSpi0 = commState.getString(null); + String cpSpi0 = commState.getString("cpSpi"); if (cpSpi0 == STR_NOT_READ) return false; @@ -670,7 +670,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - createTime = commState.getLong(null); + createTime = commState.getLong("createTime"); commState.idx++; @@ -678,7 +678,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -688,7 +688,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - dynamicSiblings = commState.getBoolean(null); + dynamicSiblings = commState.getBoolean("dynamicSiblings"); commState.idx++; @@ -696,7 +696,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(null); + forceLocDep = commState.getBoolean("forceLocDep"); commState.idx++; @@ -704,12 +704,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - internal = commState.getBoolean(null); + internal = commState.getBoolean("internal"); commState.idx++; case 7: - byte[] jobAttrsBytes0 = commState.getByteArray(null); + byte[] jobAttrsBytes0 = commState.getByteArray("jobAttrsBytes"); if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -719,7 +719,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 8: - byte[] jobBytes0 = commState.getByteArray(null); + byte[] jobBytes0 = commState.getByteArray("jobBytes"); if (jobBytes0 == BYTE_ARR_NOT_READ) return false; @@ -729,7 +729,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 9: - IgniteUuid jobId0 = commState.getGridUuid(null); + IgniteUuid jobId0 = commState.getGridUuid("jobId"); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -748,7 +748,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (commState.readSize >= 0) { if (ldrParticipants == null) - ldrParticipants = U.newHashMap(commState.readSize); + ldrParticipants = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -781,7 +781,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 11: - byte[] sesAttrsBytes0 = commState.getByteArray(null); + byte[] sesAttrsBytes0 = commState.getByteArray("sesAttrsBytes"); if (sesAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -794,12 +794,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 1) return false; - sesFullSup = commState.getBoolean(null); + sesFullSup = commState.getBoolean("sesFullSup"); commState.idx++; case 13: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -809,7 +809,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 14: - byte[] siblingsBytes0 = commState.getByteArray(null); + byte[] siblingsBytes0 = commState.getByteArray("siblingsBytes"); if (siblingsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -822,12 +822,12 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - startTaskTime = commState.getLong(null); + startTaskTime = commState.getLong("startTaskTime"); commState.idx++; case 16: - String taskClsName0 = commState.getString(null); + String taskClsName0 = commState.getString("taskClsName"); if (taskClsName0 == STR_NOT_READ) return false; @@ -837,7 +837,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 17: - String taskName0 = commState.getString(null); + String taskName0 = commState.getString("taskName"); if (taskName0 == STR_NOT_READ) return false; @@ -850,7 +850,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (buf.remaining() < 8) return false; - timeout = commState.getLong(null); + timeout = commState.getLong("timeout"); commState.idx++; @@ -884,7 +884,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 20: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java index cf70842..9e3e583 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java @@ -137,7 +137,7 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { switch (commState.idx) { case 21: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; @@ -156,7 +156,7 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { switch (commState.idx) { case 21: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java index 88e7483..2ef82d8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java @@ -229,43 +229,43 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putByteArray(null, gridExBytes)) + if (!commState.putByteArray("gridExBytes", gridExBytes)) return false; commState.idx++; case 1: - if (!commState.putBoolean(null, isCancelled)) + if (!commState.putBoolean("isCancelled", isCancelled)) return false; commState.idx++; case 2: - if (!commState.putByteArray(null, jobAttrsBytes)) + if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) return false; commState.idx++; case 3: - if (!commState.putGridUuid(null, jobId)) + if (!commState.putGridUuid("jobId", jobId)) return false; commState.idx++; case 4: - if (!commState.putUuid(null, nodeId)) + if (!commState.putUuid("nodeId", nodeId)) return false; commState.idx++; case 5: - if (!commState.putByteArray(null, resBytes)) + if (!commState.putByteArray("resBytes", resBytes)) return false; commState.idx++; case 6: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; @@ -282,7 +282,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] gridExBytes0 = commState.getByteArray(null); + byte[] gridExBytes0 = commState.getByteArray("gridExBytes"); if (gridExBytes0 == BYTE_ARR_NOT_READ) return false; @@ -295,12 +295,12 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - isCancelled = commState.getBoolean(null); + isCancelled = commState.getBoolean("isCancelled"); commState.idx++; case 2: - byte[] jobAttrsBytes0 = commState.getByteArray(null); + byte[] jobAttrsBytes0 = commState.getByteArray("jobAttrsBytes"); if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -310,7 +310,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 3: - IgniteUuid jobId0 = commState.getGridUuid(null); + IgniteUuid jobId0 = commState.getGridUuid("jobId"); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -320,7 +320,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - UUID nodeId0 = commState.getUuid(null); + UUID nodeId0 = commState.getUuid("nodeId"); if (nodeId0 == UUID_NOT_READ) return false; @@ -330,7 +330,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 5: - byte[] resBytes0 = commState.getByteArray(null); + byte[] resBytes0 = commState.getByteArray("resBytes"); if (resBytes0 == BYTE_ARR_NOT_READ) return false; @@ -340,7 +340,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i commState.idx++; case 6: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java index a852d23..31bf8e0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java @@ -108,13 +108,13 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; case 1: - if (!commState.putByteArray(null, topicBytes)) + if (!commState.putByteArray("topicBytes", topicBytes)) return false; commState.idx++; @@ -131,7 +131,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; @@ -141,7 +141,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray(null); + byte[] topicBytes0 = commState.getByteArray("topicBytes"); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java index 55e17f5..81821b1 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java @@ -100,7 +100,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putByteArray(null, siblingsBytes)) + if (!commState.putByteArray("siblingsBytes", siblingsBytes)) return false; commState.idx++; @@ -117,7 +117,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - byte[] siblingsBytes0 = commState.getByteArray(null); + byte[] siblingsBytes0 = commState.getByteArray("siblingsBytes"); if (siblingsBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java index 15ae1ad..d1ae101 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java @@ -83,7 +83,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; @@ -100,7 +100,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java index 86457da..8c9c63e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java @@ -123,19 +123,19 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putByteArray(null, attrsBytes)) + if (!commState.putByteArray("attrsBytes", attrsBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, jobId)) + if (!commState.putGridUuid("jobId", jobId)) return false; commState.idx++; case 2: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; @@ -152,7 +152,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] attrsBytes0 = commState.getByteArray(null); + byte[] attrsBytes0 = commState.getByteArray("attrsBytes"); if (attrsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -162,7 +162,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i commState.idx++; case 1: - IgniteUuid jobId0 = commState.getGridUuid(null); + IgniteUuid jobId0 = commState.getGridUuid("jobId"); if (jobId0 == GRID_UUID_NOT_READ) return false; @@ -172,7 +172,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java index c7ca93c..8932cc3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java @@ -108,19 +108,19 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putString(null, cpSpi)) + if (!commState.putString("cpSpi", cpSpi)) return false; commState.idx++; case 1: - if (!commState.putString(null, key)) + if (!commState.putString("key", key)) return false; commState.idx++; case 2: - if (!commState.putGridUuid(null, sesId)) + if (!commState.putGridUuid("sesId", sesId)) return false; commState.idx++; @@ -137,7 +137,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String cpSpi0 = commState.getString(null); + String cpSpi0 = commState.getString("cpSpi"); if (cpSpi0 == STR_NOT_READ) return false; @@ -147,7 +147,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - String key0 = commState.getString(null); + String key0 = commState.getString("key"); if (key0 == STR_NOT_READ) return false; @@ -157,7 +157,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid(null); + IgniteUuid sesId0 = commState.getGridUuid("sesId"); if (sesId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java index d9c11a5..098f52a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java @@ -222,43 +222,43 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putMessage(null, msg)) + if (!commState.putMessage("msg", msg)) return false; commState.idx++; case 1: - if (!commState.putLong(null, msgId)) + if (!commState.putLong("msgId", msgId)) return false; commState.idx++; case 2: - if (!commState.putEnum(null, plc)) + if (!commState.putEnum("plc", plc)) return false; commState.idx++; case 3: - if (!commState.putBoolean(null, skipOnTimeout)) + if (!commState.putBoolean("skipOnTimeout", skipOnTimeout)) return false; commState.idx++; case 4: - if (!commState.putLong(null, timeout)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; case 5: - if (!commState.putByteArray(null, topicBytes)) + if (!commState.putByteArray("topicBytes", topicBytes)) return false; commState.idx++; case 6: - if (!commState.putInt(null, topicOrd)) + if (!commState.putInt("topicOrd", topicOrd)) return false; commState.idx++; @@ -275,7 +275,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - Object msg0 = commState.getMessage(null); + Object msg0 = commState.getMessage("msg"); if (msg0 == MSG_NOT_READ) return false; @@ -288,7 +288,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - msgId = commState.getLong(null); + msgId = commState.getLong("msgId"); commState.idx++; @@ -296,7 +296,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte plc0 = commState.getByte(null); + byte plc0 = commState.getByte("plc"); plc = GridIoPolicy.fromOrdinal(plc0); @@ -306,7 +306,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - skipOnTimeout = commState.getBoolean(null); + skipOnTimeout = commState.getBoolean("skipOnTimeout"); commState.idx++; @@ -314,12 +314,12 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - timeout = commState.getLong(null); + timeout = commState.getLong("timeout"); commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray(null); + byte[] topicBytes0 = commState.getByteArray("topicBytes"); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -332,7 +332,7 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 4) return false; - topicOrd = commState.getInt(null); + topicOrd = commState.getInt("topicOrd"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java index 2859016..3c5c459 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java @@ -234,25 +234,25 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, bodyBytes)) + if (!commState.putByteArray("bodyBytes", bodyBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putString(null, depClsName)) + if (!commState.putString("depClsName", depClsName)) return false; commState.idx++; case 3: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; @@ -296,13 +296,13 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 5: - if (!commState.putByteArray(null, topicBytes)) + if (!commState.putByteArray("topicBytes", topicBytes)) return false; commState.idx++; case 6: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -319,7 +319,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] bodyBytes0 = commState.getByteArray(null); + byte[] bodyBytes0 = commState.getByteArray("bodyBytes"); if (bodyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -329,7 +329,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -339,7 +339,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 2: - String depClsName0 = commState.getString(null); + String depClsName0 = commState.getString("depClsName"); if (depClsName0 == STR_NOT_READ) return false; @@ -352,7 +352,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -368,7 +368,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { if (commState.readSize >= 0) { if (ldrParties == null) - ldrParties = U.newHashMap(commState.readSize); + ldrParties = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -401,7 +401,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray(null); + byte[] topicBytes0 = commState.getByteArray("topicBytes"); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -411,7 +411,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 6: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java index c294a8c..f9d1d85 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java @@ -164,19 +164,19 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; case 2: - if (!commState.putBoolean(null, locDepOwner)) + if (!commState.putBoolean("locDepOwner", locDepOwner)) return false; commState.idx++; @@ -220,7 +220,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -237,7 +237,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -250,7 +250,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -260,7 +260,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (buf.remaining() < 1) return false; - locDepOwner = commState.getBoolean(null); + locDepOwner = commState.getBoolean("locDepOwner"); commState.idx++; @@ -274,7 +274,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (commState.readSize >= 0) { if (participants == null) - participants = U.newHashMap(commState.readSize); + participants = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -307,7 +307,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java index ffcd805..3dcc483 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java @@ -183,13 +183,13 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putBoolean(null, isUndeploy)) + if (!commState.putBoolean("isUndeploy", isUndeploy)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, ldrId)) + if (!commState.putGridUuid("ldrId", ldrId)) return false; commState.idx++; @@ -222,13 +222,13 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 3: - if (!commState.putByteArray(null, resTopicBytes)) + if (!commState.putByteArray("resTopicBytes", resTopicBytes)) return false; commState.idx++; case 4: - if (!commState.putString(null, rsrcName)) + if (!commState.putString("rsrcName", rsrcName)) return false; commState.idx++; @@ -248,12 +248,12 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - isUndeploy = commState.getBoolean(null); + isUndeploy = commState.getBoolean("isUndeploy"); commState.idx++; case 1: - IgniteUuid ldrId0 = commState.getGridUuid(null); + IgniteUuid ldrId0 = commState.getGridUuid("ldrId"); if (ldrId0 == GRID_UUID_NOT_READ) return false; @@ -292,7 +292,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 3: - byte[] resTopicBytes0 = commState.getByteArray(null); + byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -302,7 +302,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 4: - String rsrcName0 = commState.getString(null); + String rsrcName0 = commState.getString("rsrcName"); if (rsrcName0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java index 3d8e7ac..bf0a4b6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java @@ -131,19 +131,19 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArrayList(null, byteSrc)) + if (!commState.putByteArrayList("byteSrc", byteSrc)) return false; commState.idx++; case 1: - if (!commState.putString(null, errMsg)) + if (!commState.putString("errMsg", errMsg)) return false; commState.idx++; case 2: - if (!commState.putBoolean(null, success)) + if (!commState.putBoolean("success", success)) return false; commState.idx++; @@ -160,7 +160,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - GridByteArrayList byteSrc0 = commState.getByteArrayList(null); + GridByteArrayList byteSrc0 = commState.getByteArrayList("byteSrc"); if (byteSrc0 == BYTE_ARR_LIST_NOT_READ) return false; @@ -170,7 +170,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - String errMsg0 = commState.getString(null); + String errMsg0 = commState.getString("errMsg"); if (errMsg0 == STR_NOT_READ) return false; @@ -183,7 +183,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - success = commState.getBoolean(null); + success = commState.getBoolean("success"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java index f80707a..4b5543c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java @@ -294,37 +294,37 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 1: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; case 2: - if (!commState.putByteArray(null, evtsBytes)) + if (!commState.putByteArray("evtsBytes", evtsBytes)) return false; commState.idx++; case 3: - if (!commState.putByteArray(null, exBytes)) + if (!commState.putByteArray("exBytes", exBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, filter)) + if (!commState.putByteArray("filter", filter)) return false; commState.idx++; case 5: - if (!commState.putString(null, filterClsName)) + if (!commState.putString("filterClsName", filterClsName)) return false; commState.idx++; @@ -368,13 +368,13 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 7: - if (!commState.putByteArray(null, resTopicBytes)) + if (!commState.putByteArray("resTopicBytes", resTopicBytes)) return false; commState.idx++; case 8: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -391,7 +391,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -404,14 +404,14 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 2: - byte[] evtsBytes0 = commState.getByteArray(null); + byte[] evtsBytes0 = commState.getByteArray("evtsBytes"); if (evtsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -421,7 +421,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 3: - byte[] exBytes0 = commState.getByteArray(null); + byte[] exBytes0 = commState.getByteArray("exBytes"); if (exBytes0 == BYTE_ARR_NOT_READ) return false; @@ -431,7 +431,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 4: - byte[] filter0 = commState.getByteArray(null); + byte[] filter0 = commState.getByteArray("filter"); if (filter0 == BYTE_ARR_NOT_READ) return false; @@ -441,7 +441,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 5: - String filterClsName0 = commState.getString(null); + String filterClsName0 = commState.getString("filterClsName"); if (filterClsName0 == STR_NOT_READ) return false; @@ -460,7 +460,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter if (commState.readSize >= 0) { if (ldrParties == null) - ldrParties = U.newHashMap(commState.readSize); + ldrParties = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -493,7 +493,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 7: - byte[] resTopicBytes0 = commState.getByteArray(null); + byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -503,7 +503,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 8: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java index 8a1f0b9..3c3bd83 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java @@ -169,19 +169,19 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple switch (commState.idx) { case 3: - if (!commState.putByteArray(null, entriesBytes)) + if (!commState.putByteArray("entriesBytes", entriesBytes)) return false; commState.idx++; case 4: - if (!commState.putLong(null, futId)) + if (!commState.putLong("futId", futId)) return false; commState.idx++; case 5: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; @@ -201,7 +201,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray(null); + byte[] entriesBytes0 = commState.getByteArray("entriesBytes"); if (entriesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -214,7 +214,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple if (buf.remaining() < 8) return false; - futId = commState.getLong(null); + futId = commState.getLong("futId"); commState.idx++; @@ -222,7 +222,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java index 203b99d..a14604a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java @@ -159,13 +159,13 @@ public class GridCacheEvictionResponse extends GridCacheMessage { switch (commState.idx) { case 3: - if (!commState.putBoolean(null, err)) + if (!commState.putBoolean("err", err)) return false; commState.idx++; case 4: - if (!commState.putLong(null, futId)) + if (!commState.putLong("futId", futId)) return false; commState.idx++; @@ -215,7 +215,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (buf.remaining() < 1) return false; - err = commState.getBoolean(null); + err = commState.getBoolean("err"); commState.idx++; @@ -223,7 +223,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { if (buf.remaining() < 8) return false; - futId = commState.getLong(null); + futId = commState.getLong("futId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java index ea7987d..8d6986b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java @@ -594,19 +594,19 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage switch (commState.idx) { case 0: - if (!commState.putInt(null, cacheId)) + if (!commState.putInt("cacheId", cacheId)) return false; commState.idx++; case 1: - if (!commState.putMessage(null, depInfo)) + if (!commState.putMessage("depInfo", depInfo)) return false; commState.idx++; case 2: - if (!commState.putLong(null, msgId)) + if (!commState.putLong("msgId", msgId)) return false; commState.idx++; @@ -626,12 +626,12 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage if (buf.remaining() < 4) return false; - cacheId = commState.getInt(null); + cacheId = commState.getInt("cacheId"); commState.idx++; case 1: - Object depInfo0 = commState.getMessage(null); + Object depInfo0 = commState.getMessage("depInfo"); if (depInfo0 == MSG_NOT_READ) return false; @@ -644,7 +644,7 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage if (buf.remaining() < 8) return false; - msgId = commState.getLong(null); + msgId = commState.getLong("msgId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index 88c087f..93f8653 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -126,25 +126,25 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib switch (commState.idx) { case 8: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(null, nearXidVer)) + if (!commState.putCacheVersion("nearXidVer", nearXidVer)) return false; commState.idx++; case 11: - if (!commState.putInt(null, txNum)) + if (!commState.putInt("txNum", txNum)) return false; commState.idx++; @@ -164,7 +164,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -174,7 +174,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -184,7 +184,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); + GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -197,7 +197,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib if (buf.remaining() < 4) return false; - txNum = commState.getInt(null); + txNum = commState.getInt("txNum"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index 1baa17a..4bfda3d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -114,19 +114,19 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri switch (commState.idx) { case 8: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 10: - if (!commState.putBoolean(null, success)) + if (!commState.putBoolean("success", success)) return false; commState.idx++; @@ -146,7 +146,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -156,7 +156,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -169,7 +169,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri if (buf.remaining() < 1) return false; - success = commState.getBoolean(null); + success = commState.getBoolean("success"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index 89b1a4b..f25317a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -161,37 +161,37 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr switch (commState.idx) { case 8: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(null, nearXidVer)) + if (!commState.putCacheVersion("nearXidVer", nearXidVer)) return false; commState.idx++; case 11: - if (!commState.putUuid(null, originatingNodeId)) + if (!commState.putUuid("originatingNodeId", originatingNodeId)) return false; commState.idx++; case 12: - if (!commState.putLong(null, originatingThreadId)) + if (!commState.putLong("originatingThreadId", originatingThreadId)) return false; commState.idx++; case 13: - if (!commState.putBoolean(null, nearOnlyCheck)) + if (!commState.putBoolean("nearOnlyCheck", nearOnlyCheck)) return false; commState.idx++; @@ -211,7 +211,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -221,7 +221,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -231,7 +231,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); + GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -241,7 +241,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr commState.idx++; case 11: - UUID originatingNodeId0 = commState.getUuid(null); + UUID originatingNodeId0 = commState.getUuid("originatingNodeId"); if (originatingNodeId0 == UUID_NOT_READ) return false; @@ -254,7 +254,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr if (buf.remaining() < 8) return false; - originatingThreadId = commState.getLong(null); + originatingThreadId = commState.getLong("originatingThreadId"); commState.idx++; @@ -262,7 +262,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr if (buf.remaining() < 1) return false; - nearOnlyCheck = commState.getBoolean(null); + nearOnlyCheck = commState.getBoolean("nearOnlyCheck"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 88f354b..19cfbb8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -145,19 +145,19 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist switch (commState.idx) { case 8: - if (!commState.putByteArray(null, committedTxInfoBytes)) + if (!commState.putByteArray("committedTxInfoBytes", committedTxInfoBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 10: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -177,7 +177,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist switch (commState.idx) { case 8: - byte[] committedTxInfoBytes0 = commState.getByteArray(null); + byte[] committedTxInfoBytes0 = commState.getByteArray("committedTxInfoBytes"); if (committedTxInfoBytes0 == BYTE_ARR_NOT_READ) return false; @@ -187,7 +187,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -197,7 +197,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist commState.idx++; case 10: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java index 3a0a86f..3709cd9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -263,13 +263,13 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< switch (commState.idx) { case 3: - if (!commState.putByteArray(null, candsByIdxBytes)) + if (!commState.putByteArray("candsByIdxBytes", candsByIdxBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, candsByKeyBytes)) + if (!commState.putByteArray("candsByKeyBytes", candsByKeyBytes)) return false; commState.idx++; @@ -329,7 +329,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 7: - if (!commState.putCacheVersion(null, ver)) + if (!commState.putCacheVersion("ver", ver)) return false; commState.idx++; @@ -349,7 +349,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< switch (commState.idx) { case 3: - byte[] candsByIdxBytes0 = commState.getByteArray(null); + byte[] candsByIdxBytes0 = commState.getByteArray("candsByIdxBytes"); if (candsByIdxBytes0 == BYTE_ARR_NOT_READ) return false; @@ -359,7 +359,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 4: - byte[] candsByKeyBytes0 = commState.getByteArray(null); + byte[] candsByKeyBytes0 = commState.getByteArray("candsByKeyBytes"); if (candsByKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -427,7 +427,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 7: - GridCacheVersion ver0 = commState.getCacheVersion(null); + GridCacheVersion ver0 = commState.getCacheVersion("ver"); if (ver0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java index add0721..0a49f10 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java @@ -498,37 +498,37 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 9: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 10: - if (!commState.putByteArray(null, grpLockKeyBytes)) + if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; commState.idx++; case 11: - if (!commState.putBoolean(null, isInTx)) + if (!commState.putBoolean("isInTx", isInTx)) return false; commState.idx++; case 12: - if (!commState.putBoolean(null, isInvalidate)) + if (!commState.putBoolean("isInvalidate", isInvalidate)) return false; commState.idx++; case 13: - if (!commState.putBoolean(null, isRead)) + if (!commState.putBoolean("isRead", isRead)) return false; commState.idx++; case 14: - if (!commState.putEnum(null, isolation)) + if (!commState.putEnum("isolation", isolation)) return false; commState.idx++; @@ -561,49 +561,49 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 16: - if (!commState.putCacheVersion(null, nearXidVer)) + if (!commState.putCacheVersion("nearXidVer", nearXidVer)) return false; commState.idx++; case 17: - if (!commState.putUuid(null, nodeId)) + if (!commState.putUuid("nodeId", nodeId)) return false; commState.idx++; case 18: - if (!commState.putBoolean(null, partLock)) + if (!commState.putBoolean("partLock", partLock)) return false; commState.idx++; case 19: - if (!commState.putBooleanArray(null, retVals)) + if (!commState.putBooleanArray("retVals", retVals)) return false; commState.idx++; case 20: - if (!commState.putLong(null, threadId)) + if (!commState.putLong("threadId", threadId)) return false; commState.idx++; case 21: - if (!commState.putLong(null, timeout)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; case 22: - if (!commState.putInt(null, txSize)) + if (!commState.putInt("txSize", txSize)) return false; commState.idx++; case 23: - if (!commState.putByteArray(null, writeEntriesBytes)) + if (!commState.putByteArray("writeEntriesBytes", writeEntriesBytes)) return false; commState.idx++; @@ -652,7 +652,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -662,7 +662,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 10: - byte[] grpLockKeyBytes0 = commState.getByteArray(null); + byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -675,7 +675,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isInTx = commState.getBoolean(null); + isInTx = commState.getBoolean("isInTx"); commState.idx++; @@ -683,7 +683,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isInvalidate = commState.getBoolean(null); + isInvalidate = commState.getBoolean("isInvalidate"); commState.idx++; @@ -691,7 +691,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - isRead = commState.getBoolean(null); + isRead = commState.getBoolean("isRead"); commState.idx++; @@ -699,7 +699,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(null); + byte isolation0 = commState.getByte("isolation"); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); @@ -735,7 +735,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 16: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); + GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -745,7 +745,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 17: - UUID nodeId0 = commState.getUuid(null); + UUID nodeId0 = commState.getUuid("nodeId"); if (nodeId0 == UUID_NOT_READ) return false; @@ -758,12 +758,12 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 1) return false; - partLock = commState.getBoolean(null); + partLock = commState.getBoolean("partLock"); commState.idx++; case 19: - boolean[] retVals0 = commState.getBooleanArray(null); + boolean[] retVals0 = commState.getBooleanArray("retVals"); if (retVals0 == BOOLEAN_ARR_NOT_READ) return false; @@ -776,7 +776,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 8) return false; - threadId = commState.getLong(null); + threadId = commState.getLong("threadId"); commState.idx++; @@ -784,7 +784,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 8) return false; - timeout = commState.getLong(null); + timeout = commState.getLong("timeout"); commState.idx++; @@ -792,12 +792,12 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage if (buf.remaining() < 4) return false; - txSize = commState.getInt(null); + txSize = commState.getInt("txSize"); commState.idx++; case 23: - byte[] writeEntriesBytes0 = commState.getByteArray(null); + byte[] writeEntriesBytes0 = commState.getByteArray("writeEntriesBytes"); if (writeEntriesBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java index cf94059..7facf11 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java @@ -295,13 +295,13 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag switch (commState.idx) { case 8: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 9: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -348,7 +348,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag switch (commState.idx) { case 8: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -358,7 +358,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java index 8ffbc3d..b41665d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -342,6 +342,8 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes _clone.commitVer = commitVer; _clone.invalidate = invalidate; _clone.commit = commit; + _clone.syncCommit = syncCommit; + _clone.syncRollback = syncRollback; _clone.baseVer = baseVer; _clone.writeEntries = writeEntries; _clone.writeEntriesBytes = writeEntriesBytes; @@ -369,54 +371,42 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes switch (commState.idx) { case 8: - if (!commState.putCacheVersion(null, baseVer)) + if (!commState.putCacheVersion("baseVer", baseVer)) return false; commState.idx++; case 9: - if (!commState.putBoolean(null, commit)) + if (!commState.putBoolean("commit", commit)) return false; commState.idx++; case 10: - if (!commState.putCacheVersion(null, commitVer)) + if (!commState.putCacheVersion("commitVer", commitVer)) return false; commState.idx++; case 11: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 12: - if (!commState.putByteArray(null, grpLockKeyBytes)) + if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; commState.idx++; case 13: - if (!commState.putBoolean(null, invalidate)) + if (!commState.putBoolean("invalidate", invalidate)) return false; commState.idx++; case 14: - if (!commState.putBoolean(null, syncCommit)) - return false; - - commState.idx++; - - case 15: - if (!commState.putBoolean(null, syncRollback)) - return false; - - commState.idx++; - - case 16: if (recoveryWritesBytes != null) { if (commState.it == null) { if (!commState.putInt(null, recoveryWritesBytes.size())) @@ -443,14 +433,26 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; + case 15: + if (!commState.putBoolean("syncCommit", syncCommit)) + return false; + + commState.idx++; + + case 16: + if (!commState.putBoolean("syncRollback", syncRollback)) + return false; + + commState.idx++; + case 17: - if (!commState.putLong(null, threadId)) + if (!commState.putLong("threadId", threadId)) return false; commState.idx++; case 18: - if (!commState.putInt(null, txSize)) + if (!commState.putInt("txSize", txSize)) return false; commState.idx++; @@ -497,7 +499,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes switch (commState.idx) { case 8: - GridCacheVersion baseVer0 = commState.getCacheVersion(null); + GridCacheVersion baseVer0 = commState.getCacheVersion("baseVer"); if (baseVer0 == CACHE_VER_NOT_READ) return false; @@ -510,12 +512,12 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - commit = commState.getBoolean(null); + commit = commState.getBoolean("commit"); commState.idx++; case 10: - GridCacheVersion commitVer0 = commState.getCacheVersion(null); + GridCacheVersion commitVer0 = commState.getCacheVersion("commitVer"); if (commitVer0 == CACHE_VER_NOT_READ) return false; @@ -525,7 +527,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -535,7 +537,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 12: - byte[] grpLockKeyBytes0 = commState.getByteArray(null); + byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -548,27 +550,11 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - invalidate = commState.getBoolean(null); + invalidate = commState.getBoolean("invalidate"); commState.idx++; case 14: - if (buf.remaining() < 1) - return false; - - syncCommit = commState.getBoolean(null); - - commState.idx++; - - case 15: - if (buf.remaining() < 1) - return false; - - syncRollback = commState.getBoolean(null); - - commState.idx++; - - case 16: if (commState.readSize == -1) { if (buf.remaining() < 4) return false; @@ -597,11 +583,27 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; + case 15: + if (buf.remaining() < 1) + return false; + + syncCommit = commState.getBoolean("syncCommit"); + + commState.idx++; + + case 16: + if (buf.remaining() < 1) + return false; + + syncRollback = commState.getBoolean("syncRollback"); + + commState.idx++; + case 17: if (buf.remaining() < 8) return false; - threadId = commState.getLong(null); + threadId = commState.getLong("threadId"); commState.idx++; @@ -609,7 +611,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 4) return false; - txSize = commState.getInt(null); + txSize = commState.getInt("txSize"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java index eb68e05..fd616d0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -102,13 +102,13 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedBaseMe switch (commState.idx) { case 8: - if (!commState.putCacheVersion(null, commitVer)) + if (!commState.putCacheVersion("commitVer", commitVer)) return false; commState.idx++; case 9: - if (!commState.putEnum(null, concurrency)) + if (!commState.putEnum("concurrency", concurrency)) return false; commState.idx++; case 10: - if (!commState.putByteArray(null, dhtVersBytes)) + if (!commState.putByteArray("dhtVersBytes", dhtVersBytes)) return false; commState.idx++; case 11: - if (!commState.putByteArray(null, grpLockKeyBytes)) + if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; commState.idx++; case 12: - if (!commState.putBoolean(null, invalidate)) + if (!commState.putBoolean("invalidate", invalidate)) return false; commState.idx++; case 13: - if (!commState.putEnum(null, isolation)) + if (!commState.putEnum("isolation", isolation)) return false; commState.idx++; case 14: - if (!commState.putBoolean(null, partLock)) + if (!commState.putBoolean("partLock", partLock)) return false; commState.idx++; @@ -503,25 +503,25 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; case 16: - if (!commState.putLong(null, threadId)) + if (!commState.putLong("threadId", threadId)) return false; commState.idx++; case 17: - if (!commState.putLong(null, timeout)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; case 18: - if (!commState.putByteArray(null, txNodesBytes)) + if (!commState.putByteArray("txNodesBytes", txNodesBytes)) return false; commState.idx++; case 19: - if (!commState.putInt(null, txSize)) + if (!commState.putInt("txSize", txSize)) return false; commState.idx++; @@ -568,7 +568,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe switch (commState.idx) { case 8: - GridCacheVersion commitVer0 = commState.getCacheVersion(null); + GridCacheVersion commitVer0 = commState.getCacheVersion("commitVer"); if (commitVer0 == CACHE_VER_NOT_READ) return false; @@ -581,14 +581,14 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - byte concurrency0 = commState.getByte(null); + byte concurrency0 = commState.getByte("concurrency"); concurrency = GridCacheTxConcurrency.fromOrdinal(concurrency0); commState.idx++; case 10: - byte[] dhtVersBytes0 = commState.getByteArray(null); + byte[] dhtVersBytes0 = commState.getByteArray("dhtVersBytes"); if (dhtVersBytes0 == BYTE_ARR_NOT_READ) return false; @@ -598,7 +598,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; case 11: - byte[] grpLockKeyBytes0 = commState.getByteArray(null); + byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) return false; @@ -611,7 +611,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - invalidate = commState.getBoolean(null); + invalidate = commState.getBoolean("invalidate"); commState.idx++; @@ -619,7 +619,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(null); + byte isolation0 = commState.getByte("isolation"); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); @@ -629,7 +629,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - partLock = commState.getBoolean(null); + partLock = commState.getBoolean("partLock"); commState.idx++; @@ -666,7 +666,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 8) return false; - threadId = commState.getLong(null); + threadId = commState.getLong("threadId"); commState.idx++; @@ -674,12 +674,12 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 8) return false; - timeout = commState.getLong(null); + timeout = commState.getLong("timeout"); commState.idx++; case 18: - byte[] txNodesBytes0 = commState.getByteArray(null); + byte[] txNodesBytes0 = commState.getByteArray("txNodesBytes"); if (txNodesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -692,7 +692,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 4) return false; - txSize = commState.getInt(null); + txSize = commState.getInt("txSize"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index 2754c9e..64922f7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -179,13 +179,13 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM switch (commState.idx) { case 8: - if (!commState.putByteArray(null, candsBytes)) + if (!commState.putByteArray("candsBytes", candsBytes)) return false; commState.idx++; case 9: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; @@ -205,7 +205,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM switch (commState.idx) { case 8: - byte[] candsBytes0 = commState.getByteArray(null); + byte[] candsBytes0 = commState.getByteArray("candsBytes"); if (candsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -215,7 +215,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM commState.idx++; case 9: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index ef4e7ba..9c6b74b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -93,7 +93,7 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { switch (commState.idx) { case 24: - if (!commState.putBitSet(null, invalidateEntries)) + if (!commState.putBitSet("invalidateEntries", invalidateEntries)) return false; commState.idx++; case 25: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -387,31 +387,31 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 27: - if (!commState.putByteArray(null, ownedBytes)) + if (!commState.putByteArray("ownedBytes", ownedBytes)) return false; commState.idx++; case 28: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 29: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 30: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 31: - if (!commState.putBitSet(null, preloadKeys)) + if (!commState.putBitSet("preloadKeys", preloadKeys)) return false; commState.idx++; @@ -431,7 +431,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { switch (commState.idx) { case 24: - BitSet invalidateEntries0 = commState.getBitSet(null); + BitSet invalidateEntries0 = commState.getBitSet("invalidateEntries"); if (invalidateEntries0 == BIT_SET_NOT_READ) return false; @@ -441,7 +441,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -480,7 +480,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 27: - byte[] ownedBytes0 = commState.getByteArray(null); + byte[] ownedBytes0 = commState.getByteArray("ownedBytes"); if (ownedBytes0 == BYTE_ARR_NOT_READ) return false; @@ -493,12 +493,12 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 29: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -511,12 +511,12 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; case 31: - BitSet preloadKeys0 = commState.getBitSet(null); + BitSet preloadKeys0 = commState.getBitSet("preloadKeys"); if (preloadKeys0 == BIT_SET_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java index 2563a31..6c68bdb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -257,7 +257,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.idx++; case 12: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -360,7 +360,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 105787f..d435b58 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -323,19 +323,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest switch (commState.idx) { case 20: - if (!commState.putEnum(null, isolation)) + if (!commState.putEnum("isolation", isolation)) return false; commState.idx++; case 21: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 22: - if (!commState.putUuid(null, nearNodeId)) + if (!commState.putUuid("nearNodeId", nearNodeId)) return false; commState.idx++; @@ -368,7 +368,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 24: - if (!commState.putBoolean(null, onePhaseCommit)) + if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) return false; commState.idx++; @@ -401,31 +401,31 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 26: - if (!commState.putBoolean(null, sysInvalidate)) + if (!commState.putBoolean("sysInvalidate", sysInvalidate)) return false; commState.idx++; case 27: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 28: - if (!commState.putCacheVersion(null, writeVer)) + if (!commState.putCacheVersion("writeVer", writeVer)) return false; commState.idx++; case 29: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 30: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -448,14 +448,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(null); + byte isolation0 = commState.getByte("isolation"); isolation = GridCacheTxIsolation.fromOrdinal(isolation0); commState.idx++; case 21: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -465,7 +465,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 22: - UUID nearNodeId0 = commState.getUuid(null); + UUID nearNodeId0 = commState.getUuid("nearNodeId"); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -507,7 +507,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - onePhaseCommit = commState.getBoolean(null); + onePhaseCommit = commState.getBoolean("onePhaseCommit"); commState.idx++; @@ -544,7 +544,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - sysInvalidate = commState.getBoolean(null); + sysInvalidate = commState.getBoolean("sysInvalidate"); commState.idx++; @@ -552,12 +552,12 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 28: - GridCacheVersion writeVer0 = commState.getCacheVersion(null); + GridCacheVersion writeVer0 = commState.getCacheVersion("writeVer"); if (writeVer0 == CACHE_VER_NOT_READ) return false; @@ -567,7 +567,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 29: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -580,7 +580,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index b64e780..1215f1e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -96,7 +96,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon switch (commState.idx) { case 5: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -116,7 +116,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon switch (commState.idx) { case 5: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java index 1455e5d..51be9d5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java @@ -353,31 +353,31 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 21: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 22: - if (!commState.putBitSet(null, invalidateNearEntries)) + if (!commState.putBitSet("invalidateNearEntries", invalidateNearEntries)) return false; commState.idx++; case 23: - if (!commState.putBoolean(null, last)) + if (!commState.putBoolean("last", last)) return false; commState.idx++; case 24: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 25: - if (!commState.putUuid(null, nearNodeId)) + if (!commState.putUuid("nearNodeId", nearNodeId)) return false; commState.idx++; @@ -410,37 +410,37 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 27: - if (!commState.putCacheVersion(null, nearXidVer)) + if (!commState.putCacheVersion("nearXidVer", nearXidVer)) return false; commState.idx++; case 28: - if (!commState.putByteArray(null, ownedBytes)) + if (!commState.putByteArray("ownedBytes", ownedBytes)) return false; commState.idx++; case 29: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 30: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 31: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 32: - if (!commState.putBitSet(null, preloadKeys)) + if (!commState.putBitSet("preloadKeys", preloadKeys)) return false; commState.idx++; @@ -460,7 +460,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 21: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -470,7 +470,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 22: - BitSet invalidateNearEntries0 = commState.getBitSet(null); + BitSet invalidateNearEntries0 = commState.getBitSet("invalidateNearEntries"); if (invalidateNearEntries0 == BIT_SET_NOT_READ) return false; @@ -483,12 +483,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 1) return false; - last = commState.getBoolean(null); + last = commState.getBoolean("last"); commState.idx++; case 24: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -498,7 +498,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 25: - UUID nearNodeId0 = commState.getUuid(null); + UUID nearNodeId0 = commState.getUuid("nearNodeId"); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -537,7 +537,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 27: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); + GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -547,7 +547,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 28: - byte[] ownedBytes0 = commState.getByteArray(null); + byte[] ownedBytes0 = commState.getByteArray("ownedBytes"); if (ownedBytes0 == BYTE_ARR_NOT_READ) return false; @@ -560,12 +560,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 30: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -578,12 +578,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; case 32: - BitSet preloadKeys0 = commState.getBitSet(null); + BitSet preloadKeys0 = commState.getBitSet("preloadKeys"); if (preloadKeys0 == BIT_SET_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index d541b58..33fe66f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -237,7 +237,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp switch (commState.idx) { case 10: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -270,7 +270,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.idx++; case 12: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -344,7 +344,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp switch (commState.idx) { case 10: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -383,7 +383,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 6e084f3..18ba7c4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -652,13 +652,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp switch (commState.idx) { case 3: - if (!commState.putLongList(null, drExpireTimes)) + if (!commState.putLongList("drExpireTimes", drExpireTimes)) return false; commState.idx++; case 4: - if (!commState.putLongList(null, drTtls)) + if (!commState.putLongList("drTtls", drTtls)) return false; commState.idx++; @@ -691,7 +691,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 6: - if (!commState.putCacheVersion(null, futVer)) + if (!commState.putCacheVersion("futVer", futVer)) return false; commState.idx++; @@ -724,25 +724,25 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - if (!commState.putUuid(null, nodeId)) + if (!commState.putUuid("nodeId", nodeId)) return false; commState.idx++; case 9: - if (!commState.putEnum(null, syncMode)) + if (!commState.putEnum("syncMode", syncMode)) return false; commState.idx++; case 10: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 11: - if (!commState.putLong(null, ttl)) + if (!commState.putLong("ttl", ttl)) return false; commState.idx++; @@ -775,7 +775,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 13: - if (!commState.putCacheVersion(null, writeVer)) + if (!commState.putCacheVersion("writeVer", writeVer)) return false; commState.idx++; @@ -835,7 +835,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 16: - if (!commState.putBoolean(null, forceTransformBackups)) + if (!commState.putBoolean("forceTransformBackups", forceTransformBackups)) return false; commState.idx++; @@ -895,13 +895,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 19: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 20: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -921,7 +921,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList(null); + GridLongList drExpireTimes0 = commState.getLongList("drExpireTimes"); if (drExpireTimes0 == LONG_LIST_NOT_READ) return false; @@ -931,7 +931,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList(null); + GridLongList drTtls0 = commState.getLongList("drTtls"); if (drTtls0 == LONG_LIST_NOT_READ) return false; @@ -970,7 +970,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 6: - GridCacheVersion futVer0 = commState.getCacheVersion(null); + GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -1009,7 +1009,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - UUID nodeId0 = commState.getUuid(null); + UUID nodeId0 = commState.getUuid("nodeId"); if (nodeId0 == UUID_NOT_READ) return false; @@ -1022,7 +1022,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 1) return false; - byte syncMode0 = commState.getByte(null); + byte syncMode0 = commState.getByte("syncMode"); syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); @@ -1032,7 +1032,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; @@ -1040,7 +1040,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 8) return false; - ttl = commState.getLong(null); + ttl = commState.getLong("ttl"); commState.idx++; @@ -1074,7 +1074,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 13: - GridCacheVersion writeVer0 = commState.getCacheVersion(null); + GridCacheVersion writeVer0 = commState.getCacheVersion("writeVer"); if (writeVer0 == CACHE_VER_NOT_READ) return false; @@ -1145,7 +1145,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 1) return false; - forceTransformBackups = commState.getBoolean(null); + forceTransformBackups = commState.getBoolean("forceTransformBackups"); commState.idx++; @@ -1208,7 +1208,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 19: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -1221,7 +1221,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 5d3ba59..bc54e2f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -211,19 +211,19 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im switch (commState.idx) { case 3: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, failedKeysBytes)) + if (!commState.putByteArray("failedKeysBytes", failedKeysBytes)) return false; commState.idx++; case 5: - if (!commState.putCacheVersion(null, futVer)) + if (!commState.putCacheVersion("futVer", futVer)) return false; commState.idx++; @@ -270,7 +270,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -280,7 +280,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray(null); + byte[] failedKeysBytes0 = commState.getByteArray("failedKeysBytes"); if (failedKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -290,7 +290,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion(null); + GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); if (futVer0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 446a521..353446a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -553,13 +553,13 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im switch (commState.idx) { case 3: - if (!commState.putLongList(null, drExpireTimes)) + if (!commState.putLongList("drExpireTimes", drExpireTimes)) return false; commState.idx++; case 4: - if (!commState.putLongList(null, drTtls)) + if (!commState.putLongList("drTtls", drTtls)) return false; commState.idx++; @@ -592,7 +592,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 6: - if (!commState.putBoolean(null, fastMap)) + if (!commState.putBoolean("fastMap", fastMap)) return false; commState.idx++; @@ -625,13 +625,13 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 8: - if (!commState.putCacheVersion(null, futVer)) + if (!commState.putCacheVersion("futVer", futVer)) return false; commState.idx++; case 9: - if (!commState.putBoolean(null, hasPrimary)) + if (!commState.putBoolean("hasPrimary", hasPrimary)) return false; commState.idx++; @@ -664,37 +664,37 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 11: - if (!commState.putEnum(null, op)) + if (!commState.putEnum("op", op)) return false; commState.idx++; case 12: - if (!commState.putBoolean(null, retval)) + if (!commState.putBoolean("retval", retval)) return false; commState.idx++; case 13: - if (!commState.putEnum(null, syncMode)) + if (!commState.putEnum("syncMode", syncMode)) return false; commState.idx++; case 14: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 15: - if (!commState.putLong(null, ttl)) + if (!commState.putLong("ttl", ttl)) return false; commState.idx++; case 16: - if (!commState.putCacheVersion(null, updateVer)) + if (!commState.putCacheVersion("updateVer", updateVer)) return false; commState.idx++; @@ -727,19 +727,19 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 18: - if (!commState.putBoolean(null, forceTransformBackups)) + if (!commState.putBoolean("forceTransformBackups", forceTransformBackups)) return false; commState.idx++; case 19: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 20: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -759,7 +759,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList(null); + GridLongList drExpireTimes0 = commState.getLongList("drExpireTimes"); if (drExpireTimes0 == LONG_LIST_NOT_READ) return false; @@ -769,7 +769,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList(null); + GridLongList drTtls0 = commState.getLongList("drTtls"); if (drTtls0 == LONG_LIST_NOT_READ) return false; @@ -811,7 +811,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - fastMap = commState.getBoolean(null); + fastMap = commState.getBoolean("fastMap"); commState.idx++; @@ -845,7 +845,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 8: - GridCacheVersion futVer0 = commState.getCacheVersion(null); + GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -858,7 +858,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - hasPrimary = commState.getBoolean(null); + hasPrimary = commState.getBoolean("hasPrimary"); commState.idx++; @@ -895,7 +895,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - byte op0 = commState.getByte(null); + byte op0 = commState.getByte("op"); op = GridCacheOperation.fromOrdinal(op0); @@ -905,7 +905,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - retval = commState.getBoolean(null); + retval = commState.getBoolean("retval"); commState.idx++; @@ -913,7 +913,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - byte syncMode0 = commState.getByte(null); + byte syncMode0 = commState.getByte("syncMode"); syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); @@ -923,7 +923,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; @@ -931,12 +931,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 8) return false; - ttl = commState.getLong(null); + ttl = commState.getLong("ttl"); commState.idx++; case 16: - GridCacheVersion updateVer0 = commState.getCacheVersion(null); + GridCacheVersion updateVer0 = commState.getCacheVersion("updateVer"); if (updateVer0 == CACHE_VER_NOT_READ) return false; @@ -978,12 +978,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 1) return false; - forceTransformBackups = commState.getBoolean(null); + forceTransformBackups = commState.getBoolean("forceTransformBackups"); commState.idx++; case 19: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -996,7 +996,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index ba683c3..363ac8b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -404,31 +404,31 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i switch (commState.idx) { case 3: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, failedKeysBytes)) + if (!commState.putByteArray("failedKeysBytes", failedKeysBytes)) return false; commState.idx++; case 5: - if (!commState.putCacheVersion(null, futVer)) + if (!commState.putCacheVersion("futVer", futVer)) return false; commState.idx++; case 6: - if (!commState.putByteArray(null, remapKeysBytes)) + if (!commState.putByteArray("remapKeysBytes", remapKeysBytes)) return false; commState.idx++; case 7: - if (!commState.putByteArray(null, retValBytes)) + if (!commState.putByteArray("retValBytes", retValBytes)) return false; commState.idx++; @@ -461,7 +461,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 9: - if (!commState.putLong(null, nearTtl)) + if (!commState.putLong("nearTtl", nearTtl)) return false; commState.idx++; @@ -521,7 +521,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 12: - if (!commState.putCacheVersion(null, nearVer)) + if (!commState.putCacheVersion("nearVer", nearVer)) return false; commState.idx++; @@ -541,7 +541,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -551,7 +551,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray(null); + byte[] failedKeysBytes0 = commState.getByteArray("failedKeysBytes"); if (failedKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -561,7 +561,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion(null); + GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); if (futVer0 == CACHE_VER_NOT_READ) return false; @@ -571,7 +571,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 6: - byte[] remapKeysBytes0 = commState.getByteArray(null); + byte[] remapKeysBytes0 = commState.getByteArray("remapKeysBytes"); if (remapKeysBytes0 == BYTE_ARR_NOT_READ) return false; @@ -581,7 +581,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 7: - byte[] retValBytes0 = commState.getByteArray(null); + byte[] retValBytes0 = commState.getByteArray("retValBytes"); if (retValBytes0 == BYTE_ARR_NOT_READ) return false; @@ -623,7 +623,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i if (buf.remaining() < 8) return false; - nearTtl = commState.getLong(null); + nearTtl = commState.getLong("nearTtl"); commState.idx++; @@ -686,7 +686,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 12: - GridCacheVersion nearVer0 = commState.getCacheVersion(null); + GridCacheVersion nearVer0 = commState.getCacheVersion("nearVer"); if (nearVer0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 30c18cc..60f9144 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -193,7 +193,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem switch (commState.idx) { case 3: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -226,13 +226,13 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem commState.idx++; case 5: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 6: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; @@ -252,7 +252,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -291,7 +291,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -304,7 +304,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index e333a95..bd56937 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -197,19 +197,19 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple switch (commState.idx) { case 3: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, infosBytes)) + if (!commState.putByteArray("infosBytes", infosBytes)) return false; commState.idx++; case 5: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -256,7 +256,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -266,7 +266,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple commState.idx++; case 4: - byte[] infosBytes0 = commState.getByteArray(null); + byte[] infosBytes0 = commState.getByteArray("infosBytes"); if (infosBytes0 == BYTE_ARR_NOT_READ) return false; @@ -276,7 +276,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index f77adc5..bb036cd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -250,31 +250,31 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage commState.idx++; case 4: - if (!commState.putLong(null, timeout)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; case 5: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 6: - if (!commState.putByteArray(null, topicBytes)) + if (!commState.putByteArray("topicBytes", topicBytes)) return false; commState.idx++; case 7: - if (!commState.putLong(null, updateSeq)) + if (!commState.putLong("updateSeq", updateSeq)) return false; commState.idx++; case 8: - if (!commState.putInt(null, workerId)) + if (!commState.putInt("workerId", workerId)) return false; commState.idx++; @@ -326,7 +326,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - timeout = commState.getLong(null); + timeout = commState.getLong("timeout"); commState.idx++; @@ -334,12 +334,12 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 6: - byte[] topicBytes0 = commState.getByteArray(null); + byte[] topicBytes0 = commState.getByteArray("topicBytes"); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -352,7 +352,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - updateSeq = commState.getLong(null); + updateSeq = commState.getLong("updateSeq"); commState.idx++; @@ -360,7 +360,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - workerId = commState.getInt(null); + workerId = commState.getInt("workerId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java index bf3b606..4736f5c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java @@ -308,13 +308,13 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage switch (commState.idx) { case 3: - if (!commState.putBoolean(null, ack)) + if (!commState.putBoolean("ack", ack)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, infoBytes)) + if (!commState.putByteArray("infoBytes", infoBytes)) return false; commState.idx++; @@ -374,13 +374,13 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage commState.idx++; case 7: - if (!commState.putLong(null, updateSeq)) + if (!commState.putLong("updateSeq", updateSeq)) return false; commState.idx++; case 8: - if (!commState.putInt(null, workerId)) + if (!commState.putInt("workerId", workerId)) return false; commState.idx++; @@ -403,12 +403,12 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 1) return false; - ack = commState.getBoolean(null); + ack = commState.getBoolean("ack"); commState.idx++; case 4: - byte[] infoBytes0 = commState.getByteArray(null); + byte[] infoBytes0 = commState.getByteArray("infoBytes"); if (infoBytes0 == BYTE_ARR_NOT_READ) return false; @@ -479,7 +479,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 8) return false; - updateSeq = commState.getLong(null); + updateSeq = commState.getLong("updateSeq"); commState.idx++; @@ -487,7 +487,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage if (buf.remaining() < 4) return false; - workerId = commState.getInt(null); + workerId = commState.getInt("workerId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java index e275f17..6b975e7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java @@ -92,13 +92,13 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDhtPartitionsAbstrac switch (commState.idx) { case 5: - if (!commState.putByteArray(null, affAssignmentBytes)) + if (!commState.putByteArray("affAssignmentBytes", affAssignmentBytes)) return false; commState.idx++; case 6: - if (!commState.putByteArray(null, partsBytes)) + if (!commState.putByteArray("partsBytes", partsBytes)) return false; commState.idx++; case 7: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; @@ -205,7 +205,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac switch (commState.idx) { case 5: - byte[] affAssignmentBytes0 = commState.getByteArray(null); + byte[] affAssignmentBytes0 = commState.getByteArray("affAssignmentBytes"); if (affAssignmentBytes0 == BYTE_ARR_NOT_READ) return false; @@ -215,7 +215,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac commState.idx++; case 6: - byte[] partsBytes0 = commState.getByteArray(null); + byte[] partsBytes0 = commState.getByteArray("partsBytes"); if (partsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -228,7 +228,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java index 0671800..a2cee94 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java @@ -122,7 +122,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr switch (commState.idx) { case 5: - if (!commState.putByteArray(null, partsBytes)) + if (!commState.putByteArray("partsBytes", partsBytes)) return false; commState.idx++; @@ -142,7 +142,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr switch (commState.idx) { case 5: - byte[] partsBytes0 = commState.getByteArray(null); + byte[] partsBytes0 = commState.getByteArray("partsBytes"); if (partsBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java index 61815b0..133569a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java @@ -285,7 +285,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 4: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -329,37 +329,37 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 6: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 7: - if (!commState.putBoolean(null, reload)) + if (!commState.putBoolean("reload", reload)) return false; commState.idx++; case 8: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 9: - if (!commState.putCacheVersion(null, ver)) + if (!commState.putCacheVersion("ver", ver)) return false; commState.idx++; case 10: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 11: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -408,7 +408,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 4: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -460,7 +460,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -473,7 +473,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 1) return false; - reload = commState.getBoolean(null); + reload = commState.getBoolean("reload"); commState.idx++; @@ -481,12 +481,12 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion(null); + GridCacheVersion ver0 = commState.getCacheVersion("ver"); if (ver0 == CACHE_VER_NOT_READ) return false; @@ -496,7 +496,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 10: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -509,7 +509,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java index 1eba548..c652c52 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java @@ -234,19 +234,19 @@ public class GridNearGetResponse extends GridCacheMessage implements switch (commState.idx) { case 3: - if (!commState.putByteArray(null, entriesBytes)) + if (!commState.putByteArray("entriesBytes", entriesBytes)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 5: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -279,19 +279,19 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 7: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 8: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 9: - if (!commState.putCacheVersion(null, ver)) + if (!commState.putCacheVersion("ver", ver)) return false; commState.idx++; @@ -311,7 +311,7 @@ public class GridNearGetResponse extends GridCacheMessage implements switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray(null); + byte[] entriesBytes0 = commState.getByteArray("entriesBytes"); if (entriesBytes0 == BYTE_ARR_NOT_READ) return false; @@ -321,7 +321,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -331,7 +331,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 5: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -370,7 +370,7 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 7: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -383,12 +383,12 @@ public class GridNearGetResponse extends GridCacheMessage implements if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion(null); + GridCacheVersion ver0 = commState.getCacheVersion("ver"); if (ver0 == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java index 6f80471..68c76df 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java @@ -389,49 +389,49 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; case 26: - if (!commState.putBoolean(null, implicitSingleTx)) + if (!commState.putBoolean("implicitSingleTx", implicitSingleTx)) return false; commState.idx++; case 27: - if (!commState.putBoolean(null, implicitTx)) + if (!commState.putBoolean("implicitTx", implicitTx)) return false; commState.idx++; case 28: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 29: - if (!commState.putBoolean(null, onePhaseCommit)) + if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) return false; commState.idx++; case 30: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 31: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 32: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 33: - if (!commState.putBoolean(null, hasTransforms)) + if (!commState.putBoolean("hasTransforms", hasTransforms)) return false; commState.idx++; @@ -512,7 +512,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - implicitSingleTx = commState.getBoolean(null); + implicitSingleTx = commState.getBoolean("implicitSingleTx"); commState.idx++; @@ -520,12 +520,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - implicitTx = commState.getBoolean(null); + implicitTx = commState.getBoolean("implicitTx"); commState.idx++; case 28: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -538,7 +538,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - onePhaseCommit = commState.getBoolean(null); + onePhaseCommit = commState.getBoolean("onePhaseCommit"); commState.idx++; @@ -546,12 +546,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 31: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -564,7 +564,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; @@ -572,7 +572,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - hasTransforms = commState.getBoolean(null); + hasTransforms = commState.getBoolean("hasTransforms"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java index f5476fc..9c0a0b0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java @@ -237,7 +237,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedTxFinishReques switch (commState.idx) { case 20: - if (!commState.putBoolean(null, explicitLock)) + if (!commState.putBoolean("explicitLock", explicitLock)) return false; commState.idx++; case 21: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 22: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 23: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 24: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -223,12 +223,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 1) return false; - explicitLock = commState.getBoolean(null); + explicitLock = commState.getBoolean("explicitLock"); commState.idx++; case 21: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -241,12 +241,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 23: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -259,7 +259,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java index b093106..93629bf 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -143,19 +143,19 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo switch (commState.idx) { case 5: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 6: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 7: - if (!commState.putLong(null, nearThreadId)) + if (!commState.putLong("nearThreadId", nearThreadId)) return false; commState.idx++; @@ -175,7 +175,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo switch (commState.idx) { case 5: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -185,7 +185,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -198,7 +198,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo if (buf.remaining() < 8) return false; - nearThreadId = commState.getLong(null); + nearThreadId = commState.getLong("nearThreadId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java index 7decc5e..ab51ff3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java @@ -219,6 +219,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ _clone.futId = futId; _clone.miniId = miniId; + _clone.near = near; _clone.topVer = topVer; _clone.last = last; _clone.lastBackups = lastBackups; @@ -243,13 +244,13 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 21: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 22: - if (!commState.putBoolean(null, last)) + if (!commState.putBoolean("last", last)) return false; commState.idx++; @@ -282,31 +283,31 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 24: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 25: - if (!commState.putBoolean(null, near)) + if (!commState.putBoolean("near", near)) return false; commState.idx++; case 26: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 27: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 28: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -326,7 +327,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 21: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -339,7 +340,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - last = commState.getBoolean(null); + last = commState.getBoolean("last"); commState.idx++; @@ -373,7 +374,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 24: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -386,7 +387,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - near = commState.getBoolean(null); + near = commState.getBoolean("near"); commState.idx++; @@ -394,12 +395,12 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 8) return false; - topVer = commState.getLong(null); + topVer = commState.getLong("topVer"); commState.idx++; case 27: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -412,7 +413,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(null); + taskNameHash = commState.getInt("taskNameHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java index ea475a9..70719d5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java @@ -255,13 +255,13 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes switch (commState.idx) { case 10: - if (!commState.putCacheVersion(null, dhtVer)) + if (!commState.putCacheVersion("dhtVer", dhtVer)) return false; commState.idx++; case 11: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -294,7 +294,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 13: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; @@ -368,7 +368,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes switch (commState.idx) { case 10: - GridCacheVersion dhtVer0 = commState.getCacheVersion(null); + GridCacheVersion dhtVer0 = commState.getCacheVersion("dhtVer"); if (dhtVer0 == CACHE_VER_NOT_READ) return false; @@ -378,7 +378,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -417,7 +417,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 13: - IgniteUuid miniId0 = commState.getGridUuid(null); + IgniteUuid miniId0 = commState.getGridUuid("miniId"); if (miniId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java index 4318df6..4614513 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java @@ -494,115 +494,115 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen switch (commState.idx) { case 3: - if (!commState.putBoolean(null, all)) + if (!commState.putBoolean("all", all)) return false; commState.idx++; case 4: - if (!commState.putByteArray(null, argsBytes)) + if (!commState.putByteArray("argsBytes", argsBytes)) return false; commState.idx++; case 5: - if (!commState.putString(null, cacheName)) + if (!commState.putString("cacheName", cacheName)) return false; commState.idx++; case 6: - if (!commState.putBoolean(null, cancel)) + if (!commState.putBoolean("cancel", cancel)) return false; commState.idx++; case 7: - if (!commState.putString(null, clause)) + if (!commState.putString("clause", clause)) return false; commState.idx++; case 8: - if (!commState.putString(null, clsName)) + if (!commState.putString("clsName", clsName)) return false; commState.idx++; case 9: - if (!commState.putBoolean(null, fields)) + if (!commState.putBoolean("fields", fields)) return false; commState.idx++; case 10: - if (!commState.putLong(null, id)) + if (!commState.putLong("id", id)) return false; commState.idx++; case 11: - if (!commState.putBoolean(null, incBackups)) + if (!commState.putBoolean("incBackups", incBackups)) return false; commState.idx++; case 12: - if (!commState.putBoolean(null, incMeta)) + if (!commState.putBoolean("incMeta", incMeta)) return false; commState.idx++; case 13: - if (!commState.putByteArray(null, keyValFilterBytes)) + if (!commState.putByteArray("keyValFilterBytes", keyValFilterBytes)) return false; commState.idx++; case 14: - if (!commState.putInt(null, pageSize)) + if (!commState.putInt("pageSize", pageSize)) return false; commState.idx++; case 15: - if (!commState.putByteArray(null, prjFilterBytes)) + if (!commState.putByteArray("prjFilterBytes", prjFilterBytes)) return false; commState.idx++; case 16: - if (!commState.putByteArray(null, rdcBytes)) + if (!commState.putByteArray("rdcBytes", rdcBytes)) return false; commState.idx++; case 17: - if (!commState.putByteArray(null, transBytes)) + if (!commState.putByteArray("transBytes", transBytes)) return false; commState.idx++; case 18: - if (!commState.putEnum(null, type)) + if (!commState.putEnum("type", type)) return false; commState.idx++; case 19: - if (!commState.putBoolean(null, keepPortable)) + if (!commState.putBoolean("keepPortable", keepPortable)) return false; commState.idx++; case 20: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 21: - if (!commState.putInt(null, taskHash)) + if (!commState.putInt("taskHash", taskHash)) return false; commState.idx++; @@ -625,12 +625,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - all = commState.getBoolean(null); + all = commState.getBoolean("all"); commState.idx++; case 4: - byte[] argsBytes0 = commState.getByteArray(null); + byte[] argsBytes0 = commState.getByteArray("argsBytes"); if (argsBytes0 == BYTE_ARR_NOT_READ) return false; @@ -640,7 +640,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 5: - String cacheName0 = commState.getString(null); + String cacheName0 = commState.getString("cacheName"); if (cacheName0 == STR_NOT_READ) return false; @@ -653,12 +653,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - cancel = commState.getBoolean(null); + cancel = commState.getBoolean("cancel"); commState.idx++; case 7: - String clause0 = commState.getString(null); + String clause0 = commState.getString("clause"); if (clause0 == STR_NOT_READ) return false; @@ -668,7 +668,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 8: - String clsName0 = commState.getString(null); + String clsName0 = commState.getString("clsName"); if (clsName0 == STR_NOT_READ) return false; @@ -681,7 +681,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - fields = commState.getBoolean(null); + fields = commState.getBoolean("fields"); commState.idx++; @@ -689,7 +689,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 8) return false; - id = commState.getLong(null); + id = commState.getLong("id"); commState.idx++; @@ -697,7 +697,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - incBackups = commState.getBoolean(null); + incBackups = commState.getBoolean("incBackups"); commState.idx++; @@ -705,12 +705,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - incMeta = commState.getBoolean(null); + incMeta = commState.getBoolean("incMeta"); commState.idx++; case 13: - byte[] keyValFilterBytes0 = commState.getByteArray(null); + byte[] keyValFilterBytes0 = commState.getByteArray("keyValFilterBytes"); if (keyValFilterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -723,12 +723,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 4) return false; - pageSize = commState.getInt(null); + pageSize = commState.getInt("pageSize"); commState.idx++; case 15: - byte[] prjFilterBytes0 = commState.getByteArray(null); + byte[] prjFilterBytes0 = commState.getByteArray("prjFilterBytes"); if (prjFilterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -738,7 +738,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 16: - byte[] rdcBytes0 = commState.getByteArray(null); + byte[] rdcBytes0 = commState.getByteArray("rdcBytes"); if (rdcBytes0 == BYTE_ARR_NOT_READ) return false; @@ -748,7 +748,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen commState.idx++; case 17: - byte[] transBytes0 = commState.getByteArray(null); + byte[] transBytes0 = commState.getByteArray("transBytes"); if (transBytes0 == BYTE_ARR_NOT_READ) return false; @@ -761,7 +761,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - byte type0 = commState.getByte(null); + byte type0 = commState.getByte("type"); type = GridCacheQueryType.fromOrdinal(type0); @@ -771,12 +771,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 1) return false; - keepPortable = commState.getBoolean(null); + keepPortable = commState.getBoolean("keepPortable"); commState.idx++; case 20: - UUID subjId0 = commState.getUuid(null); + UUID subjId0 = commState.getUuid("subjId"); if (subjId0 == UUID_NOT_READ) return false; @@ -789,7 +789,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen if (buf.remaining() < 4) return false; - taskHash = commState.getInt(null); + taskHash = commState.getInt("taskHash"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java index 0254c6d..825a575 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java @@ -264,19 +264,19 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 4: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 5: - if (!commState.putBoolean(null, fields)) + if (!commState.putBoolean("fields", fields)) return false; commState.idx++; case 6: - if (!commState.putBoolean(null, finished)) + if (!commState.putBoolean("finished", finished)) return false; commState.idx++; @@ -309,7 +309,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 8: - if (!commState.putLong(null, reqId)) + if (!commState.putLong("reqId", reqId)) return false; commState.idx++; @@ -358,7 +358,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -371,7 +371,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 1) return false; - fields = commState.getBoolean(null); + fields = commState.getBoolean("fields"); commState.idx++; @@ -379,7 +379,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 1) return false; - finished = commState.getBoolean(null); + finished = commState.getBoolean("finished"); commState.idx++; @@ -416,7 +416,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme if (buf.remaining() < 8) return false; - reqId = commState.getLong(null); + reqId = commState.getLong("reqId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java index f3a61c8..cca184b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java @@ -133,7 +133,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.idx++; case 1: - if (!commState.putClockDeltaVersion(null, snapVer)) + if (!commState.putClockDeltaVersion("snapVer", snapVer)) return false; commState.idx++; @@ -159,7 +159,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd if (commState.readSize >= 0) { if (deltas == null) - deltas = U.newHashMap(commState.readSize); + deltas = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -192,7 +192,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.idx++; case 1: - GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion(null); + GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion("snapVer"); if (snapVer0 == CLOCK_DELTA_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java index e87e972..6f0ef14 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java @@ -106,11 +106,11 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) @Override public GridTcpCommunicationMessageAdapter clone() { - GridContinuousMessage clone = new GridContinuousMessage(); + GridContinuousMessage _clone = new GridContinuousMessage(); - clone0(clone); + clone0(_clone); - return clone; + return _clone; } /** {@inheritDoc} */ @@ -137,19 +137,19 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, dataBytes)) + if (!commState.putByteArray("dataBytes", dataBytes)) return false; commState.idx++; case 1: - if (!commState.putUuid(null, routineId)) + if (!commState.putUuid("routineId", routineId)) return false; commState.idx++; case 2: - if (!commState.putEnum(null, type)) + if (!commState.putEnum("type", type)) return false; commState.idx++; @@ -166,7 +166,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] dataBytes0 = commState.getByteArray(null); + byte[] dataBytes0 = commState.getByteArray("dataBytes"); if (dataBytes0 == BYTE_ARR_NOT_READ) return false; @@ -176,7 +176,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - UUID routineId0 = commState.getUuid(null); + UUID routineId0 = commState.getUuid("routineId"); if (routineId0 == UUID_NOT_READ) return false; @@ -189,7 +189,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - byte type0 = commState.getByte(null); + byte type0 = commState.getByte("type"); type = GridContinuousMessageType.fromOrdinal(type0); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java index 7810633..d7b815e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java @@ -214,37 +214,37 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putString(null, cacheName)) + if (!commState.putString("cacheName", cacheName)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putByteArray(null, colBytes)) + if (!commState.putByteArray("colBytes", colBytes)) return false; commState.idx++; case 3: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; case 4: - if (!commState.putBoolean(null, forceLocDep)) + if (!commState.putBoolean("forceLocDep", forceLocDep)) return false; commState.idx++; case 5: - if (!commState.putBoolean(null, ignoreDepOwnership)) + if (!commState.putBoolean("ignoreDepOwnership", ignoreDepOwnership)) return false; commState.idx++; @@ -288,31 +288,31 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 7: - if (!commState.putLong(null, reqId)) + if (!commState.putLong("reqId", reqId)) return false; commState.idx++; case 8: - if (!commState.putByteArray(null, resTopicBytes)) + if (!commState.putByteArray("resTopicBytes", resTopicBytes)) return false; commState.idx++; case 9: - if (!commState.putString(null, sampleClsName)) + if (!commState.putString("sampleClsName", sampleClsName)) return false; commState.idx++; case 10: - if (!commState.putByteArray(null, updaterBytes)) + if (!commState.putByteArray("updaterBytes", updaterBytes)) return false; commState.idx++; case 11: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -328,7 +328,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - String cacheName0 = commState.getString(null); + String cacheName0 = commState.getString("cacheName"); if (cacheName0 == STR_NOT_READ) return false; @@ -338,7 +338,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -348,7 +348,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 2: - byte[] colBytes0 = commState.getByteArray(null); + byte[] colBytes0 = commState.getByteArray("colBytes"); if (colBytes0 == BYTE_ARR_NOT_READ) return false; @@ -361,7 +361,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -371,7 +371,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(null); + forceLocDep = commState.getBoolean("forceLocDep"); commState.idx++; @@ -379,7 +379,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - ignoreDepOwnership = commState.getBoolean(null); + ignoreDepOwnership = commState.getBoolean("ignoreDepOwnership"); commState.idx++; @@ -393,7 +393,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (commState.readSize >= 0) { if (ldrParticipants == null) - ldrParticipants = U.newHashMap(commState.readSize); + ldrParticipants = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -429,12 +429,12 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - reqId = commState.getLong(null); + reqId = commState.getLong("reqId"); commState.idx++; case 8: - byte[] resTopicBytes0 = commState.getByteArray(null); + byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); if (resTopicBytes0 == BYTE_ARR_NOT_READ) return false; @@ -444,7 +444,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 9: - String sampleClsName0 = commState.getString(null); + String sampleClsName0 = commState.getString("sampleClsName"); if (sampleClsName0 == STR_NOT_READ) return false; @@ -454,7 +454,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 10: - byte[] updaterBytes0 = commState.getByteArray(null); + byte[] updaterBytes0 = commState.getByteArray("updaterBytes"); if (updaterBytes0 == BYTE_ARR_NOT_READ) return false; @@ -464,7 +464,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 11: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java index f726db8..46bab85 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java @@ -107,19 +107,19 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 1: - if (!commState.putBoolean(null, forceLocDep)) + if (!commState.putBoolean("forceLocDep", forceLocDep)) return false; commState.idx++; case 2: - if (!commState.putLong(null, reqId)) + if (!commState.putLong("reqId", reqId)) return false; commState.idx++; @@ -136,7 +136,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -149,7 +149,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(null); + forceLocDep = commState.getBoolean("forceLocDep"); commState.idx++; @@ -157,7 +157,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 8) return false; - reqId = commState.getLong(null); + reqId = commState.getLong("reqId"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java index f01b397..d3cb730 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java @@ -133,19 +133,19 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, fileId)) + if (!commState.putGridUuid("fileId", fileId)) return false; commState.idx++; case 2: - if (!commState.putLong(null, id)) + if (!commState.putLong("id", id)) return false; commState.idx++; @@ -165,7 +165,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -175,7 +175,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid(null); + IgniteUuid fileId0 = commState.getGridUuid("fileId"); if (fileId0 == GRID_UUID_NOT_READ) return false; @@ -188,7 +188,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - id = commState.getLong(null); + id = commState.getLong("id"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java index 563c458..0675e7b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java @@ -184,25 +184,25 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, affKey)) + if (!commState.putGridUuid("affKey", affKey)) return false; commState.idx++; case 1: - if (!commState.putLong(null, blockId)) + if (!commState.putLong("blockId", blockId)) return false; commState.idx++; case 2: - if (!commState.putBoolean(null, evictExclude)) + if (!commState.putBoolean("evictExclude", evictExclude)) return false; commState.idx++; case 3: - if (!commState.putGridUuid(null, fileId)) + if (!commState.putGridUuid("fileId", fileId)) return false; commState.idx++; @@ -219,7 +219,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid(null); + IgniteUuid affKey0 = commState.getGridUuid("affKey"); if (affKey0 == GRID_UUID_NOT_READ) return false; @@ -232,7 +232,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 8) return false; - blockId = commState.getLong(null); + blockId = commState.getLong("blockId"); commState.idx++; @@ -240,12 +240,12 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter if (buf.remaining() < 1) return false; - evictExclude = commState.getBoolean(null); + evictExclude = commState.getBoolean("evictExclude"); commState.idx++; case 3: - IgniteUuid fileId0 = commState.getGridUuid(null); + IgniteUuid fileId0 = commState.getGridUuid("fileId"); if (fileId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java index 2f9ea60..0b169a7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java @@ -152,13 +152,13 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - if (!commState.putGridUuid(null, fileId)) + if (!commState.putGridUuid("fileId", fileId)) return false; commState.idx++; case 2: - if (!commState.putLong(null, id)) + if (!commState.putLong("id", id)) return false; commState.idx++; @@ -187,7 +187,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { if (commState.readSize >= 0) { if (blocks == null) - blocks = U.newHashMap(commState.readSize); + blocks = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -220,7 +220,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid(null); + IgniteUuid fileId0 = commState.getGridUuid("fileId"); if (fileId0 == GRID_UUID_NOT_READ) return false; @@ -233,7 +233,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - id = commState.getLong(null); + id = commState.getLong("id"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java index c913132..e2fedec 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java @@ -136,13 +136,13 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, id)) + if (!commState.putGridUuid("id", id)) return false; commState.idx++; @@ -162,7 +162,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -172,7 +172,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid id0 = commState.getGridUuid(null); + IgniteUuid id0 = commState.getGridUuid("id"); if (id0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java index 46975bb..ce82844 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java @@ -289,31 +289,31 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, affKey)) + if (!commState.putGridUuid("affKey", affKey)) return false; commState.idx++; case 1: - if (!commState.putBoolean(null, done)) + if (!commState.putBoolean("done", done)) return false; commState.idx++; case 2: - if (!commState.putLong(null, endOff)) + if (!commState.putLong("endOff", endOff)) return false; commState.idx++; case 3: - if (!commState.putLong(null, startOff)) + if (!commState.putLong("startOff", startOff)) return false; commState.idx++; case 4: - if (!commState.putInt(null, status)) + if (!commState.putInt("status", status)) return false; commState.idx++; @@ -330,7 +330,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid(null); + IgniteUuid affKey0 = commState.getGridUuid("affKey"); if (affKey0 == GRID_UUID_NOT_READ) return false; @@ -343,7 +343,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 1) return false; - done = commState.getBoolean(null); + done = commState.getBoolean("done"); commState.idx++; @@ -351,7 +351,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - endOff = commState.getLong(null); + endOff = commState.getLong("endOff"); commState.idx++; @@ -359,7 +359,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 8) return false; - startOff = commState.getLong(null); + startOff = commState.getLong("startOff"); commState.idx++; @@ -367,7 +367,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte if (buf.remaining() < 4) return false; - status = commState.getInt(null); + status = commState.getInt("status"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java index 80b4621..b35991b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java @@ -107,7 +107,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, fileId)) + if (!commState.putGridUuid("fileId", fileId)) return false; commState.idx++; @@ -154,7 +154,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid(null); + IgniteUuid fileId0 = commState.getGridUuid("fileId"); if (fileId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java index 9d71c9c..5ea3ae5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java @@ -82,7 +82,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, fileId)) + if (!commState.putGridUuid("fileId", fileId)) return false; commState.idx++; @@ -102,7 +102,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid(null); + IgniteUuid fileId0 = commState.getGridUuid("fileId"); if (fileId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java index 06fbcef..4cbec78 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java @@ -100,13 +100,13 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (!commState.putLong(null, order)) + if (!commState.putLong("order", order)) return false; commState.idx++; case 1: - if (!commState.putBoolean(null, res)) + if (!commState.putBoolean("res", res)) return false; commState.idx++; @@ -129,7 +129,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 8) return false; - order = commState.getLong(null); + order = commState.getLong("order"); commState.idx++; @@ -137,7 +137,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { if (buf.remaining() < 1) return false; - res = commState.getBoolean(null); + res = commState.getBoolean("res"); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index 601428c..df9fd66 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -62,7 +62,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa switch (commState.idx) { case 0: - if (!commState.putByteArray(null, bytes)) + if (!commState.putByteArray("bytes", bytes)) return false; commState.idx++; @@ -78,12 +78,12 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa switch (commState.idx) { case 0: -// byte[] bytes0 = commState.getByteArray(null, GridClientHandshakeRequest.PACKET_SIZE); -// -// if (bytes0 == BYTE_ARR_NOT_READ) -// return false; -// -// bytes = bytes0; + byte[] bytes0 = commState.getByteArray("bytes"); + + if (bytes0 == BYTE_ARR_NOT_READ) + return false; + + bytes = bytes0; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index c77964b..bf3ee7c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -49,6 +49,15 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess commState.typeWritten = true; } + switch (commState.idx) { + case 0: + if (!commState.putByte("code", code)) + return false; + + commState.idx++; + + } + return true; } @@ -56,6 +65,17 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess @Override public boolean readFrom(ByteBuffer buf) { commState.setBuffer(buf); + switch (commState.idx) { + case 0: + if (buf.remaining() < 1) + return false; + + code = commState.getByte("code"); + + commState.idx++; + + } + return true; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java index 4779afb..128c657 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java @@ -133,32 +133,32 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putInt(null, msgSize)) + if (!commState.putUuid("clientId", clientId)) return false; commState.idx++; case 1: - if (!commState.putLong(null, reqId)) + if (!commState.putUuid("destId", destId)) return false; commState.idx++; case 2: - if (!commState.putUuid(null, clientId)) + if (!commState.putByteBuffer("msg", msg)) return false; commState.idx++; case 3: - if (!commState.putUuid(null, destId)) + if (!commState.putInt("msgSize", msgSize)) return false; commState.idx++; case 4: -// if (!commState.putByteBuffer(null, msg)) -// return false; + if (!commState.putLong("reqId", reqId)) + return false; commState.idx++; @@ -173,53 +173,51 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (buf.remaining() < 4) - return false; + UUID clientId0 = commState.getUuid("clientId"); - msgSize = commState.getInt(null); + if (clientId0 == UUID_NOT_READ) + return false; - if (msgSize == 0) // Ping message. - return true; + clientId = clientId0; commState.idx++; case 1: - if (buf.remaining() < 8) + UUID destId0 = commState.getUuid("destId"); + + if (destId0 == UUID_NOT_READ) return false; - reqId = commState.getLong(null); + destId = destId0; commState.idx++; case 2: - UUID clientId0 = commState.getUuid(null); + ByteBuffer msg0 = commState.getByteBuffer("msg"); - if (clientId0 == UUID_NOT_READ) + if (msg0 == BYTE_BUF_NOT_READ) return false; - clientId = clientId0; + msg = msg0; commState.idx++; case 3: - UUID destId0 = commState.getUuid(null); - - if (destId0 == UUID_NOT_READ) + if (buf.remaining() < 4) return false; - destId = destId0; + msgSize = commState.getInt("msgSize"); commState.idx++; case 4: -// byte[] msg0 = commState.getByteArray(null, msgSize - 40); -// -// if (msg0 == BYTE_ARR_NOT_READ) -// return false; -// -// msg = ByteBuffer.wrap(msg0); -// -// commState.idx++; + if (buf.remaining() < 8) + return false; + + reqId = commState.getLong("reqId"); + + commState.idx++; + } return true; @@ -244,8 +242,8 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { GridClientMessageWrapper _clone = (GridClientMessageWrapper)_msg; - _clone.reqId = reqId; _clone.msgSize = msgSize; + _clone.reqId = reqId; _clone.clientId = clientId; _clone.destId = destId; _clone.msg = msg; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java index b719531..ea1da3d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -37,7 +37,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - if (!commState.putInt(null, size)) + if (!commState.putInt("size", size)) return false; commState.idx++; @@ -49,7 +49,20 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - throw new UnsupportedOperationException(); + commState.setBuffer(buf); + + switch (commState.idx) { + case 0: + if (buf.remaining() < 4) + return false; + + size = commState.getInt("size"); + + commState.idx++; + + } + + return true; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java index 2b66ef6..1894d03 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -123,13 +123,13 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, taskId)) + if (!commState.putGridUuid("taskId", taskId)) return false; commState.idx++; case 1: - if (!commState.putByteArray(null, topicBytes)) + if (!commState.putByteArray("topicBytes", topicBytes)) return false; commState.idx++; @@ -146,7 +146,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid taskId0 = commState.getGridUuid(null); + IgniteUuid taskId0 = commState.getGridUuid("taskId"); if (taskId0 == GRID_UUID_NOT_READ) return false; @@ -156,7 +156,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray(null); + byte[] topicBytes0 = commState.getByteArray("topicBytes"); if (topicBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java index ad9e42f..6d30432 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -143,25 +143,25 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putString(null, err)) + if (!commState.putString("err", err)) return false; commState.idx++; case 1: - if (!commState.putBoolean(null, finished)) + if (!commState.putBoolean("finished", finished)) return false; commState.idx++; case 2: - if (!commState.putBoolean(null, found)) + if (!commState.putBoolean("found", found)) return false; commState.idx++; case 3: - if (!commState.putByteArray(null, resBytes)) + if (!commState.putByteArray("resBytes", resBytes)) return false; commState.idx++; @@ -178,7 +178,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String err0 = commState.getString(null); + String err0 = commState.getString("err"); if (err0 == STR_NOT_READ) return false; @@ -191,7 +191,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - finished = commState.getBoolean(null); + finished = commState.getBoolean("finished"); commState.idx++; @@ -199,12 +199,12 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { if (buf.remaining() < 1) return false; - found = commState.getBoolean(null); + found = commState.getBoolean("found"); commState.idx++; case 3: - byte[] resBytes0 = commState.getByteArray(null); + byte[] resBytes0 = commState.getByteArray("resBytes"); if (resBytes0 == BYTE_ARR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 077aa93..4aebe54 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -66,7 +66,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - if (!commState.putByteArray(null, bytes)) + if (!commState.putByteArray("bytes", bytes)) return false; commState.idx++; @@ -78,7 +78,22 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - throw new UnsupportedOperationException(); + commState.setBuffer(buf); + + switch (commState.idx) { + case 0: + byte[] bytes0 = commState.getByteArray("bytes"); + + if (bytes0 == BYTE_ARR_NOT_READ) + return false; + + bytes = bytes0; + + commState.idx++; + + } + + return true; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java index cc56dc8..358b7a4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java @@ -77,7 +77,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - if (!commState.putGridUuid(null, cancelledFutId)) + if (!commState.putGridUuid("cancelledFutId", cancelledFutId)) return false; commState.idx++; @@ -94,7 +94,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid cancelledFutId0 = commState.getGridUuid(null); + IgniteUuid cancelledFutId0 = commState.getGridUuid("cancelledFutId"); if (cancelledFutId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java index 39c8cf2..be546c6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java @@ -178,25 +178,25 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda switch (commState.idx) { case 0: - if (!commState.putByteArray(null, batchBytes)) + if (!commState.putByteArray("batchBytes", batchBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, clsLdrId)) + if (!commState.putGridUuid("clsLdrId", clsLdrId)) return false; commState.idx++; case 2: - if (!commState.putEnum(null, depMode)) + if (!commState.putEnum("depMode", depMode)) return false; commState.idx++; case 3: - if (!commState.putBoolean(null, forceLocDep)) + if (!commState.putBoolean("forceLocDep", forceLocDep)) return false; commState.idx++; @@ -240,13 +240,13 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 5: - if (!commState.putString(null, sampleClsName)) + if (!commState.putString("sampleClsName", sampleClsName)) return false; commState.idx++; case 6: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -263,7 +263,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda switch (commState.idx) { case 0: - byte[] batchBytes0 = commState.getByteArray(null); + byte[] batchBytes0 = commState.getByteArray("batchBytes"); if (batchBytes0 == BYTE_ARR_NOT_READ) return false; @@ -273,7 +273,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid(null); + IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); if (clsLdrId0 == GRID_UUID_NOT_READ) return false; @@ -286,7 +286,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (buf.remaining() < 1) return false; - byte depMode0 = commState.getByte(null); + byte depMode0 = commState.getByte("depMode"); depMode = IgniteDeploymentMode.fromOrdinal(depMode0); @@ -296,7 +296,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (buf.remaining() < 1) return false; - forceLocDep = commState.getBoolean(null); + forceLocDep = commState.getBoolean("forceLocDep"); commState.idx++; @@ -310,7 +310,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (commState.readSize >= 0) { if (ldrParticipants == null) - ldrParticipants = U.newHashMap(commState.readSize); + ldrParticipants = new HashMap<>(commState.readSize, 1.0f); for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { @@ -343,7 +343,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 5: - String sampleClsName0 = commState.getString(null); + String sampleClsName0 = commState.getString("sampleClsName"); if (sampleClsName0 == STR_NOT_READ) return false; @@ -353,7 +353,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 6: - String userVer0 = commState.getString(null); + String userVer0 = commState.getString("userVer"); if (userVer0 == STR_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java index fc3cfcb..bfaeb09 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java @@ -98,13 +98,13 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (!commState.putByteArray(null, errBytes)) + if (!commState.putByteArray("errBytes", errBytes)) return false; commState.idx++; case 1: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -121,7 +121,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray(null); + byte[] errBytes0 = commState.getByteArray("errBytes"); if (errBytes0 == BYTE_ARR_NOT_READ) return false; @@ -131,7 +131,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid futId0 = commState.getGridUuid(null); + IgniteUuid futId0 = commState.getGridUuid("futId"); if (futId0 == GRID_UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index 0a3f856..1fa6a8d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -265,6 +265,9 @@ public class GridTcpCommunicationMessageState { writer.writeByteArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -311,6 +314,9 @@ public class GridTcpCommunicationMessageState { writer.writeShortArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -357,6 +363,9 @@ public class GridTcpCommunicationMessageState { writer.writeIntArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -403,6 +412,9 @@ public class GridTcpCommunicationMessageState { writer.writeLongArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -449,6 +461,9 @@ public class GridTcpCommunicationMessageState { writer.writeFloatArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -495,6 +510,9 @@ public class GridTcpCommunicationMessageState { writer.writeDoubleArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -541,6 +559,9 @@ public class GridTcpCommunicationMessageState { writer.writeCharArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -587,6 +608,9 @@ public class GridTcpCommunicationMessageState { writer.writeBooleanArray(name, arr); + if (arr == null) + return true; + hdrDone = true; } else @@ -1055,6 +1079,9 @@ public class GridTcpCommunicationMessageState { writer.writeObject(name, msg); + if (msg == null) + return true; + hdrDone = true; } else -- 1.9.3 (Apple Git-50) From e9f8b57a15ef12a464a6e4a1ea850b1640d4a84a Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 22 Dec 2014 17:07:04 -0800 Subject: [PATCH 09/71] Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61 Conflicts: modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java --- .../distributed/dht/GridDhtTxFinishRequest.java | 58 +++++++++++----------- .../distributed/dht/GridDhtTxPrepareRequest.java | 56 ++++++++++----------- .../distributed/near/GridNearTxFinishRequest.java | 26 +++++----- .../distributed/near/GridNearTxPrepareRequest.java | 40 +++++++-------- 4 files changed, 90 insertions(+), 90 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index ec091d3..8efd398 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -318,7 +318,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -326,19 +326,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest switch (commState.idx) { case 21: - if (!commState.putEnum(isolation)) + if (!commState.putEnum(null, isolation)) return false; commState.idx++; case 22: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 23: - if (!commState.putUuid(nearNodeId)) + if (!commState.putUuid(null, nearNodeId)) return false; commState.idx++; @@ -346,7 +346,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 24: if (nearWritesBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearWritesBytes.size())) + if (!commState.putInt(null, nearWritesBytes.size())) return false; commState.it = nearWritesBytes.iterator(); @@ -356,7 +356,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -364,14 +364,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 25: - if (!commState.putBoolean(onePhaseCommit)) + if (!commState.putBoolean(null, onePhaseCommit)) return false; commState.idx++; @@ -379,7 +379,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 26: if (pendingVers != null) { if (commState.it == null) { - if (!commState.putInt(pendingVers.size())) + if (!commState.putInt(null, pendingVers.size())) return false; commState.it = pendingVers.iterator(); @@ -389,7 +389,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -397,38 +397,38 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 27: - if (!commState.putBoolean(sysInvalidate)) + if (!commState.putBoolean(null, sysInvalidate)) return false; commState.idx++; case 28: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 29: - if (!commState.putCacheVersion(writeVer)) + if (!commState.putCacheVersion(null, writeVer)) return false; commState.idx++; case 30: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 31: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -451,14 +451,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - byte isolation0 = commState.getByte(); + byte isolation0 = commState.getByte(null); isolation = IgniteTxIsolation.fromOrdinal(isolation0); commState.idx++; case 22: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -468,7 +468,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 23: - UUID nearNodeId0 = commState.getUuid(); + UUID nearNodeId0 = commState.getUuid(null); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -482,7 +482,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -490,7 +490,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest nearWritesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -510,7 +510,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - onePhaseCommit = commState.getBoolean(); + onePhaseCommit = commState.getBoolean(null); commState.idx++; @@ -519,7 +519,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -527,7 +527,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest pendingVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -547,7 +547,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 1) return false; - sysInvalidate = commState.getBoolean(); + sysInvalidate = commState.getBoolean(null); commState.idx++; @@ -555,12 +555,12 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 29: - GridCacheVersion writeVer0 = commState.getCacheVersion(); + GridCacheVersion writeVer0 = commState.getCacheVersion(null); if (writeVer0 == CACHE_VER_NOT_READ) return false; @@ -570,7 +570,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 30: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -583,7 +583,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java index ed01977..4f5b01b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java @@ -346,7 +346,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -354,31 +354,31 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 22: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 23: - if (!commState.putBitSet(invalidateNearEntries)) + if (!commState.putBitSet(null, invalidateNearEntries)) return false; commState.idx++; case 24: - if (!commState.putBoolean(last)) + if (!commState.putBoolean(null, last)) return false; commState.idx++; case 25: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 26: - if (!commState.putUuid(nearNodeId)) + if (!commState.putUuid(null, nearNodeId)) return false; commState.idx++; @@ -386,7 +386,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque case 27: if (nearWritesBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearWritesBytes.size())) + if (!commState.putInt(null, nearWritesBytes.size())) return false; commState.it = nearWritesBytes.iterator(); @@ -396,7 +396,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -404,44 +404,44 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 28: - if (!commState.putCacheVersion(nearXidVer)) + if (!commState.putCacheVersion(null, nearXidVer)) return false; commState.idx++; case 29: - if (!commState.putByteArray(ownedBytes)) + if (!commState.putByteArray(null, ownedBytes)) return false; commState.idx++; case 30: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 31: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 32: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; case 33: - if (!commState.putBitSet(preloadKeys)) + if (!commState.putBitSet(null, preloadKeys)) return false; commState.idx++; @@ -461,7 +461,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 22: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -471,7 +471,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 23: - BitSet invalidateNearEntries0 = commState.getBitSet(); + BitSet invalidateNearEntries0 = commState.getBitSet(null); if (invalidateNearEntries0 == BIT_SET_NOT_READ) return false; @@ -484,12 +484,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 1) return false; - last = commState.getBoolean(); + last = commState.getBoolean(null); commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -499,7 +499,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 26: - UUID nearNodeId0 = commState.getUuid(); + UUID nearNodeId0 = commState.getUuid(null); if (nearNodeId0 == UUID_NOT_READ) return false; @@ -513,7 +513,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -521,7 +521,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque nearWritesBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -538,7 +538,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 28: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); if (nearXidVer0 == CACHE_VER_NOT_READ) return false; @@ -548,7 +548,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 29: - byte[] ownedBytes0 = commState.getByteArray(); + byte[] ownedBytes0 = commState.getByteArray(null); if (ownedBytes0 == BYTE_ARR_NOT_READ) return false; @@ -561,12 +561,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 31: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -579,12 +579,12 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; case 33: - BitSet preloadKeys0 = commState.getBitSet(); + BitSet preloadKeys0 = commState.getBitSet(null); if (preloadKeys0 == BIT_SET_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java index b7b274f..0a58739 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java @@ -185,7 +185,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -193,37 +193,37 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques switch (commState.idx) { case 21: - if (!commState.putBoolean(explicitLock)) + if (!commState.putBoolean(null, explicitLock)) return false; commState.idx++; case 22: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 23: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 24: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 25: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; case 26: - if (!commState.putBoolean(storeEnabled)) + if (!commState.putBoolean(null, storeEnabled)) return false; commState.idx++; @@ -245,12 +245,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 1) return false; - explicitLock = commState.getBoolean(); + explicitLock = commState.getBoolean(null); commState.idx++; case 22: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -263,12 +263,12 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 24: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -281,7 +281,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; @@ -289,7 +289,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques if (buf.remaining() < 1) return false; - storeEnabled = commState.getBoolean(); + storeEnabled = commState.getBoolean(null); commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java index 46e1b8a..7eb57a6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java @@ -236,7 +236,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -244,13 +244,13 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 22: - if (!commState.putGridUuid(futId)) + if (!commState.putGridUuid(null, futId)) return false; commState.idx++; case 23: - if (!commState.putBoolean(last)) + if (!commState.putBoolean(null, last)) return false; commState.idx++; @@ -258,7 +258,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ case 24: if (lastBackups != null) { if (commState.it == null) { - if (!commState.putInt(lastBackups.size())) + if (!commState.putInt(null, lastBackups.size())) return false; commState.it = lastBackups.iterator(); @@ -268,7 +268,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putUuid((UUID)commState.cur)) + if (!commState.putUuid(null, (UUID)commState.cur)) return false; commState.cur = NULL; @@ -276,38 +276,38 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 25: - if (!commState.putGridUuid(miniId)) + if (!commState.putGridUuid(null, miniId)) return false; commState.idx++; case 26: - if (!commState.putBoolean(near)) + if (!commState.putBoolean(null, near)) return false; commState.idx++; case 27: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 28: - if (!commState.putUuid(subjId)) + if (!commState.putUuid(null, subjId)) return false; commState.idx++; case 29: - if (!commState.putInt(taskNameHash)) + if (!commState.putInt(null, taskNameHash)) return false; commState.idx++; @@ -327,7 +327,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 22: - IgniteUuid futId0 = commState.getGridUuid(); + IgniteUuid futId0 = commState.getGridUuid(null); if (futId0 == GRID_UUID_NOT_READ) return false; @@ -340,7 +340,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - last = commState.getBoolean(); + last = commState.getBoolean(null); commState.idx++; @@ -349,7 +349,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -357,7 +357,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ lastBackups = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(); + UUID _val = commState.getUuid(null); if (_val == UUID_NOT_READ) return false; @@ -374,7 +374,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(); + IgniteUuid miniId0 = commState.getGridUuid(null); if (miniId0 == GRID_UUID_NOT_READ) return false; @@ -387,7 +387,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 1) return false; - near = commState.getBoolean(); + near = commState.getBoolean(null); commState.idx++; @@ -395,12 +395,12 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; case 28: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; @@ -413,7 +413,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ if (buf.remaining() < 4) return false; - taskNameHash = commState.getInt(); + taskNameHash = commState.getInt(null); commState.idx++; -- 1.9.3 (Apple Git-50) From 7f91a904a112864cdcd5f04d17f3b0d0016b30ec Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 22 Dec 2014 17:33:08 -0800 Subject: [PATCH 10/71] # Fixed compilation --- .../processors/cache/distributed/GridDistributedTxFinishRequest.java | 4 ++-- .../processors/cache/distributed/GridDistributedTxPrepareRequest.java | 4 ++-- .../kernal/processors/cache/distributed/near/GridNearLockRequest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java index c478b6e..147001c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -500,7 +500,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 20: - if (!commState.putBoolean(sys)) + if (!commState.putBoolean("sys", sys)) return false; commState.idx++; @@ -668,7 +668,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes if (buf.remaining() < 1) return false; - sys = commState.getBoolean(); + sys = commState.getBoolean("sys"); commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareRequest.java index 840383a..1cc7219 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareRequest.java @@ -567,7 +567,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; case 21: - if (!commState.putBoolean(sys)) + if (!commState.putBoolean("sys", sys)) return false; commState.idx++; @@ -747,7 +747,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe if (buf.remaining() < 1) return false; - sys = commState.getBoolean(); + sys = commState.getBoolean("sys"); commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java index eb4ca88..d0086ba 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java @@ -452,7 +452,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; case 34: - if (!commState.putBoolean(syncCommit)) + if (!commState.putBoolean("syncCommit", syncCommit)) return false; commState.idx++; @@ -600,7 +600,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest if (buf.remaining() < 1) return false; - syncCommit = commState.getBoolean(); + syncCommit = commState.getBoolean("syncCommit"); commState.idx++; } -- 1.9.3 (Apple Git-50) From b0297259be3209414899e1f8749fa634a52db5c4 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 26 Dec 2014 17:07:06 -0800 Subject: [PATCH 11/71] IGNITE-61 - Portable format in direct marshalling --- .../org/apache/ignite/plugin/PluginProvider.java | 2 - .../extensions/communication/MessageFactory.java | 23 + .../extensions/communication/MessageReader.java | 58 ++ .../communication/MessageReaderFactory.java | 17 + .../extensions/communication/MessageWriter.java | 56 ++ .../communication/MessageWriterFactory.java | 17 + .../org/apache/ignite/spi/IgniteSpiAdapter.java | 5 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 4 +- .../java/org/gridgain/grid/kernal/GridKernal.java | 2 +- .../gridgain/grid/kernal/GridKernalContext.java | 14 +- .../grid/kernal/GridKernalContextImpl.java | 70 -- .../gridgain/grid/kernal/GridPluginContext.java | 2 +- .../grid/kernal/managers/GridManagerAdapter.java | 9 +- .../managers/communication/GridIoManager.java | 110 ++++ .../processors/plugin/IgnitePluginProcessor.java | 4 +- .../GridTcpCommunicationByteBufferStream.java | 679 +++++++++++++++++++ .../direct/GridTcpCommunicationMessageAdapter.java | 105 +-- .../direct/GridTcpCommunicationMessageFactory.java | 2 +- .../direct/GridTcpCommunicationMessageReader.java | 232 +++++++ .../direct/GridTcpCommunicationMessageState.java | 534 +++------------ .../direct/GridTcpCommunicationMessageWriter.java | 261 ++++++++ .../direct/GridTcpCommunicationPortableReader.java | 207 ------ .../direct/GridTcpCommunicationPortableStream.java | 722 --------------------- .../direct/GridTcpCommunicationPortableWriter.java | 223 ------- .../grid/util/direct/GridTcpMessageFactory.java | 21 - .../gridgain/grid/util/nio/GridDirectParser.java | 3 +- .../gridgain/testframework/GridSpiTestContext.java | 5 +- 27 files changed, 1572 insertions(+), 1815 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java create mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpMessageFactory.java diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java index 33280dc..9a01511 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java @@ -38,8 +38,6 @@ public interface PluginProvider { public T plugin(); /** - * TODO remove. - * * @param cls Ignite component class. * @return Ignite component or {@code null} if component is not supported. */ diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java new file mode 100644 index 0000000..d8d74f6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java @@ -0,0 +1,23 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.plugin.extensions.communication; + +import org.gridgain.grid.util.direct.*; + +/** + * + */ +public interface MessageFactory { + /** + * @param type Message type. + * @return Message instance. + */ + public GridTcpCommunicationMessageAdapter create(byte type); +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java new file mode 100644 index 0000000..dc2bee8 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -0,0 +1,58 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.plugin.extensions.communication; + +import org.apache.ignite.plugin.*; +import org.gridgain.grid.util.direct.*; + +import java.nio.*; + +/** + * TODO + */ +public interface MessageReader extends IgniteExtension { + public void setBuffer(ByteBuffer buf); + + public byte readByte(String name); + + public short readShort(String name); + + public int readInt(String name); + + public long readLong(String name); + + public float readFloat(String name); + + public double readDouble(String name); + + public char readChar(String name); + + public boolean readBoolean(String name); + + public byte[] readByteArray(String name); + + public short[] readShortArray(String name); + + public int[] readIntArray(String name); + + public long[] readLongArray(String name); + + public float[] readFloatArray(String name); + + public double[] readDoubleArray(String name); + + public char[] readCharArray(String name); + + public boolean[] readBooleanArray(String name); + + public GridTcpCommunicationMessageAdapter readMessage(String name); + + public boolean isLastRead(); +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java new file mode 100644 index 0000000..51e51a9 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java @@ -0,0 +1,17 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.plugin.extensions.communication; + +/** + * TODO + */ +public interface MessageReaderFactory { + public MessageReader reader(); +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java new file mode 100644 index 0000000..ce0b249 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -0,0 +1,56 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.plugin.extensions.communication; + +import org.apache.ignite.plugin.*; +import org.gridgain.grid.util.direct.*; + +import java.nio.*; + +/** + * TODO + */ +public interface MessageWriter extends IgniteExtension { + public void setBuffer(ByteBuffer buf); + + public boolean writeByte(String name, byte val); + + public boolean writeShort(String name, short val); + + public boolean writeInt(String name, int val); + + public boolean writeLong(String name, long val); + + public boolean writeFloat(String name, float val); + + public boolean writeDouble(String name, double val); + + public boolean writeChar(String name, char val); + + public boolean writeBoolean(String name, boolean val); + + public boolean writeByteArray(String name, byte[] val); + + public boolean writeShortArray(String name, short[] val); + + public boolean writeIntArray(String name, int[] val); + + public boolean writeLongArray(String name, long[] val); + + public boolean writeFloatArray(String name, float[] val); + + public boolean writeDoubleArray(String name, double[] val); + + public boolean writeCharArray(String name, char[] val); + + public boolean writeBooleanArray(String name, boolean[] val); + + public boolean writeMessage(String name, GridTcpCommunicationMessageAdapter val); +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java new file mode 100644 index 0000000..613f312 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java @@ -0,0 +1,17 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.plugin.extensions.communication; + +/** + * TODO + */ +public interface MessageWriterFactory { + public MessageWriter writer(); +} diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java index 508e81e..8c9354f 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java @@ -12,16 +12,15 @@ package org.apache.ignite.spi; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.authentication.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.*; import org.gridgain.grid.kernal.managers.communication.*; import org.gridgain.grid.kernal.managers.eventstorage.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.securesession.*; import org.apache.ignite.spi.swapspace.*; -import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -725,7 +724,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement } /** {@inheritDoc} */ - @Override public GridTcpMessageFactory messageFactory() { + @Override public MessageFactory messageFactory() { return null; } } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java index 69ba6fd..e4c239a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java @@ -12,11 +12,11 @@ package org.apache.ignite.spi; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.swapspace.*; import org.gridgain.grid.kernal.managers.communication.*; import org.gridgain.grid.kernal.managers.eventstorage.*; -import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import java.io.*; @@ -391,5 +391,5 @@ public interface IgniteSpiContext { /** * @return Message factory. */ - public GridTcpMessageFactory messageFactory(); + public MessageFactory messageFactory(); } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java index 5359353..04f52ca 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java @@ -752,7 +752,7 @@ public class GridKernal extends ClusterGroupAdapter implements GridEx, IgniteMBe provider.start(ctx.plugins().pluginContextForProvider(provider), attrs); } - ctx.createMessageFactory(); + ctx.io().initMessageFactory(); if (ctx.isEnterprise()) { security = new GridSecurityImpl(ctx); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java index e1b9d92..03cf112 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java @@ -14,7 +14,6 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.plugin.*; import org.apache.ignite.product.*; import org.gridgain.grid.*; -import org.gridgain.grid.kernal.managers.security.*; import org.gridgain.grid.kernal.managers.checkpoint.*; import org.gridgain.grid.kernal.managers.collision.*; import org.gridgain.grid.kernal.managers.communication.*; @@ -25,6 +24,7 @@ import org.gridgain.grid.kernal.managers.failover.*; import org.gridgain.grid.kernal.managers.indexing.*; import org.gridgain.grid.kernal.managers.loadbalancer.*; import org.gridgain.grid.kernal.managers.securesession.*; +import org.gridgain.grid.kernal.managers.security.*; import org.gridgain.grid.kernal.managers.swapspace.*; import org.gridgain.grid.kernal.processors.affinity.*; import org.gridgain.grid.kernal.processors.cache.*; @@ -53,7 +53,6 @@ import org.gridgain.grid.kernal.processors.session.*; import org.gridgain.grid.kernal.processors.streamer.*; import org.gridgain.grid.kernal.processors.task.*; import org.gridgain.grid.kernal.processors.timeout.*; -import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.tostring.*; import java.util.*; @@ -494,15 +493,4 @@ public interface GridKernalContext extends GridMetadataAware, Iterable T createComponent(Class cls); - - /** - * @return Message factory. - */ - public GridTcpMessageFactory messageFactory(); - - /** - * @param producer Message producer. - * @return Message type code. - */ - public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer); } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java index b6f4ac8..5ed40bd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java @@ -13,7 +13,6 @@ import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.plugin.*; import org.apache.ignite.product.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.managers.checkpoint.*; import org.gridgain.grid.kernal.managers.collision.*; import org.gridgain.grid.kernal.managers.communication.*; @@ -56,7 +55,6 @@ import org.gridgain.grid.kernal.processors.spring.*; import org.gridgain.grid.kernal.processors.streamer.*; import org.gridgain.grid.kernal.processors.task.*; import org.gridgain.grid.kernal.processors.timeout.*; -import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.tostring.*; import org.gridgain.grid.util.typedef.*; @@ -287,15 +285,6 @@ public class GridKernalContextImpl extends GridMetadataAwareAdapter implements G /** Enterprise release flag. */ private boolean ent; - /** */ - private GridTcpMessageFactory msgFactory; - - /** */ - private int pluginMsg = GridTcpCommunicationMessageFactory.MAX_COMMON_TYPE; - - /** */ - private Map pluginMsgs; - /** * No-arg constructor is required by externalization. */ @@ -799,65 +788,6 @@ public class GridKernalContextImpl extends GridMetadataAwareAdapter implements G throw new IgniteException("Unsupported component type: " + cls); } - /** {@inheritDoc} */ - @Override public GridTcpMessageFactory messageFactory() { - assert msgFactory != null; - - return msgFactory; - } - - /** {@inheritDoc} */ - @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) { - int nextMsg = ++pluginMsg; - - if (nextMsg > Byte.MAX_VALUE) - throw new IgniteException(); - - if (pluginMsgs == null) - pluginMsgs = new HashMap<>(); - - pluginMsgs.put((byte)nextMsg, producer); - - return (byte)nextMsg; - } - - /** - * Creates message factory. - */ - void createMessageFactory() { - final GridTcpCommunicationMessageProducer[] common = GridTcpCommunicationMessageFactory.commonProducers(); - - final GridTcpCommunicationMessageProducer[] producers; - - if (pluginMsgs != null) { - producers = Arrays.copyOf(common, pluginMsg + 1); - - for (Map.Entry e : pluginMsgs.entrySet()) { - assert producers[e.getKey()] == null : e.getKey(); - - producers[e.getKey()] = e.getValue(); - } - - pluginMsgs = null; - } - else - producers = common; - - msgFactory = new GridTcpMessageFactory() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { - if (type < 0 || type >= producers.length) - return GridTcpCommunicationMessageFactory.create(type); - - GridTcpCommunicationMessageProducer producer = producers[type]; - - if (producer != null) - return producer.create(type); - else - throw new IllegalStateException("Common message type producer is not registered: " + type); - } - }; - } - /** * @return Plugin manager. */ diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridPluginContext.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridPluginContext.java index 19d875c..01d0397 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridPluginContext.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridPluginContext.java @@ -88,6 +88,6 @@ public class GridPluginContext implements PluginContext { /** {@inheritDoc} */ @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) { - return ctx.registerMessageProducer(producer); + return ctx.io().registerMessageProducer(producer); } } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/GridManagerAdapter.java index 8a8bc0e..b8b6a75 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/GridManagerAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/GridManagerAdapter.java @@ -14,15 +14,14 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; +import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.*; -import org.gridgain.grid.*; +import org.apache.ignite.spi.swapspace.*; import org.gridgain.grid.cache.*; import org.gridgain.grid.kernal.*; import org.gridgain.grid.kernal.managers.communication.*; import org.gridgain.grid.kernal.managers.eventstorage.*; import org.gridgain.grid.kernal.processors.cache.*; -import org.apache.ignite.plugin.security.*; -import org.apache.ignite.spi.swapspace.*; import org.gridgain.grid.util.direct.*; import org.gridgain.grid.util.tostring.*; import org.gridgain.grid.util.typedef.*; @@ -503,8 +502,8 @@ public abstract class GridManagerAdapter implements GridMan return e != null ? (V)e.value() : null; } - @Override public GridTcpMessageFactory messageFactory() { - return ctx.messageFactory(); + @Override public MessageFactory messageFactory() { + return ctx.io().messageFactory(); } /** diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoManager.java index 52cd53d..7c11a92 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoManager.java @@ -14,6 +14,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.*; import org.gridgain.grid.*; @@ -136,6 +137,21 @@ public class GridIoManager extends GridManagerAdapter pluginMsgs; + + /** */ + private MessageFactory msgFactory; + + /** */ + private MessageWriterFactory writerFactory; + + /** */ + private MessageReaderFactory readerFactory; + /** * @param ctx Grid kernal context. */ @@ -151,6 +167,74 @@ public class GridIoManager extends GridManagerAdapter Byte.MAX_VALUE) + throw new IgniteException(); + + if (pluginMsgs == null) + pluginMsgs = new HashMap<>(); + + pluginMsgs.put((byte)nextMsg, producer); + + return (byte)nextMsg; + } + + /** + * Initializes manager (called prior to discovery start, but after all other components). + */ + public void initMessageFactory() { + final GridTcpCommunicationMessageProducer[] common = GridTcpCommunicationMessageFactory.commonProducers(); + + final GridTcpCommunicationMessageProducer[] producers; + + if (pluginMsgs != null) { + producers = Arrays.copyOf(common, pluginMsg + 1); + + for (Map.Entry e : pluginMsgs.entrySet()) { + assert producers[e.getKey()] == null : e.getKey(); + + producers[e.getKey()] = e.getValue(); + } + + pluginMsgs = null; + } + else + producers = common; + + msgFactory = new MessageFactory() { + @Override public GridTcpCommunicationMessageAdapter create(byte type) { + GridTcpCommunicationMessageAdapter msg; + + if (type < 0 || type >= producers.length) + msg = GridTcpCommunicationMessageFactory.create(type); + else { + GridTcpCommunicationMessageProducer producer = producers[type]; + + if (producer == null) + throw new IllegalStateException("Common message type producer is not registered: " + type); + + msg = producer.create(type); + } + + msg.setReader(readerFactory.reader()); + + return msg; + } + }; + } + + public MessageFactory messageFactory() { + assert msgFactory != null; + + return msgFactory; + } + + /** * Resets metrics for this manager. */ public void resetMetrics() { @@ -189,6 +273,30 @@ public class GridIoManager extends GridManagerAdapter 0) + writerFactory = writerExt[0]; + else { + writerFactory = new MessageWriterFactory() { + @Override public MessageWriter writer() { + return new GridTcpCommunicationMessageWriter(); + } + }; + } + + MessageReaderFactory[] readerExt = ctx.plugins().extensions(MessageReaderFactory.class); + + if (readerExt != null && readerExt.length > 0) + readerFactory = readerExt[0]; + else { + readerFactory = new MessageReaderFactory() { + @Override public MessageReader reader() { + return new GridTcpCommunicationMessageReader(msgFactory); + } + }; + } + if (log.isDebugEnabled()) log.debug(startInfo()); } @@ -892,6 +1000,8 @@ public class GridIoManager extends GridManagerAdapter ctr = + Constructor ctr = pluginCfg.providerClass().getConstructor(PluginContext.class); provider = ctr.newInstance(pluginCtx); } catch (NoSuchMethodException ignore) { try { - Constructor ctr = + Constructor ctr = pluginCfg.providerClass().getConstructor(pluginCfg.getClass()); provider = ctr.newInstance(pluginCfg); diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java new file mode 100644 index 0000000..0de1ea3 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -0,0 +1,679 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.apache.ignite.plugin.extensions.communication.*; +import org.gridgain.grid.util.*; +import org.jetbrains.annotations.*; +import sun.misc.*; +import sun.nio.ch.*; + +import java.nio.*; + +/** + * Portable stream based on {@link ByteBuffer}. + */ +public class GridTcpCommunicationByteBufferStream { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** */ + private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); + + /** */ + private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); + + /** */ + private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); + + /** */ + private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); + + /** */ + private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); + + /** */ + private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); + + /** */ + private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); + + /** */ + private static final byte[] BYTE_ARR_EMPTY = new byte[0]; + + /** */ + private static final short[] SHORT_ARR_EMPTY = new short[0]; + + /** */ + private static final int[] INT_ARR_EMPTY = new int[0]; + + /** */ + private static final long[] LONG_ARR_EMPTY = new long[0]; + + /** */ + private static final float[] FLOAT_ARR_EMPTY = new float[0]; + + /** */ + private static final double[] DOUBLE_ARR_EMPTY = new double[0]; + + /** */ + private static final char[] CHAR_ARR_EMPTY = new char[0]; + + /** */ + private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; + + /** */ + private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { + @Override public byte[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return BYTE_ARR_EMPTY; + + default: + return new byte[len]; + } + } + }; + + /** */ + private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { + @Override public short[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return SHORT_ARR_EMPTY; + + default: + return new short[len]; + } + } + }; + + /** */ + private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { + @Override public int[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return INT_ARR_EMPTY; + + default: + return new int[len]; + } + } + }; + + /** */ + private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { + @Override public long[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return LONG_ARR_EMPTY; + + default: + return new long[len]; + } + } + }; + + /** */ + private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { + @Override public float[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return FLOAT_ARR_EMPTY; + + default: + return new float[len]; + } + } + }; + + /** */ + private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { + @Override public double[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return DOUBLE_ARR_EMPTY; + + default: + return new double[len]; + } + } + }; + + /** */ + private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { + @Override public char[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return CHAR_ARR_EMPTY; + + default: + return new char[len]; + } + } + }; + + /** */ + private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { + @Override public boolean[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return BOOLEAN_ARR_EMPTY; + + default: + return new boolean[len]; + } + } + }; + + /** */ + private final MessageFactory msgFactory; + + /** */ + private ByteBuffer buf; + + /** */ + private byte[] heapArr; + + /** */ + private long baseOff; + + /** */ + private int arrOff; + + /** */ + private Object tmpArr; + + /** */ + private int tmpArrOff; + + /** */ + private int tmpArrBytes; + + /** */ + private boolean msgTypeDone; + + /** */ + private GridTcpCommunicationMessageAdapter msg; + + /** */ + private boolean lastFinished; + + /** + * @param msgFactory Message factory. + */ + public GridTcpCommunicationByteBufferStream(@Nullable MessageFactory msgFactory) { + this.msgFactory = msgFactory; + } + + /** + * @param buf Buffer. + */ + public void setBuffer(ByteBuffer buf) { + assert buf != null; + + if (this.buf != buf) { + this.buf = buf; + + heapArr = buf.isDirect() ? null : buf.array(); + baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; + } + } + + public int remaining() { + return buf.remaining(); + } + + /** + * @return Whether last object was fully written or read. + */ + public boolean lastFinished() { + return lastFinished; + } + + /** {@inheritDoc} */ + public void writeByte(byte val) { + int pos = buf.position(); + + UNSAFE.putByte(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + public void writeByteArray(byte[] val) { + assert val != null; + + lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length); + } + + /** {@inheritDoc} */ + public void writeBoolean(boolean val) { + int pos = buf.position(); + + UNSAFE.putBoolean(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + + /** {@inheritDoc} */ + public void writeBooleanArray(boolean[] val) { + assert val != null; + + lastFinished = writeArray(val, BOOLEAN_ARR_OFF, val.length, val.length); + } + + /** {@inheritDoc} */ + public void writeShort(short val) { + int pos = buf.position(); + + UNSAFE.putShort(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + public void writeShortArray(short[] val) { + assert val != null; + + lastFinished = writeArray(val, SHORT_ARR_OFF, val.length, val.length << 1); + } + + /** {@inheritDoc} */ + public void writeChar(char val) { + int pos = buf.position(); + + UNSAFE.putChar(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + + /** {@inheritDoc} */ + public void writeCharArray(char[] val) { + assert val != null; + + lastFinished = writeArray(val, CHAR_ARR_OFF, val.length, val.length << 1); + } + + /** {@inheritDoc} */ + public void writeInt(int val) { + int pos = buf.position(); + + UNSAFE.putInt(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + public void writeIntArray(int[] val) { + assert val != null; + + lastFinished = writeArray(val, INT_ARR_OFF, val.length, val.length << 2); + } + + /** {@inheritDoc} */ + public void writeFloat(float val) { + int pos = buf.position(); + + UNSAFE.putFloat(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + + /** {@inheritDoc} */ + public void writeFloatArray(float[] val) { + assert val != null; + + lastFinished = writeArray(val, FLOAT_ARR_OFF, val.length, val.length << 2); + } + + /** {@inheritDoc} */ + public void writeLong(long val) { + int pos = buf.position(); + + UNSAFE.putLong(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + public void writeLongArray(long[] val) { + assert val != null; + + lastFinished = writeArray(val, LONG_ARR_OFF, val.length, val.length << 3); + } + + /** {@inheritDoc} */ + public void writeDouble(double val) { + int pos = buf.position(); + + UNSAFE.putDouble(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + + /** {@inheritDoc} */ + public void writeDoubleArray(double[] val) { + assert val != null; + + lastFinished = writeArray(val, DOUBLE_ARR_OFF, val.length, val.length << 3); + } + + /** + * @param msg Message. + */ + public void writeMessage(GridTcpCommunicationMessageAdapter msg) { + assert msg != null; + + lastFinished = msg.writeTo(buf); + } + + /** {@inheritDoc} */ + public byte readByte() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getByte(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public byte[] readByteArray() { + return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF); + } + + /** {@inheritDoc} */ + public boolean readBoolean() { + assert buf.hasRemaining(); + + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getBoolean(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public boolean[] readBooleanArray() { + return readArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF); + } + + /** {@inheritDoc} */ + public short readShort() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getShort(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public short[] readShortArray() { + return readArray(SHORT_ARR_CREATOR, 1, SHORT_ARR_OFF); + } + + /** {@inheritDoc} */ + public char readChar() { + assert buf.remaining() >= 2; + + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getChar(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public char[] readCharArray() { + return readArray(CHAR_ARR_CREATOR, 1, CHAR_ARR_OFF); + } + + /** {@inheritDoc} */ + public int readInt() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getInt(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public int[] readIntArray() { + return readArray(INT_ARR_CREATOR, 2, INT_ARR_OFF); + } + + /** {@inheritDoc} */ + public float readFloat() { + assert buf.remaining() >= 4; + + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getFloat(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public float[] readFloatArray() { + return readArray(FLOAT_ARR_CREATOR, 2, FLOAT_ARR_OFF); + } + + /** {@inheritDoc} */ + public long readLong() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getLong(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public long[] readLongArray() { + return readArray(LONG_ARR_CREATOR, 3, LONG_ARR_OFF); + } + + /** {@inheritDoc} */ + public double readDouble() { + assert buf.remaining() >= 8; + + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getDouble(heapArr, baseOff + pos); + } + + /** {@inheritDoc} */ + public double[] readDoubleArray() { + return readArray(DOUBLE_ARR_CREATOR, 3, DOUBLE_ARR_OFF); + } + + /** + * @return Message. + */ + public GridTcpCommunicationMessageAdapter readMessage() { + if (!msgTypeDone) { + if (!buf.hasRemaining()) + return null; + + byte type = readByte(); + + msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type); + + msgTypeDone = true; + } + + if (msg == null || msg.readFrom(buf)) { + GridTcpCommunicationMessageAdapter msg0 = msg; + + msgTypeDone = false; + msg = null; + + return msg0; + } + else + return null; + } + + /** + * @param arr Array. + * @param off Offset. + * @param len Length. + * @param bytes Length in bytes. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int len, int bytes) { + assert arr != null; + assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); + assert off > 0; + assert len >= 0; + assert bytes >= 0; + assert bytes >= arrOff; + + if (arrOff == 0) { + if (remaining() < 4) + return false; + + writeInt(len); + } + + int toWrite = bytes - arrOff; + int pos = buf.position(); + int remaining = buf.remaining(); + + if (toWrite <= remaining) { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); + + pos += toWrite; + + buf.position(pos); + + arrOff = 0; + + return true; + } + else { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); + + pos += remaining; + + buf.position(pos); + + arrOff += remaining; + + return false; + } + } + + /** + * @param creator Array creator. + * @param lenShift Array length shift size. + * @param off Base offset. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int lenShift, long off) { + assert creator != null; + + if (tmpArr == null) { + if (remaining() < 4) { + lastFinished = false; + + return null; + } + + int len = readInt(); + + switch (len) { + case -1: + lastFinished = true; + + return null; + + case 0: + lastFinished = true; + + return creator.create(0); + + default: + tmpArr = creator.create(len); + tmpArrBytes = len << lenShift; + } + } + + int toRead = tmpArrBytes - tmpArrOff; + int remaining = buf.remaining(); + int pos = buf.position(); + + if (remaining < toRead) { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); + + buf.position(pos + remaining); + + tmpArrOff += remaining; + + lastFinished = false; + + return null; + } + else { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); + + buf.position(pos + toRead); + + T arr = (T)tmpArr; + + tmpArr = null; + tmpArrBytes = 0; + tmpArrOff = 0; + + lastFinished = true; + + return arr; + } + } + + /** + * Array creator. + */ + private static interface ArrayCreator { + /** + * @param len Array length or {@code -1} if array was not fully read. + * @return New array. + */ + public T create(int len); + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java index 7f5d97c..108425c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java @@ -9,18 +9,12 @@ package org.gridgain.grid.util.direct; -import org.apache.ignite.lang.*; -import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; -import org.gridgain.grid.kernal.processors.clock.*; -import org.gridgain.grid.util.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; import java.util.*; -import static org.apache.ignite.events.IgniteEventType.*; - /** * Communication message adapter. */ @@ -29,93 +23,28 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable private static final long serialVersionUID = 0L; /** */ - public static final byte[] BYTE_ARR_NOT_READ = new byte[0]; - - /** */ - public static final short[] SHORT_ARR_NOT_READ = new short[0]; - - /** */ - public static final int[] INT_ARR_NOT_READ = new int[0]; - - /** */ - public static final long[] LONG_ARR_NOT_READ = new long[0]; - - /** */ - public static final float[] FLOAT_ARR_NOT_READ = new float[0]; - - /** */ - public static final double[] DOUBLE_ARR_NOT_READ = new double[0]; - - /** */ - public static final char[] CHAR_ARR_NOT_READ = new char[0]; - - /** */ - public static final boolean[] BOOLEAN_ARR_NOT_READ = new boolean[0]; - - /** */ - public static final UUID UUID_NOT_READ = new UUID(0, 0); - - /** */ - public static final ByteBuffer BYTE_BUF_NOT_READ = ByteBuffer.allocate(0); - - /** */ - public static final IgniteUuid GRID_UUID_NOT_READ = new IgniteUuid(new UUID(0, 0), 0); - - /** */ - public static final GridClockDeltaVersion CLOCK_DELTA_VER_NOT_READ = new GridClockDeltaVersion(0, 0); - - /** */ - public static final GridByteArrayList BYTE_ARR_LIST_NOT_READ = new GridByteArrayList(new byte[0]); - - /** */ - public static final GridLongList LONG_LIST_NOT_READ = new GridLongList(0); - - /** */ - public static final GridCacheVersion CACHE_VER_NOT_READ = new GridCacheVersion(0, 0, 0, 0); - - /** */ - public static final GridDhtPartitionExchangeId DHT_PART_EXCHANGE_ID_NOT_READ = - new GridDhtPartitionExchangeId(new UUID(0, 0), EVT_NODE_LEFT, 1); - - /** */ - public static final GridCacheValueBytes VAL_BYTES_NOT_READ = new GridCacheValueBytes(); - - /** */ - @SuppressWarnings("RedundantStringConstructorCall") - public static final String STR_NOT_READ = new String(); - - /** */ - public static final BitSet BIT_SET_NOT_READ = new BitSet(); + protected static final Object NULL = new Object(); /** */ - public static final GridTcpCommunicationMessageAdapter MSG_NOT_READ = new GridTcpCommunicationMessageAdapter() { - @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { - throw new UnsupportedOperationException(); - } - - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { - throw new UnsupportedOperationException(); - } - - @Override public boolean writeTo(ByteBuffer buf) { - throw new UnsupportedOperationException(); - } + protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); - @Override public boolean readFrom(ByteBuffer buf) { - throw new UnsupportedOperationException(); - } + /** + * @param writer Writer. + */ + public final void setWriter(MessageWriter writer) { + assert writer != null; - @Override public byte directType() { - throw new UnsupportedOperationException(); - } - }; + commState.setWriter(writer); + } - /** */ - protected static final Object NULL = new Object(); + /** + * @param reader Reader. + */ + public final void setReader(MessageReader reader) { + assert reader != null; - /** */ - protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); + commState.setReader(reader); + } /** * @param buf Byte buffer. diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java index 7c92065..653c622 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java @@ -323,7 +323,7 @@ public class GridTcpCommunicationMessageFactory { */ public static void registerCommon(GridTcpCommunicationMessageProducer producer, int... types) { for (int type : types) { - assert type >= 0 && type < COMMON.length : "Commmon type being registered is out of common messages " + + assert type >= 0 && type < COMMON.length : "Common type being registered is out of common messages " + "array length: " + type; COMMON[type] = producer; diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java new file mode 100644 index 0000000..1645fb5 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java @@ -0,0 +1,232 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.apache.ignite.plugin.extensions.communication.*; +import org.jetbrains.annotations.*; + +import java.nio.*; + +/** + * Portable reader implementation. + */ +public class GridTcpCommunicationMessageReader implements MessageReader { + /** Stream. */ + private final GridTcpCommunicationByteBufferStream stream; + + /** Whether last field was fully read. */ + private boolean lastRead; + + /** + * @param msgFactory Message factory. + */ + public GridTcpCommunicationMessageReader(MessageFactory msgFactory) { + this.stream = new GridTcpCommunicationByteBufferStream(msgFactory); + } + + /** {@inheritDoc} */ + @Override public void setBuffer(ByteBuffer buf) { + stream.setBuffer(buf); + } + + /** {@inheritDoc} */ + @Override public byte readByte(String name) { + if (stream.remaining() < 1) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readByte(); + } + } + + /** {@inheritDoc} */ + @Override public short readShort(String name) { + if (stream.remaining() < 2) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readShort(); + } + } + + /** {@inheritDoc} */ + @Override public int readInt(String name) { + if (stream.remaining() < 4) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readInt(); + } + } + + /** {@inheritDoc} */ + @Override public long readLong(String name) { + if (stream.remaining() < 8) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readLong(); + } + } + + /** {@inheritDoc} */ + @Override public float readFloat(String name) { + if (stream.remaining() < 4) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readFloat(); + } + } + + /** {@inheritDoc} */ + @Override public double readDouble(String name) { + if (stream.remaining() < 8) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readDouble(); + } + } + + /** {@inheritDoc} */ + @Override public char readChar(String name) { + if (stream.remaining() < 2) { + lastRead = false; + + return 0; + } + else { + lastRead = true; + + return stream.readChar(); + } + } + + /** {@inheritDoc} */ + @Override public boolean readBoolean(String name) { + if (stream.remaining() < 1) { + lastRead = false; + + return false; + } + else { + lastRead = true; + + return stream.readBoolean(); + } + } + + /** {@inheritDoc} */ + @Nullable @Override public byte[] readByteArray(String name) { + byte[] arr = stream.readByteArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public short[] readShortArray(String name) { + short[] arr = stream.readShortArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public int[] readIntArray(String name) { + int[] arr = stream.readIntArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public long[] readLongArray(String name) { + long[] arr = stream.readLongArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public float[] readFloatArray(String name) { + float[] arr = stream.readFloatArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public double[] readDoubleArray(String name) { + double[] arr = stream.readDoubleArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public char[] readCharArray(String name) { + char[] arr = stream.readCharArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public boolean[] readBooleanArray(String name) { + boolean[] arr = stream.readBooleanArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public GridTcpCommunicationMessageAdapter readMessage(String name) { + return stream.readMessage(); + } + + /** {@inheritDoc} */ + @Override public boolean isLastRead() { + return lastRead; + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index 1fa6a8d..6f6cf81 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -10,7 +10,7 @@ package org.gridgain.grid.util.direct; import org.apache.ignite.lang.*; -import org.apache.ignite.portables.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; import org.gridgain.grid.kernal.processors.clock.*; @@ -35,19 +35,10 @@ public class GridTcpCommunicationMessageState { private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); /** */ - private static final int FIELD_HDR_LEN = 0; + private MessageWriter writer; /** */ - private final GridTcpCommunicationPortableStream stream = new GridTcpCommunicationPortableStream(); - - /** */ - private final PortableWriter writer = new GridTcpCommunicationPortableWriter(stream); - - /** */ - private final PortableReader reader = new GridTcpCommunicationPortableReader(stream); - - /** */ - private boolean hdrDone; + private MessageReader reader; /** */ public int idx; @@ -71,10 +62,30 @@ public class GridTcpCommunicationMessageState { public int readItems; /** + * @param writer Writer. + */ + public final void setWriter(MessageWriter writer) { + if (this.writer == null) + this.writer = writer; + } + + /** + * @param reader Reader. + */ + public final void setReader(MessageReader reader) { + if (this.reader == null) + this.reader = reader; + } + + /** * @param buf Buffer. */ public final void setBuffer(ByteBuffer buf) { - stream.setBuffer(buf); + if (writer != null) + writer.setBuffer(buf); + + if (reader != null) + reader.setBuffer(buf); } /** @@ -83,12 +94,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putByte(String name, byte b) { - if (stream.remaining() < FIELD_HDR_LEN + 1) - return false; - - writer.writeByte(name, b); - - return true; + return writer.writeByte(name, b); } /** @@ -105,12 +111,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putShort(String name, short s) { - if (stream.remaining() < FIELD_HDR_LEN + 2) - return false; - - writer.writeShort(name, s); - - return true; + return writer.writeShort(name, s); } /** @@ -127,12 +128,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putInt(String name, int i) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeInt(name, i); - - return true; + return writer.writeInt(name, i); } /** @@ -149,12 +145,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putLong(String name, long l) { - if (stream.remaining() < FIELD_HDR_LEN + 8) - return false; - - writer.writeLong(name, l); - - return true; + return writer.writeLong(name, l); } /** @@ -171,12 +162,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putFloat(String name, float f) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeFloat(name, f); - - return true; + return writer.writeFloat(name, f); } /** @@ -193,12 +179,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putDouble(String name, double d) { - if (stream.remaining() < FIELD_HDR_LEN + 8) - return false; - - writer.writeDouble(name, d); - - return true; + return writer.writeDouble(name, d); } /** @@ -215,12 +196,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putChar(String name, char c) { - if (stream.remaining() < FIELD_HDR_LEN + 2) - return false; - - writer.writeChar(name, c); - - return true; + return writer.writeChar(name, c); } /** @@ -237,12 +213,7 @@ public class GridTcpCommunicationMessageState { * @return Whether value was written. */ public final boolean putBoolean(String name, boolean b) { - if (stream.remaining() < FIELD_HDR_LEN + 1) - return false; - - writer.writeBoolean(name, b); - - return true; + return writer.writeBoolean(name, b); } /** @@ -259,47 +230,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putByteArray(String name, @Nullable byte[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeByteArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeByteArray(arr); - - return lastWritten(); + return writer.writeByteArray(name, arr); } /** * @param name Field name. - * @return Byte array or special - * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_NOT_READ} - * value if it was not fully read. + * @return Byte array. */ public final byte[] getByteArray(String name) { - byte[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return BYTE_ARR_NOT_READ; - - arr = reader.readByteArray(name); - - hdrDone = true; - } - else - arr = stream.readByteArray(-1); - - if (arr != BYTE_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readByteArray(name); } /** @@ -308,47 +247,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putShortArray(String name, short[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeShortArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeShortArray(arr); - - return lastWritten(); + return writer.writeShortArray(name, arr); } /** * @param name Field name. - * @return Short array or special - * {@link GridTcpCommunicationMessageAdapter#SHORT_ARR_NOT_READ} - * value if it was not fully read. + * @return Short array. */ public final short[] getShortArray(String name) { - short[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return SHORT_ARR_NOT_READ; - - arr = reader.readShortArray(name); - - hdrDone = true; - } - else - arr = stream.readShortArray(-1); - - if (arr != SHORT_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readShortArray(name); } /** @@ -357,47 +264,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putIntArray(String name, int[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeIntArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeIntArray(arr); - - return lastWritten(); + return writer.writeIntArray(name, arr); } /** * @param name Field name. - * @return Integer array or special - * {@link GridTcpCommunicationMessageAdapter#INT_ARR_NOT_READ} - * value if it was not fully read. + * @return Integer array. */ public final int[] getIntArray(String name) { - int[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return INT_ARR_NOT_READ; - - arr = reader.readIntArray(name); - - hdrDone = true; - } - else - arr = stream.readIntArray(-1); - - if (arr != INT_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readIntArray(name); } /** @@ -406,47 +281,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putLongArray(String name, long[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeLongArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeLongArray(arr); - - return lastWritten(); + return writer.writeLongArray(name, arr); } /** * @param name Field name. - * @return Long array or special - * {@link GridTcpCommunicationMessageAdapter#LONG_ARR_NOT_READ} - * value if it was not fully read. + * @return Long array. */ public final long[] getLongArray(String name) { - long[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return LONG_ARR_NOT_READ; - - arr = reader.readLongArray(name); - - hdrDone = true; - } - else - arr = stream.readLongArray(-1); - - if (arr != LONG_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readLongArray(name); } /** @@ -455,47 +298,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putFloatArray(String name, float[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeFloatArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeFloatArray(arr); - - return lastWritten(); + return writer.writeFloatArray(name, arr); } /** * @param name Field name. - * @return Float array or special - * {@link GridTcpCommunicationMessageAdapter#FLOAT_ARR_NOT_READ} - * value if it was not fully read. + * @return Float array. */ public final float[] getFloatArray(String name) { - float[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return FLOAT_ARR_NOT_READ; - - arr = reader.readFloatArray(name); - - hdrDone = true; - } - else - arr = stream.readFloatArray(-1); - - if (arr != FLOAT_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readFloatArray(name); } /** @@ -504,47 +315,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putDoubleArray(String name, double[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeDoubleArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeDoubleArray(arr); - - return lastWritten(); + return writer.writeDoubleArray(name, arr); } /** * @param name Field name. - * @return Double array or special - * {@link GridTcpCommunicationMessageAdapter#DOUBLE_ARR_NOT_READ} - * value if it was not fully read. + * @return Double array. */ public final double[] getDoubleArray(String name) { - double[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return DOUBLE_ARR_NOT_READ; - - arr = reader.readDoubleArray(name); - - hdrDone = true; - } - else - arr = stream.readDoubleArray(-1); - - if (arr != DOUBLE_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readDoubleArray(name); } /** @@ -553,47 +332,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putCharArray(String name, char[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeCharArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeCharArray(arr); - - return lastWritten(); + return writer.writeCharArray(name, arr); } /** * @param name Field name. - * @return Char array or special - * {@link GridTcpCommunicationMessageAdapter#CHAR_ARR_NOT_READ} - * value if it was not fully read. + * @return Char array. */ public final char[] getCharArray(String name) { - char[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return CHAR_ARR_NOT_READ; - - arr = reader.readCharArray(name); - - hdrDone = true; - } - else - arr = stream.readCharArray(-1); - - if (arr != CHAR_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readCharArray(name); } /** @@ -602,47 +349,15 @@ public class GridTcpCommunicationMessageState { * @return Whether array was fully written. */ public final boolean putBooleanArray(String name, boolean[] arr) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return false; - - writer.writeBooleanArray(name, arr); - - if (arr == null) - return true; - - hdrDone = true; - } - else - stream.writeBooleanArray(arr); - - return lastWritten(); + return writer.writeBooleanArray(name, arr); } /** * @param name Field name. - * @return Boolean array or special - * {@link GridTcpCommunicationMessageAdapter#BOOLEAN_ARR_NOT_READ} - * value if it was not fully read. + * @return Boolean array. */ public final boolean[] getBooleanArray(String name) { - boolean[] arr; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 4) - return BOOLEAN_ARR_NOT_READ; - - arr = reader.readBooleanArray(name); - - hdrDone = true; - } - else - arr = stream.readBooleanArray(-1); - - if (arr != BOOLEAN_ARR_NOT_READ) - hdrDone = false; - - return arr; + return reader.readBooleanArray(name); } /** @@ -668,16 +383,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link ByteBuffer} or special - * {@link GridTcpCommunicationMessageAdapter#BYTE_BUF_NOT_READ} - * value if it was not fully read. + * @return {@link ByteBuffer}. */ public final ByteBuffer getByteBuffer(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return BYTE_BUF_NOT_READ; - else if (arr == null) + if (arr == null) return null; else return ByteBuffer.wrap(arr); @@ -703,16 +414,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link UUID} or special - * {@link GridTcpCommunicationMessageAdapter#UUID_NOT_READ} - * value if it was not fully read. + * @return {@link UUID}. */ public final UUID getUuid(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return UUID_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); @@ -743,16 +450,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link org.apache.ignite.lang.IgniteUuid} or special - * {@link GridTcpCommunicationMessageAdapter#GRID_UUID_NOT_READ} - * value if it was not fully read. + * @return {@link IgniteUuid}. */ public final IgniteUuid getGridUuid(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return GRID_UUID_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); @@ -783,16 +486,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridClockDeltaVersion} or special - * {@link GridTcpCommunicationMessageAdapter#CLOCK_DELTA_VER_NOT_READ} - * value if it was not fully read. + * @return {@link GridClockDeltaVersion}. */ public final GridClockDeltaVersion getClockDeltaVersion(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return CLOCK_DELTA_VER_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); @@ -813,17 +512,13 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridByteArrayList} or special - * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_LIST_NOT_READ} - * value if it was not fully read. + * @return {@link GridByteArrayList}. */ @SuppressWarnings("IfMayBeConditional") public final GridByteArrayList getByteArrayList(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return BYTE_ARR_LIST_NOT_READ; - else if (arr == null) + if (arr == null) return null; else return new GridByteArrayList(arr); @@ -840,17 +535,13 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridLongList} or special - * {@link GridTcpCommunicationMessageAdapter#LONG_LIST_NOT_READ} - * value if it was not fully read. + * @return {@link GridLongList}. */ @SuppressWarnings("IfMayBeConditional") public final GridLongList getLongList(String name) { long[] arr = getLongArray(name); - if (arr == LONG_ARR_NOT_READ) - return LONG_LIST_NOT_READ; - else if (arr == null) + if (arr == null) return null; else return new GridLongList(arr); @@ -878,16 +569,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridCacheVersion} or special - * {@link GridTcpCommunicationMessageAdapter#CACHE_VER_NOT_READ} - * value if it was not fully read. + * @return {@link GridCacheVersion}. */ public final GridCacheVersion getCacheVersion(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return CACHE_VER_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); @@ -921,16 +608,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridDhtPartitionExchangeId} or special - * {@link GridTcpCommunicationMessageAdapter#DHT_PART_EXCHANGE_ID_NOT_READ} - * value if it was not fully read. + * @return {@link GridDhtPartitionExchangeId}. */ public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return DHT_PART_EXCHANGE_ID_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); @@ -974,16 +657,12 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link GridCacheValueBytes} or special - * {@link GridTcpCommunicationMessageAdapter#VAL_BYTES_NOT_READ} - * value if it was not fully read. + * @return {@link GridCacheValueBytes}. */ public final GridCacheValueBytes getValueBytes(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return VAL_BYTES_NOT_READ; - else if (arr == null) + if (arr == null) return null; else { boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); @@ -1017,16 +696,13 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link String} or special {@link GridTcpCommunicationMessageAdapter#STR_NOT_READ} - * value if it was not fully read. + * @return {@link String}. */ @SuppressWarnings("IfMayBeConditional") public final String getString(String name) { byte[] arr = getByteArray(name); - if (arr == BYTE_ARR_NOT_READ) - return STR_NOT_READ; - else if (arr == null) + if (arr == null) return null; else return new String(arr); @@ -1043,16 +719,13 @@ public class GridTcpCommunicationMessageState { /** * @param name Field name. - * @return {@link BitSet} or special {@link GridTcpCommunicationMessageAdapter#BIT_SET_NOT_READ} - * value if it was not fully read. + * @return {@link BitSet}. */ @SuppressWarnings("IfMayBeConditional") public final BitSet getBitSet(String name) { long[] arr = getLongArray(name); - if (arr == LONG_ARR_NOT_READ) - return BIT_SET_NOT_READ; - else if (arr == null) + if (arr == null) return null; else return BitSet.valueOf(arr); @@ -1073,58 +746,17 @@ public class GridTcpCommunicationMessageState { * @return Whether value was fully written. */ public final boolean putMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN + 1) - return false; - - writer.writeObject(name, msg); - - if (msg == null) - return true; - - hdrDone = true; - } - else - stream.writeMessage(msg); + if (msg != null) + msg.setWriter(writer); - return lastWritten(); + return writer.writeMessage(name, msg); } /** * @param name Field name. - * @return {@link GridTcpCommunicationMessageAdapter} or special - * {@link GridTcpCommunicationMessageAdapter#MSG_NOT_READ} - * value if it was not fully read. + * @return {@link GridTcpCommunicationMessageAdapter}. */ public final GridTcpCommunicationMessageAdapter getMessage(String name) { - GridTcpCommunicationMessageAdapter msg; - - if (!hdrDone) { - if (stream.remaining() < FIELD_HDR_LEN) - return MSG_NOT_READ; - - msg = reader.readObject(name); - - hdrDone = true; - } - else - msg = stream.readMessage(); - - if (msg != MSG_NOT_READ) - hdrDone = false; - - return msg; - } - - /** - * @return Whether last array was fully written. - */ - private boolean lastWritten() { - boolean written = stream.lastWritten(); - - if (written) - hdrDone = false; - - return written; + return reader.readMessage(name); } } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java new file mode 100644 index 0000000..101015c --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java @@ -0,0 +1,261 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.util.direct; + +import org.apache.ignite.plugin.extensions.communication.*; +import org.jetbrains.annotations.*; + +import java.nio.*; + +/** + * Portable writer implementation. + */ +public class GridTcpCommunicationMessageWriter implements MessageWriter { + /** Stream. */ + private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + + /** {@inheritDoc} */ + @Override public void setBuffer(ByteBuffer buf) { + stream.setBuffer(buf); + } + + /** {@inheritDoc} */ + @Override public boolean writeByte(String name, byte val) { + if (stream.remaining() < 1) + return false; + + stream.writeByte(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeShort(String name, short val) { + if (stream.remaining() < 2) + return false; + + stream.writeShort(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeInt(String name, int val) { + if (stream.remaining() < 4) + return false; + + stream.writeInt(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeLong(String name, long val) { + if (stream.remaining() < 8) + return false; + + stream.writeLong(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeFloat(String name, float val) { + if (stream.remaining() < 4) + return false; + + stream.writeFloat(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeDouble(String name, double val) { + if (stream.remaining() < 8) + return false; + + stream.writeDouble(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeChar(String name, char val) { + if (stream.remaining() < 2) + return false; + + stream.writeChar(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeBoolean(String name, boolean val) { + if (stream.remaining() < 1) + return false; + + stream.writeBoolean(val); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean writeByteArray(String name, @Nullable byte[] val) { + if (val != null) { + stream.writeByteArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeShortArray(String name, @Nullable short[] val) { + if (val != null) { + stream.writeShortArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeIntArray(String name, @Nullable int[] val) { + if (val != null) { + stream.writeIntArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeLongArray(String name, @Nullable long[] val) { + if (val != null) { + stream.writeLongArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeFloatArray(String name, @Nullable float[] val) { + if (val != null) { + stream.writeFloatArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeDoubleArray(String name, @Nullable double[] val) { + if (val != null) { + stream.writeDoubleArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeCharArray(String name, @Nullable char[] val) { + if (val != null) { + stream.writeCharArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeBooleanArray(String name, @Nullable boolean[] val) { + if (val != null) { + stream.writeBooleanArray(val); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 4) + return false; + + stream.writeInt(-1); + + return true; + } + } + + /** {@inheritDoc} */ + @Override public boolean writeMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { + if (msg != null) { + stream.writeMessage(msg); + + return stream.lastFinished(); + } + else { + if (stream.remaining() < 1) + return false; + + stream.writeByte(Byte.MIN_VALUE); + + return true; + } + } +} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java deleted file mode 100644 index d4b6e2d..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableReader.java +++ /dev/null @@ -1,207 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.apache.ignite.portables.*; -import org.jetbrains.annotations.*; - -import java.math.*; -import java.sql.*; -import java.util.*; -import java.util.Date; - -/** - * Portable reader implementation. - */ -public class GridTcpCommunicationPortableReader implements PortableReader { - /** Stream. */ - private final GridTcpCommunicationPortableStream stream; - - /** - * @param stream Stream. - */ - public GridTcpCommunicationPortableReader(GridTcpCommunicationPortableStream stream) { - this.stream = stream; - } - - /** {@inheritDoc} */ - @Override public byte readByte(String fieldName) throws PortableException { - return stream.readByte(); - } - - /** {@inheritDoc} */ - @Override public short readShort(String fieldName) throws PortableException { - return stream.readShort(); - } - - /** {@inheritDoc} */ - @Override public int readInt(String fieldName) throws PortableException { - return stream.readInt(); - } - - /** {@inheritDoc} */ - @Override public long readLong(String fieldName) throws PortableException { - return stream.readLong(); - } - - /** {@inheritDoc} */ - @Override public float readFloat(String fieldName) throws PortableException { - return stream.readFloat(); - } - - /** {@inheritDoc} */ - @Override public double readDouble(String fieldName) throws PortableException { - return stream.readDouble(); - } - - /** {@inheritDoc} */ - @Override public char readChar(String fieldName) throws PortableException { - return stream.readChar(); - } - - /** {@inheritDoc} */ - @Override public boolean readBoolean(String fieldName) throws PortableException { - return stream.readBoolean(); - } - - /** {@inheritDoc} */ - @Nullable @Override public byte[] readByteArray(String fieldName) throws PortableException { - return stream.readByteArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public short[] readShortArray(String fieldName) throws PortableException { - return stream.readShortArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public int[] readIntArray(String fieldName) throws PortableException { - return stream.readIntArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public long[] readLongArray(String fieldName) throws PortableException { - return stream.readLongArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public float[] readFloatArray(String fieldName) throws PortableException { - return stream.readFloatArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public double[] readDoubleArray(String fieldName) throws PortableException { - return stream.readDoubleArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public char[] readCharArray(String fieldName) throws PortableException { - return stream.readCharArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public boolean[] readBooleanArray(String fieldName) throws PortableException { - return stream.readBooleanArray(stream.readInt()); - } - - /** {@inheritDoc} */ - @Nullable @Override public T readObject(String fieldName) throws PortableException { - return (T)stream.readMessage(); - } - - /** {@inheritDoc} */ - @Nullable @Override public BigDecimal readDecimal(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public String readString(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public UUID readUuid(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Date readDate(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Timestamp readTimestamp(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public BigDecimal[] readDecimalArray(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public String[] readStringArray(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public UUID[] readUuidArray(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Date[] readDateArray(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Object[] readObjectArray(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Collection readCollection(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Collection readCollection(String fieldName, Class> colCls) - throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Map readMap(String fieldName) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public Map readMap(String fieldName, Class> mapCls) - throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public > T readEnum(String fieldName, Class enumCls) - throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Nullable @Override public > T[] readEnumArray(String fieldName, Class enumCls) - throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public PortableRawReader rawReader() { - throw new UnsupportedOperationException(); - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java deleted file mode 100644 index 3ec27df..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableStream.java +++ /dev/null @@ -1,722 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.gridgain.grid.kernal.processors.portable.*; -import org.gridgain.grid.util.*; -import sun.misc.*; -import sun.nio.ch.*; - -import java.nio.*; - -import static org.gridgain.grid.util.direct.GridTcpCommunicationMessageAdapter.*; - -/** - * Portable stream based on {@link ByteBuffer}. - */ -public class GridTcpCommunicationPortableStream implements GridPortableOutputStream, GridPortableInputStream { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** */ - private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); - - /** */ - private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); - - /** */ - private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); - - /** */ - private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); - - /** */ - private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); - - /** */ - private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); - - /** */ - private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); - - /** */ - private static final byte[] BYTE_ARR_EMPTY = new byte[0]; - - /** */ - private static final short[] SHORT_ARR_EMPTY = new short[0]; - - /** */ - private static final int[] INT_ARR_EMPTY = new int[0]; - - /** */ - private static final long[] LONG_ARR_EMPTY = new long[0]; - - /** */ - private static final float[] FLOAT_ARR_EMPTY = new float[0]; - - /** */ - private static final double[] DOUBLE_ARR_EMPTY = new double[0]; - - /** */ - private static final char[] CHAR_ARR_EMPTY = new char[0]; - - /** */ - private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; - - /** */ - private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { - @Override public byte[] create(int len) { - switch (len) { - case -1: - return BYTE_ARR_NOT_READ; - - case 0: - return BYTE_ARR_EMPTY; - - default: - return new byte[len]; - } - } - }; - - /** */ - private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { - @Override public short[] create(int len) { - switch (len) { - case -1: - return SHORT_ARR_NOT_READ; - - case 0: - return SHORT_ARR_EMPTY; - - default: - return new short[len]; - } - } - }; - - /** */ - private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { - @Override public int[] create(int len) { - switch (len) { - case -1: - return INT_ARR_NOT_READ; - - case 0: - return INT_ARR_EMPTY; - - default: - return new int[len]; - } - } - }; - - /** */ - private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { - @Override public long[] create(int len) { - switch (len) { - case -1: - return LONG_ARR_NOT_READ; - - case 0: - return LONG_ARR_EMPTY; - - default: - return new long[len]; - } - } - }; - - /** */ - private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { - @Override public float[] create(int len) { - switch (len) { - case -1: - return FLOAT_ARR_NOT_READ; - - case 0: - return FLOAT_ARR_EMPTY; - - default: - return new float[len]; - } - } - }; - - /** */ - private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { - @Override public double[] create(int len) { - switch (len) { - case -1: - return DOUBLE_ARR_NOT_READ; - - case 0: - return DOUBLE_ARR_EMPTY; - - default: - return new double[len]; - } - } - }; - - /** */ - private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { - @Override public char[] create(int len) { - switch (len) { - case -1: - return CHAR_ARR_NOT_READ; - - case 0: - return CHAR_ARR_EMPTY; - - default: - return new char[len]; - } - } - }; - - /** */ - private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { - @Override public boolean[] create(int len) { - switch (len) { - case -1: - return BOOLEAN_ARR_NOT_READ; - - case 0: - return BOOLEAN_ARR_EMPTY; - - default: - return new boolean[len]; - } - } - }; - - /** */ - private ByteBuffer buf; - - /** */ - private byte[] heapArr; - - /** */ - private long baseOff; - - /** */ - private int arrOff; - - /** */ - private Object tmpArr; - - /** */ - private int tmpArrOff; - - /** */ - private int tmpArrBytes; - - /** */ - private boolean msgTypeDone; - - /** */ - private GridTcpCommunicationMessageAdapter msg; - - /** */ - private boolean lastWritten; - - /** - * @param buf Buffer. - */ - public final void setBuffer(ByteBuffer buf) { - assert buf != null; - - if (this.buf != buf) { - this.buf = buf; - - heapArr = buf.isDirect() ? null : buf.array(); - baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; - } - } - - /** - * @return Whether last object was fully written. - */ - public boolean lastWritten() { - return lastWritten; - } - - /** - * @param msg Message. - */ - public void writeMessage(GridTcpCommunicationMessageAdapter msg) { - assert msg != null; - - lastWritten = msg.writeTo(buf); - } - - /** - * @return Message. - */ - public GridTcpCommunicationMessageAdapter readMessage() { - if (!msgTypeDone) { - assert buf.hasRemaining(); - - byte type = readByte(); - - msg = type == Byte.MIN_VALUE ? null : GridTcpCommunicationMessageFactory.create(type); - - msgTypeDone = true; - } - - if (msg == null || msg.readFrom(buf)) { - GridTcpCommunicationMessageAdapter msg0 = msg; - - msgTypeDone = false; - msg = null; - - return msg0; - } - else - return MSG_NOT_READ; - } - - /** {@inheritDoc} */ - @Override public void writeByte(byte val) { - int pos = buf.position(); - - UNSAFE.putByte(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - @Override public void writeByteArray(byte[] val) { - assert val != null; - - lastWritten = writeArray(val, BYTE_ARR_OFF, val.length); - } - - /** {@inheritDoc} */ - @Override public void writeBoolean(boolean val) { - int pos = buf.position(); - - UNSAFE.putBoolean(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - @Override public void writeBooleanArray(boolean[] val) { - assert val != null; - - lastWritten = writeArray(val, BOOLEAN_ARR_OFF, val.length); - } - - /** {@inheritDoc} */ - @Override public void writeShort(short val) { - int pos = buf.position(); - - UNSAFE.putShort(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - @Override public void writeShortArray(short[] val) { - assert val != null; - - lastWritten = writeArray(val, SHORT_ARR_OFF, val.length << 1); - } - - /** {@inheritDoc} */ - @Override public void writeChar(char val) { - int pos = buf.position(); - - UNSAFE.putChar(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - @Override public void writeCharArray(char[] val) { - assert val != null; - - lastWritten = writeArray(val, CHAR_ARR_OFF, val.length << 1); - } - - /** {@inheritDoc} */ - @Override public void writeInt(int val) { - int pos = buf.position(); - - UNSAFE.putInt(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - @Override public void writeInt(int pos, int val) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeIntArray(int[] val) { - assert val != null; - - lastWritten = writeArray(val, INT_ARR_OFF, val.length << 2); - } - - /** {@inheritDoc} */ - @Override public void writeFloat(float val) { - int pos = buf.position(); - - UNSAFE.putFloat(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - @Override public void writeFloatArray(float[] val) { - assert val != null; - - lastWritten = writeArray(val, FLOAT_ARR_OFF, val.length << 2); - } - - /** {@inheritDoc} */ - @Override public void writeLong(long val) { - int pos = buf.position(); - - UNSAFE.putLong(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - @Override public void writeLongArray(long[] val) { - assert val != null; - - lastWritten = writeArray(val, LONG_ARR_OFF, val.length << 3); - } - - /** {@inheritDoc} */ - @Override public void writeDouble(double val) { - int pos = buf.position(); - - UNSAFE.putDouble(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - @Override public void writeDoubleArray(double[] val) { - assert val != null; - - lastWritten = writeArray(val, DOUBLE_ARR_OFF, val.length << 3); - } - - /** {@inheritDoc} */ - @Override public void write(byte[] arr, int off, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void write(long addr, int cnt) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public byte readByte() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getByte(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public byte[] readByteArray(int cnt) { - return readArray(BYTE_ARR_CREATOR, cnt, 0, BYTE_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public boolean readBoolean() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getBoolean(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public boolean[] readBooleanArray(int cnt) { - return readArray(BOOLEAN_ARR_CREATOR, cnt, 0, BOOLEAN_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public short readShort() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getShort(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public short[] readShortArray(int cnt) { - return readArray(SHORT_ARR_CREATOR, cnt, 1, SHORT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public char readChar() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getChar(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public char[] readCharArray(int cnt) { - return readArray(CHAR_ARR_CREATOR, cnt, 1, CHAR_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public int readInt() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getInt(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public int readInt(int pos) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int[] readIntArray(int cnt) { - return readArray(INT_ARR_CREATOR, cnt, 2, INT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public float readFloat() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getFloat(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public float[] readFloatArray(int cnt) { - return readArray(FLOAT_ARR_CREATOR, cnt, 2, FLOAT_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public long readLong() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getLong(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public long[] readLongArray(int cnt) { - return readArray(LONG_ARR_CREATOR, cnt, 3, LONG_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public double readDouble() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getDouble(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - @Override public double[] readDoubleArray(int cnt) { - return readArray(DOUBLE_ARR_CREATOR, cnt, 3, DOUBLE_ARR_OFF); - } - - /** {@inheritDoc} */ - @Override public int read(byte[] arr, int off, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int read(long addr, int len) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public int position() { - return buf.position(); - } - - /** {@inheritDoc} */ - @Override public void position(int pos) { - buf.position(pos); - } - - /** {@inheritDoc} */ - public int remaining() { - return buf.remaining(); - } - - /** {@inheritDoc} */ - @Override public void close() { - // No-op. - } - - /** {@inheritDoc} */ - @Override public byte[] array() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public byte[] arrayCopy() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public long offheapPointer() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public boolean hasArray() { - throw new UnsupportedOperationException(); - } - - /** - * @param arr Array. - * @param off Offset. - * @param bytes Length in bytes. - * @return Whether array was fully written - */ - private boolean writeArray(Object arr, long off, int bytes) { - assert arr != null; - assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); - assert off > 0; - assert bytes >= 0; - assert bytes >= arrOff; - - if (!buf.hasRemaining()) - return false; - - int toWrite = bytes - arrOff; - int pos = buf.position(); - int remaining = buf.remaining(); - - if (toWrite <= remaining) { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); - - pos += toWrite; - - buf.position(pos); - - arrOff = 0; - - return true; - } - else { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); - - pos += remaining; - - buf.position(pos); - - arrOff += remaining; - - return false; - } - } - - /** - * @param creator Array creator. - * @param len Array Array length. - * @param lenShift Array length shift size. - * @param off Base offset. - * @return Array or special value if it was not fully read. - */ - private T readArray(ArrayCreator creator, int len, int lenShift, long off) { - assert creator != null; - - if (tmpArr == null) { - switch (len) { - case -1: - return null; - - case 0: - return creator.create(0); - - default: - tmpArr = creator.create(len); - tmpArrBytes = len << lenShift; - } - } - - int toRead = tmpArrBytes - tmpArrOff; - int remaining = buf.remaining(); - int pos = buf.position(); - - if (remaining < toRead) { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); - - buf.position(pos + remaining); - - tmpArrOff += remaining; - - return creator.create(-1); - } - else { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); - - buf.position(pos + toRead); - - T arr = (T)tmpArr; - - tmpArr = null; - tmpArrBytes = 0; - tmpArrOff = 0; - - return arr; - } - } - - /** - * Array creator. - */ - private static interface ArrayCreator { - /** - * @param len Array length or {@code -1} if array was not fully read. - * @return New array. - */ - public T create(int len); - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java deleted file mode 100644 index 7f7f971..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationPortableWriter.java +++ /dev/null @@ -1,223 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.apache.ignite.portables.*; -import org.jetbrains.annotations.*; - -import java.math.*; -import java.sql.*; -import java.util.*; -import java.util.Date; - -/** - * Portable writer implementation. - */ -public class GridTcpCommunicationPortableWriter implements PortableWriter { - /** Stream. */ - private final GridTcpCommunicationPortableStream stream; - - /** - * @param stream Stream. - */ - public GridTcpCommunicationPortableWriter(GridTcpCommunicationPortableStream stream) { - this.stream = stream; - } - - /** {@inheritDoc} */ - @Override public void writeByte(String fieldName, byte val) throws PortableException { - stream.writeByte(val); - } - - /** {@inheritDoc} */ - @Override public void writeShort(String fieldName, short val) throws PortableException { - stream.writeShort(val); - } - - /** {@inheritDoc} */ - @Override public void writeInt(String fieldName, int val) throws PortableException { - stream.writeInt(val); - } - - /** {@inheritDoc} */ - @Override public void writeLong(String fieldName, long val) throws PortableException { - stream.writeLong(val); - } - - /** {@inheritDoc} */ - @Override public void writeFloat(String fieldName, float val) throws PortableException { - stream.writeFloat(val); - } - - /** {@inheritDoc} */ - @Override public void writeDouble(String fieldName, double val) throws PortableException { - stream.writeDouble(val); - } - - /** {@inheritDoc} */ - @Override public void writeChar(String fieldName, char val) throws PortableException { - stream.writeChar(val); - } - - /** {@inheritDoc} */ - @Override public void writeBoolean(String fieldName, boolean val) throws PortableException { - stream.writeBoolean(val); - } - - /** {@inheritDoc} */ - @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeByteArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeShortArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeIntArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeLongArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeFloatArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeDoubleArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeCharArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException { - stream.writeInt(val != null ? val.length : -1); - - if (val != null) - stream.writeBooleanArray(val); - } - - /** {@inheritDoc} */ - @Override public void writeObject(String fieldName, @Nullable Object obj) throws PortableException { - if (obj != null) { - assert obj instanceof GridTcpCommunicationMessageAdapter; - - stream.writeMessage((GridTcpCommunicationMessageAdapter)obj); - } - else - stream.writeByte(Byte.MIN_VALUE); - } - - /** {@inheritDoc} */ - @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeString(String fieldName, @Nullable String val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeDate(String fieldName, @Nullable Date val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeCollection(String fieldName, @Nullable Collection col) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public void writeMap(String fieldName, @Nullable Map map) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public > void writeEnum(String fieldName, T val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public > void writeEnumArray(String fieldName, T[] val) throws PortableException { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public PortableRawWriter rawWriter() { - throw new UnsupportedOperationException(); - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpMessageFactory.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpMessageFactory.java deleted file mode 100644 index 8767af1..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpMessageFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -/** - * - */ -public interface GridTcpMessageFactory { - /** - * @param type Message type. - * @return Message instance. - */ - public GridTcpCommunicationMessageAdapter create(byte type); -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java index cacb980..eadcd99 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java @@ -10,6 +10,7 @@ package org.gridgain.grid.util.nio; import org.apache.ignite.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; @@ -28,7 +29,7 @@ public class GridDirectParser implements GridNioParser { private IgniteSpiAdapter spi; /** */ - private GridTcpMessageFactory msgFactory; + private MessageFactory msgFactory; /** * @param spi Spi. diff --git a/modules/core/src/test/java/org/gridgain/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/gridgain/testframework/GridSpiTestContext.java index dee0951..5f380a5 100644 --- a/modules/core/src/test/java/org/gridgain/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/gridgain/testframework/GridSpiTestContext.java @@ -13,6 +13,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; @@ -509,8 +510,8 @@ public class GridSpiTestContext implements IgniteSpiContext { } /** {@inheritDoc} */ - @Override public GridTcpMessageFactory messageFactory() { - return new GridTcpMessageFactory() { + @Override public MessageFactory messageFactory() { + return new MessageFactory() { @Override public GridTcpCommunicationMessageAdapter create(byte type) { return GridTcpCommunicationMessageFactory.create(type); } -- 1.9.3 (Apple Git-50) From 2c4a36cfee9a57bd48b7c872f332eee88771e7bc Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 26 Dec 2014 18:24:29 -0800 Subject: [PATCH 12/71] IGNITE-61 - Portable format in direct marshalling --- .../collision/jobstealing/JobStealingRequest.java | 6 +- .../gridgain/grid/kernal/GridJobCancelRequest.java | 18 ++- .../grid/kernal/GridJobExecuteRequest.java | 132 +++++++++------------ .../grid/kernal/GridJobExecuteRequestV2.java | 6 +- .../grid/kernal/GridJobExecuteResponse.java | 42 +++---- .../grid/kernal/GridJobSiblingsRequest.java | 12 +- .../grid/kernal/GridJobSiblingsResponse.java | 6 +- .../grid/kernal/GridTaskCancelRequest.java | 6 +- .../grid/kernal/GridTaskSessionRequest.java | 18 +-- .../managers/checkpoint/GridCheckpointRequest.java | 18 +-- .../managers/communication/GridIoMessage.java | 42 +++---- .../managers/communication/GridIoUserMessage.java | 46 +++---- .../deployment/GridDeploymentInfoBean.java | 34 +++--- .../managers/deployment/GridDeploymentRequest.java | 32 ++--- .../deployment/GridDeploymentResponse.java | 18 ++- .../eventstorage/GridEventStorageMessage.java | 58 ++++----- .../processors/cache/GridCacheEvictionRequest.java | 18 ++- .../cache/GridCacheEvictionResponse.java | 20 ++-- .../kernal/processors/cache/GridCacheMessage.java | 18 ++- .../GridCacheOptimisticCheckPreparedTxRequest.java | 24 ++-- ...GridCacheOptimisticCheckPreparedTxResponse.java | 18 ++- ...ridCachePessimisticCheckCommittedTxRequest.java | 36 +++--- ...idCachePessimisticCheckCommittedTxResponse.java | 18 +-- .../distributed/GridDistributedBaseMessage.java | 34 +++--- .../distributed/GridDistributedLockRequest.java | 100 +++++++--------- .../distributed/GridDistributedLockResponse.java | 20 ++-- .../GridDistributedTxFinishRequest.java | 104 ++++++++-------- .../GridDistributedTxFinishResponse.java | 12 +- .../GridDistributedTxPrepareRequest.java | 114 +++++++++--------- .../GridDistributedTxPrepareResponse.java | 12 +- .../distributed/GridDistributedUnlockRequest.java | 8 +- .../dht/GridDhtAffinityAssignmentRequest.java | 6 +- .../dht/GridDhtAffinityAssignmentResponse.java | 12 +- .../cache/distributed/dht/GridDhtLockRequest.java | 50 ++++---- .../cache/distributed/dht/GridDhtLockResponse.java | 34 +++--- .../distributed/dht/GridDhtTxFinishRequest.java | 88 +++++++------- .../distributed/dht/GridDhtTxFinishResponse.java | 6 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 96 +++++++-------- .../distributed/dht/GridDhtTxPrepareResponse.java | 40 +++---- .../distributed/dht/GridDhtUnlockRequest.java | 8 +- .../GridDhtAtomicDeferredUpdateResponse.java | 8 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 122 +++++++++---------- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 26 ++-- .../dht/atomic/GridNearAtomicUpdateRequest.java | 116 +++++++++--------- .../dht/atomic/GridNearAtomicUpdateResponse.java | 74 +++++------- .../dht/preloader/GridDhtForceKeysRequest.java | 26 ++-- .../dht/preloader/GridDhtForceKeysResponse.java | 26 ++-- .../preloader/GridDhtPartitionDemandMessage.java | 42 ++++--- .../preloader/GridDhtPartitionSupplyMessage.java | 48 ++++---- .../GridDhtPartitionsAbstractMessage.java | 12 +- .../preloader/GridDhtPartitionsFullMessage.java | 18 ++- .../preloader/GridDhtPartitionsSingleMessage.java | 6 +- .../cache/distributed/near/GridNearGetRequest.java | 64 +++++----- .../distributed/near/GridNearGetResponse.java | 48 +++----- .../distributed/near/GridNearLockRequest.java | 82 +++++++------ .../distributed/near/GridNearLockResponse.java | 36 +++--- .../distributed/near/GridNearTxFinishRequest.java | 50 ++++---- .../distributed/near/GridNearTxFinishResponse.java | 18 ++- .../distributed/near/GridNearTxPrepareRequest.java | 65 +++++----- .../near/GridNearTxPrepareResponse.java | 46 ++++--- .../cache/query/GridCacheQueryRequest.java | 114 ++++++++---------- .../cache/query/GridCacheQueryResponse.java | 40 +++---- .../clock/GridClockDeltaSnapshotMessage.java | 20 ++-- .../continuous/GridContinuousMessage.java | 18 ++- .../processors/dataload/GridDataLoadRequest.java | 76 +++++------- .../processors/dataload/GridDataLoadResponse.java | 18 ++- .../kernal/processors/ggfs/GridGgfsAckMessage.java | 18 ++- .../kernal/processors/ggfs/GridGgfsBlockKey.java | 24 ++-- .../processors/ggfs/GridGgfsBlocksMessage.java | 25 ++-- .../processors/ggfs/GridGgfsDeleteMessage.java | 12 +- .../processors/ggfs/GridGgfsFileAffinityRange.java | 30 +++-- .../ggfs/GridGgfsFragmentizerRequest.java | 16 ++- .../ggfs/GridGgfsFragmentizerResponse.java | 6 +- .../processors/ggfs/GridGgfsSyncMessage.java | 12 +- .../message/GridClientHandshakeRequestWrapper.java | 6 +- .../GridClientHandshakeResponseWrapper.java | 6 +- .../client/message/GridClientMessageWrapper.java | 30 ++--- .../message/GridClientPingPacketWrapper.java | 6 +- .../rest/handlers/task/GridTaskResultRequest.java | 12 +- .../rest/handlers/task/GridTaskResultResponse.java | 24 ++-- .../protocols/tcp/GridMemcachedMessageWrapper.java | 6 +- .../streamer/GridStreamerCancelRequest.java | 6 +- .../streamer/GridStreamerExecutionRequest.java | 46 +++---- .../processors/streamer/GridStreamerResponse.java | 12 +- .../direct/GridTcpCommunicationMessageAdapter.java | 90 ++++++++++++++ .../direct/GridTcpCommunicationMessageState.java | 4 + 86 files changed, 1339 insertions(+), 1661 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index a6c3346..ff77285 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -94,11 +94,11 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (buf.remaining() < 4) - return false; - delta = commState.getInt("delta"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java index 00fc2e5..40b6e36 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java @@ -163,31 +163,27 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid jobId0 = commState.getGridUuid("jobId"); + jobId = commState.getGridUuid("jobId"); - if (jobId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - jobId = jobId0; - commState.idx++; case 1: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - sys = commState.getBoolean("sys"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java index c7e3bcc..fca9df8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java @@ -647,103 +647,93 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 1: - String cpSpi0 = commState.getString("cpSpi"); + cpSpi = commState.getString("cpSpi"); - if (cpSpi0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - cpSpi = cpSpi0; - commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - createTime = commState.getLong("createTime"); + if (!commState.lastRead()) + return false; + commState.idx++; case 3: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 4: - if (buf.remaining() < 1) - return false; - dynamicSiblings = commState.getBoolean("dynamicSiblings"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: - if (buf.remaining() < 1) - return false; - forceLocDep = commState.getBoolean("forceLocDep"); + if (!commState.lastRead()) + return false; + commState.idx++; case 6: - if (buf.remaining() < 1) - return false; - internal = commState.getBoolean("internal"); + if (!commState.lastRead()) + return false; + commState.idx++; case 7: - byte[] jobAttrsBytes0 = commState.getByteArray("jobAttrsBytes"); + jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); - if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - jobAttrsBytes = jobAttrsBytes0; - commState.idx++; case 8: - byte[] jobBytes0 = commState.getByteArray("jobBytes"); + jobBytes = commState.getByteArray("jobBytes"); - if (jobBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - jobBytes = jobBytes0; - commState.idx++; case 9: - IgniteUuid jobId0 = commState.getGridUuid("jobId"); + jobId = commState.getGridUuid("jobId"); - if (jobId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - jobId = jobId0; - commState.idx++; case 10: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -754,7 +744,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -763,7 +753,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; ldrParticipants.put((UUID)commState.cur, _val); @@ -781,85 +771,75 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 11: - byte[] sesAttrsBytes0 = commState.getByteArray("sesAttrsBytes"); + sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); - if (sesAttrsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - sesAttrsBytes = sesAttrsBytes0; - commState.idx++; case 12: - if (buf.remaining() < 1) - return false; - sesFullSup = commState.getBoolean("sesFullSup"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; case 14: - byte[] siblingsBytes0 = commState.getByteArray("siblingsBytes"); + siblingsBytes = commState.getByteArray("siblingsBytes"); - if (siblingsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - siblingsBytes = siblingsBytes0; - commState.idx++; case 15: - if (buf.remaining() < 8) - return false; - startTaskTime = commState.getLong("startTaskTime"); + if (!commState.lastRead()) + return false; + commState.idx++; case 16: - String taskClsName0 = commState.getString("taskClsName"); + taskClsName = commState.getString("taskClsName"); - if (taskClsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - taskClsName = taskClsName0; - commState.idx++; case 17: - String taskName0 = commState.getString("taskName"); + taskName = commState.getString("taskName"); - if (taskName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - taskName = taskName0; - commState.idx++; case 18: - if (buf.remaining() < 8) - return false; - timeout = commState.getLong("timeout"); + if (!commState.lastRead()) + return false; + commState.idx++; case 19: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -869,7 +849,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im for (int i = commState.readItems; i < commState.readSize; i++) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; top.add((UUID)_val); @@ -884,13 +864,11 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 20: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java index 9e3e583..fb4d9e5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java @@ -156,13 +156,11 @@ public class GridJobExecuteRequestV2 extends GridJobExecuteRequest { switch (commState.idx) { case 21: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java index 2ef82d8..ca0f0e2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java @@ -282,71 +282,59 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] gridExBytes0 = commState.getByteArray("gridExBytes"); + gridExBytes = commState.getByteArray("gridExBytes"); - if (gridExBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - gridExBytes = gridExBytes0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - isCancelled = commState.getBoolean("isCancelled"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - byte[] jobAttrsBytes0 = commState.getByteArray("jobAttrsBytes"); + jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); - if (jobAttrsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - jobAttrsBytes = jobAttrsBytes0; - commState.idx++; case 3: - IgniteUuid jobId0 = commState.getGridUuid("jobId"); + jobId = commState.getGridUuid("jobId"); - if (jobId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - jobId = jobId0; - commState.idx++; case 4: - UUID nodeId0 = commState.getUuid("nodeId"); + nodeId = commState.getUuid("nodeId"); - if (nodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - nodeId = nodeId0; - commState.idx++; case 5: - byte[] resBytes0 = commState.getByteArray("resBytes"); + resBytes = commState.getByteArray("resBytes"); - if (resBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - resBytes = resBytes0; - commState.idx++; case 6: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java index 31bf8e0..36bac1d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java @@ -131,23 +131,19 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray("topicBytes"); + topicBytes = commState.getByteArray("topicBytes"); - if (topicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - topicBytes = topicBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java index 81821b1..1975acb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java @@ -117,13 +117,11 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - byte[] siblingsBytes0 = commState.getByteArray("siblingsBytes"); + siblingsBytes = commState.getByteArray("siblingsBytes"); - if (siblingsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - siblingsBytes = siblingsBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java index d1ae101..640ef58 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java @@ -100,13 +100,11 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java index 8c9c63e..337c035 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java @@ -152,33 +152,27 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - byte[] attrsBytes0 = commState.getByteArray("attrsBytes"); + attrsBytes = commState.getByteArray("attrsBytes"); - if (attrsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - attrsBytes = attrsBytes0; - commState.idx++; case 1: - IgniteUuid jobId0 = commState.getGridUuid("jobId"); + jobId = commState.getGridUuid("jobId"); - if (jobId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - jobId = jobId0; - commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java index 8932cc3..117de44 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java @@ -137,33 +137,27 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String cpSpi0 = commState.getString("cpSpi"); + cpSpi = commState.getString("cpSpi"); - if (cpSpi0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - cpSpi = cpSpi0; - commState.idx++; case 1: - String key0 = commState.getString("key"); + key = commState.getString("key"); - if (key0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - key = key0; - commState.idx++; case 2: - IgniteUuid sesId0 = commState.getGridUuid("sesId"); + sesId = commState.getGridUuid("sesId"); - if (sesId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - sesId = sesId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java index 098f52a..2c5f725 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java @@ -275,65 +275,61 @@ public class GridIoMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - Object msg0 = commState.getMessage("msg"); + msg = (GridTcpCommunicationMessageAdapter)commState.getMessage("msg"); - if (msg0 == MSG_NOT_READ) + if (!commState.lastRead()) return false; - msg = (GridTcpCommunicationMessageAdapter)msg0; - commState.idx++; case 1: - if (buf.remaining() < 8) - return false; - msgId = commState.getLong("msgId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - byte plc0 = commState.getByte("plc"); + if (!commState.lastRead()) + return false; + plc = GridIoPolicy.fromOrdinal(plc0); commState.idx++; case 3: - if (buf.remaining() < 1) - return false; - skipOnTimeout = commState.getBoolean("skipOnTimeout"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - if (buf.remaining() < 8) - return false; - timeout = commState.getLong("timeout"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray("topicBytes"); + topicBytes = commState.getByteArray("topicBytes"); - if (topicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - topicBytes = topicBytes0; - commState.idx++; case 6: - if (buf.remaining() < 4) - return false; - topicOrd = commState.getInt("topicOrd"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java index 3c5c459..96ea5b5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java @@ -319,51 +319,45 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] bodyBytes0 = commState.getByteArray("bodyBytes"); + bodyBytes = commState.getByteArray("bodyBytes"); - if (bodyBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - bodyBytes = bodyBytes0; - commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 2: - String depClsName0 = commState.getString("depClsName"); + depClsName = commState.getString("depClsName"); - if (depClsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - depClsName = depClsName0; - commState.idx++; case 3: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 4: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -374,7 +368,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -383,7 +377,7 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; ldrParties.put((UUID)commState.cur, _val); @@ -401,23 +395,19 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 5: - byte[] topicBytes0 = commState.getByteArray("topicBytes"); + topicBytes = commState.getByteArray("topicBytes"); - if (topicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - topicBytes = topicBytes0; - commState.idx++; case 6: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java index f9d1d85..599ff25 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java @@ -237,39 +237,37 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - locDepOwner = commState.getBoolean("locDepOwner"); + if (!commState.lastRead()) + return false; + commState.idx++; case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -280,7 +278,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -289,7 +287,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; participants.put((UUID)commState.cur, _val); @@ -307,13 +305,11 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i commState.idx++; case 4: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java index 3dcc483..ca3edfe 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java @@ -245,29 +245,27 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - if (buf.remaining() < 1) - return false; - isUndeploy = commState.getBoolean("isUndeploy"); + if (!commState.lastRead()) + return false; + commState.idx++; case 1: - IgniteUuid ldrId0 = commState.getGridUuid("ldrId"); + ldrId = commState.getGridUuid("ldrId"); - if (ldrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - ldrId = ldrId0; - commState.idx++; case 2: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -277,7 +275,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { for (int i = commState.readItems; i < commState.readSize; i++) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; nodeIds.add((UUID)_val); @@ -292,23 +290,19 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 3: - byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); + resTopicBytes = commState.getByteArray("resTopicBytes"); - if (resTopicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - resTopicBytes = resTopicBytes0; - commState.idx++; case 4: - String rsrcName0 = commState.getString("rsrcName"); + rsrcName = commState.getString("rsrcName"); - if (rsrcName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - rsrcName = rsrcName0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java index bf0a4b6..7c63d91 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java @@ -160,31 +160,27 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - GridByteArrayList byteSrc0 = commState.getByteArrayList("byteSrc"); + byteSrc = commState.getByteArrayList("byteSrc"); - if (byteSrc0 == BYTE_ARR_LIST_NOT_READ) + if (!commState.lastRead()) return false; - byteSrc = byteSrc0; - commState.idx++; case 1: - String errMsg0 = commState.getString("errMsg"); + errMsg = commState.getString("errMsg"); - if (errMsg0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - errMsg = errMsg0; - commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - success = commState.getBoolean("success"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java index 4b5543c..97db917 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java @@ -391,71 +391,61 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 2: - byte[] evtsBytes0 = commState.getByteArray("evtsBytes"); + evtsBytes = commState.getByteArray("evtsBytes"); - if (evtsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - evtsBytes = evtsBytes0; - commState.idx++; case 3: - byte[] exBytes0 = commState.getByteArray("exBytes"); + exBytes = commState.getByteArray("exBytes"); - if (exBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - exBytes = exBytes0; - commState.idx++; case 4: - byte[] filter0 = commState.getByteArray("filter"); + filter = commState.getByteArray("filter"); - if (filter0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - filter = filter0; - commState.idx++; case 5: - String filterClsName0 = commState.getString("filterClsName"); + filterClsName = commState.getString("filterClsName"); - if (filterClsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - filterClsName = filterClsName0; - commState.idx++; case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -466,7 +456,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -475,7 +465,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; ldrParties.put((UUID)commState.cur, _val); @@ -493,23 +483,19 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter commState.idx++; case 7: - byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); + resTopicBytes = commState.getByteArray("resTopicBytes"); - if (resTopicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - resTopicBytes = resTopicBytes0; - commState.idx++; case 8: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java index 3c3bd83..dca0c24 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java @@ -201,29 +201,27 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray("entriesBytes"); + entriesBytes = commState.getByteArray("entriesBytes"); - if (entriesBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - entriesBytes = entriesBytes0; - commState.idx++; case 4: - if (buf.remaining() < 8) - return false; - futId = commState.getLong("futId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java index a14604a..9bdce8f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java @@ -212,27 +212,27 @@ public class GridCacheEvictionResponse extends GridCacheMessage { switch (commState.idx) { case 3: - if (buf.remaining() < 1) - return false; - err = commState.getBoolean("err"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - if (buf.remaining() < 8) - return false; - futId = commState.getLong("futId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -242,7 +242,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; rejectedKeyBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java index 7b7ab71..1d90848 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java @@ -624,29 +624,27 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage switch (commState.idx) { case 0: - if (buf.remaining() < 4) - return false; - cacheId = commState.getInt("cacheId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 1: - Object depInfo0 = commState.getMessage("depInfo"); + depInfo = (GridDeploymentInfoBean)commState.getMessage("depInfo"); - if (depInfo0 == MSG_NOT_READ) + if (!commState.lastRead()) return false; - depInfo = (GridDeploymentInfoBean)depInfo0; - commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - msgId = commState.getLong("msgId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index 30b3b65..8e995c2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -165,41 +165,35 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); + nearXidVer = commState.getCacheVersion("nearXidVer"); - if (nearXidVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - nearXidVer = nearXidVer0; - commState.idx++; case 11: - if (buf.remaining() < 4) - return false; - txNum = commState.getInt("txNum"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index 4bfda3d..62b8cb2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -146,31 +146,27 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 10: - if (buf.remaining() < 1) - return false; - success = commState.getBoolean("success"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index 92347bd..0302063 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -212,59 +212,51 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr switch (commState.idx) { case 8: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 9: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 10: - GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); + nearXidVer = commState.getCacheVersion("nearXidVer"); - if (nearXidVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - nearXidVer = nearXidVer0; - commState.idx++; case 11: - UUID originatingNodeId0 = commState.getUuid("originatingNodeId"); + originatingNodeId = commState.getUuid("originatingNodeId"); - if (originatingNodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - originatingNodeId = originatingNodeId0; - commState.idx++; case 12: - if (buf.remaining() < 8) - return false; - originatingThreadId = commState.getLong("originatingThreadId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - if (buf.remaining() < 1) - return false; - nearOnlyCheck = commState.getBoolean("nearOnlyCheck"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 19cfbb8..c616a22 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -177,33 +177,27 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist switch (commState.idx) { case 8: - byte[] committedTxInfoBytes0 = commState.getByteArray("committedTxInfoBytes"); + committedTxInfoBytes = commState.getByteArray("committedTxInfoBytes"); - if (committedTxInfoBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - committedTxInfoBytes = committedTxInfoBytes0; - commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 10: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java index 3709cd9..669e844 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -349,31 +349,27 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< switch (commState.idx) { case 3: - byte[] candsByIdxBytes0 = commState.getByteArray("candsByIdxBytes"); + candsByIdxBytes = commState.getByteArray("candsByIdxBytes"); - if (candsByIdxBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - candsByIdxBytes = candsByIdxBytes0; - commState.idx++; case 4: - byte[] candsByKeyBytes0 = commState.getByteArray("candsByKeyBytes"); + candsByKeyBytes = commState.getByteArray("candsByKeyBytes"); - if (candsByKeyBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - candsByKeyBytes = candsByKeyBytes0; - commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -383,7 +379,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; committedVers.add((GridCacheVersion)_val); @@ -399,10 +395,10 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -412,7 +408,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; rolledbackVers.add((GridCacheVersion)_val); @@ -427,13 +423,11 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< commState.idx++; case 7: - GridCacheVersion ver0 = commState.getCacheVersion("ver"); + ver = commState.getCacheVersion("ver"); - if (ver0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - ver = ver0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java index eab0072..4714823 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java @@ -625,10 +625,10 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage switch (commState.idx) { case 8: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -638,7 +638,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; drVersByIdx[i] = (GridCacheVersion)_val; @@ -653,65 +653,61 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 10: - byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); - if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - grpLockKeyBytes = grpLockKeyBytes0; - commState.idx++; case 11: - if (buf.remaining() < 1) - return false; - isInTx = commState.getBoolean("isInTx"); + if (!commState.lastRead()) + return false; + commState.idx++; case 12: - if (buf.remaining() < 1) - return false; - isInvalidate = commState.getBoolean("isInvalidate"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - if (buf.remaining() < 1) - return false; - isRead = commState.getBoolean("isRead"); + if (!commState.lastRead()) + return false; + commState.idx++; case 14: - if (buf.remaining() < 1) - return false; - byte isolation0 = commState.getByte("isolation"); + if (!commState.lastRead()) + return false; + isolation = IgniteTxIsolation.fromOrdinal(isolation0); commState.idx++; case 15: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -721,7 +717,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keyBytes.add((byte[])_val); @@ -736,75 +732,67 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage commState.idx++; case 16: - GridCacheVersion nearXidVer0 = commState.getCacheVersion("nearXidVer"); + nearXidVer = commState.getCacheVersion("nearXidVer"); - if (nearXidVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - nearXidVer = nearXidVer0; - commState.idx++; case 17: - UUID nodeId0 = commState.getUuid("nodeId"); + nodeId = commState.getUuid("nodeId"); - if (nodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - nodeId = nodeId0; - commState.idx++; case 18: - if (buf.remaining() < 1) - return false; - partLock = commState.getBoolean("partLock"); + if (!commState.lastRead()) + return false; + commState.idx++; case 19: - boolean[] retVals0 = commState.getBooleanArray("retVals"); + retVals = commState.getBooleanArray("retVals"); - if (retVals0 == BOOLEAN_ARR_NOT_READ) + if (!commState.lastRead()) return false; - retVals = retVals0; - commState.idx++; case 20: - if (buf.remaining() < 8) - return false; - threadId = commState.getLong("threadId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 21: - if (buf.remaining() < 8) - return false; - timeout = commState.getLong("timeout"); + if (!commState.lastRead()) + return false; + commState.idx++; case 22: - if (buf.remaining() < 4) - return false; - txSize = commState.getInt("txSize"); + if (!commState.lastRead()) + return false; + commState.idx++; case 23: - byte[] writeEntriesBytes0 = commState.getByteArray("writeEntriesBytes"); + writeEntriesBytes = commState.getByteArray("writeEntriesBytes"); - if (writeEntriesBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - writeEntriesBytes = writeEntriesBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java index 7facf11..2715aa9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java @@ -348,31 +348,27 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag switch (commState.idx) { case 8: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 9: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 10: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -382,7 +378,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheValueBytes _val = commState.getValueBytes(null); - if (_val == VAL_BYTES_NOT_READ) + if (!commState.lastRead()) return false; valBytes.add((GridCacheValueBytes)_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java index 147001c..8f68aa1 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -461,18 +461,24 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 17: - if (!commState.putLong("threadId", threadId)) + if (!commState.putBoolean("sys", sys)) return false; commState.idx++; case 18: - if (!commState.putInt("txSize", txSize)) + if (!commState.putLong("threadId", threadId)) return false; commState.idx++; case 19: + if (!commState.putInt("txSize", txSize)) + return false; + + commState.idx++; + + case 20: if (writeEntriesBytes != null) { if (commState.it == null) { if (!commState.putInt(null, writeEntriesBytes.size())) @@ -499,11 +505,6 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; - case 20: - if (!commState.putBoolean("sys", sys)) - return false; - - commState.idx++; } return true; @@ -519,67 +520,59 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes switch (commState.idx) { case 8: - GridCacheVersion baseVer0 = commState.getCacheVersion("baseVer"); + baseVer = commState.getCacheVersion("baseVer"); - if (baseVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - baseVer = baseVer0; - commState.idx++; case 9: - if (buf.remaining() < 1) - return false; - commit = commState.getBoolean("commit"); + if (!commState.lastRead()) + return false; + commState.idx++; case 10: - GridCacheVersion commitVer0 = commState.getCacheVersion("commitVer"); + commitVer = commState.getCacheVersion("commitVer"); - if (commitVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - commitVer = commitVer0; - commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 12: - byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); - if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - grpLockKeyBytes = grpLockKeyBytes0; - commState.idx++; case 13: - if (buf.remaining() < 1) - return false; - invalidate = commState.getBoolean("invalidate"); + if (!commState.lastRead()) + return false; + commState.idx++; case 14: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -589,7 +582,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; recoveryWritesBytes.add((byte[])_val); @@ -604,43 +597,51 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; case 15: - if (buf.remaining() < 1) - return false; - syncCommit = commState.getBoolean("syncCommit"); + if (!commState.lastRead()) + return false; + commState.idx++; case 16: - if (buf.remaining() < 1) - return false; - syncRollback = commState.getBoolean("syncRollback"); + if (!commState.lastRead()) + return false; + commState.idx++; case 17: - if (buf.remaining() < 8) - return false; + sys = commState.getBoolean("sys"); - threadId = commState.getLong("threadId"); + if (!commState.lastRead()) + return false; commState.idx++; case 18: - if (buf.remaining() < 4) + threadId = commState.getLong("threadId"); + + if (!commState.lastRead()) return false; + commState.idx++; + + case 19: txSize = commState.getInt("txSize"); + if (!commState.lastRead()) + return false; + commState.idx++; - case 19: + case 20: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -650,7 +651,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; writeEntriesBytes.add((byte[])_val); @@ -664,13 +665,6 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes commState.idx++; - case 20: - if (buf.remaining() < 1) - return false; - - sys = commState.getBoolean("sys"); - - commState.idx++; } return true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java index fd616d0..e8a916c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -128,23 +128,19 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridDistributedBaseMe commState.idx++; case 16: - if (!commState.putLong("threadId", threadId)) + if (!commState.putBoolean("sys", sys)) return false; commState.idx++; case 17: - if (!commState.putLong("timeout", timeout)) + if (!commState.putLong("threadId", threadId)) return false; commState.idx++; case 18: - if (!commState.putByteArray("txNodesBytes", txNodesBytes)) + if (!commState.putLong("timeout", timeout)) return false; commState.idx++; case 19: - if (!commState.putInt("txSize", txSize)) + if (!commState.putByteArray("txNodesBytes", txNodesBytes)) return false; commState.idx++; case 20: + if (!commState.putInt("txSize", txSize)) + return false; + + commState.idx++; + + case 21: if (writesBytes != null) { if (commState.it == null) { if (!commState.putInt(null, writesBytes.size())) @@ -566,11 +572,6 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; - case 21: - if (!commState.putBoolean("sys", sys)) - return false; - - commState.idx++; } return true; @@ -586,77 +587,71 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe switch (commState.idx) { case 8: - GridCacheVersion commitVer0 = commState.getCacheVersion("commitVer"); + commitVer = commState.getCacheVersion("commitVer"); - if (commitVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - commitVer = commitVer0; - commState.idx++; case 9: - if (buf.remaining() < 1) - return false; - byte concurrency0 = commState.getByte("concurrency"); + if (!commState.lastRead()) + return false; + concurrency = IgniteTxConcurrency.fromOrdinal(concurrency0); commState.idx++; case 10: - byte[] dhtVersBytes0 = commState.getByteArray("dhtVersBytes"); + dhtVersBytes = commState.getByteArray("dhtVersBytes"); - if (dhtVersBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - dhtVersBytes = dhtVersBytes0; - commState.idx++; case 11: - byte[] grpLockKeyBytes0 = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); - if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - grpLockKeyBytes = grpLockKeyBytes0; - commState.idx++; case 12: - if (buf.remaining() < 1) - return false; - invalidate = commState.getBoolean("invalidate"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - if (buf.remaining() < 1) - return false; - byte isolation0 = commState.getByte("isolation"); + if (!commState.lastRead()) + return false; + isolation = IgniteTxIsolation.fromOrdinal(isolation0); commState.idx++; case 14: - if (buf.remaining() < 1) - return false; - partLock = commState.getBoolean("partLock"); + if (!commState.lastRead()) + return false; + commState.idx++; case 15: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -666,7 +661,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; readsBytes.add((byte[])_val); @@ -681,45 +676,51 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; case 16: - if (buf.remaining() < 8) - return false; + sys = commState.getBoolean("sys"); - threadId = commState.getLong("threadId"); + if (!commState.lastRead()) + return false; commState.idx++; case 17: - if (buf.remaining() < 8) - return false; + threadId = commState.getLong("threadId"); - timeout = commState.getLong("timeout"); + if (!commState.lastRead()) + return false; commState.idx++; case 18: - byte[] txNodesBytes0 = commState.getByteArray("txNodesBytes"); + timeout = commState.getLong("timeout"); - if (txNodesBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - txNodesBytes = txNodesBytes0; - commState.idx++; case 19: - if (buf.remaining() < 4) + txNodesBytes = commState.getByteArray("txNodesBytes"); + + if (!commState.lastRead()) return false; + commState.idx++; + + case 20: txSize = commState.getInt("txSize"); + if (!commState.lastRead()) + return false; + commState.idx++; - case 20: + case 21: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -729,7 +730,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; writesBytes.add((byte[])_val); @@ -743,13 +744,6 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe commState.idx++; - case 21: - if (buf.remaining() < 1) - return false; - - sys = commState.getBoolean("sys"); - - commState.idx++; } return true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index 64922f7..011fd9c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -205,23 +205,19 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM switch (commState.idx) { case 8: - byte[] candsBytes0 = commState.getByteArray("candsBytes"); + candsBytes = commState.getByteArray("candsBytes"); - if (candsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - candsBytes = candsBytes0; - commState.idx++; case 9: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java index aa0772e..42b51fa 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -186,10 +186,10 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa switch (commState.idx) { case 8: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -199,7 +199,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keyBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index 9c6b74b..5f329cb 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -112,11 +112,11 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { switch (commState.idx) { case 24: - BitSet invalidateEntries0 = commState.getBitSet("invalidateEntries"); + invalidateEntries = commState.getBitSet("invalidateEntries"); - if (invalidateEntries0 == BIT_SET_NOT_READ) + if (!commState.lastRead()) return false; - invalidateEntries = invalidateEntries0; - commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 26: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -466,7 +462,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearKeyBytes.add((byte[])_val); @@ -481,49 +477,43 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 27: - byte[] ownedBytes0 = commState.getByteArray("ownedBytes"); + ownedBytes = commState.getByteArray("ownedBytes"); - if (ownedBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - ownedBytes = ownedBytes0; - commState.idx++; case 28: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 29: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 30: - if (buf.remaining() < 4) - return false; - taskNameHash = commState.getInt("taskNameHash"); + if (!commState.lastRead()) + return false; + commState.idx++; case 31: - BitSet preloadKeys0 = commState.getBitSet("preloadKeys"); + preloadKeys = commState.getBitSet("preloadKeys"); - if (preloadKeys0 == BIT_SET_NOT_READ) + if (!commState.lastRead()) return false; - preloadKeys = preloadKeys0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java index 054529a..57305f2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -333,10 +333,10 @@ public class GridDhtLockResponse extends GridDistributedLockResponse switch (commState.idx) { case 11: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -344,11 +344,11 @@ public class GridDhtLockResponse extends GridDistributedLockResponse invalidParts = new HashSet<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + invalidParts.add((Integer)_val); commState.readItems++; @@ -361,21 +361,19 @@ public class GridDhtLockResponse extends GridDistributedLockResponse commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 13: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -385,7 +383,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearEvictedBytes.add((byte[])_val); @@ -401,10 +399,10 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 14: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -414,7 +412,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; preloadEntriesBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 8efd398..7407286 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -326,19 +326,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest switch (commState.idx) { case 21: - if (!commState.putEnum(null, isolation)) + if (!commState.putEnum("isolation", isolation)) return false; commState.idx++; case 22: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 23: - if (!commState.putUuid(null, nearNodeId)) + if (!commState.putUuid("nearNodeId", nearNodeId)) return false; commState.idx++; @@ -371,7 +371,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 25: - if (!commState.putBoolean(null, onePhaseCommit)) + if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) return false; commState.idx++; @@ -404,31 +404,31 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 27: - if (!commState.putBoolean(null, sysInvalidate)) + if (!commState.putBoolean("sysInvalidate", sysInvalidate)) return false; commState.idx++; case 28: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 29: - if (!commState.putCacheVersion(null, writeVer)) + if (!commState.putCacheVersion("writeVer", writeVer)) return false; commState.idx++; case 30: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 31: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -448,41 +448,37 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest switch (commState.idx) { case 21: - if (buf.remaining() < 1) - return false; + byte isolation0 = commState.getByte("isolation"); - byte isolation0 = commState.getByte(null); + if (!commState.lastRead()) + return false; isolation = IgniteTxIsolation.fromOrdinal(isolation0); commState.idx++; case 22: - IgniteUuid miniId0 = commState.getGridUuid(null); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 23: - UUID nearNodeId0 = commState.getUuid(null); + nearNodeId = commState.getUuid("nearNodeId"); - if (nearNodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - nearNodeId = nearNodeId0; - commState.idx++; case 24: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -492,7 +488,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearWritesBytes.add((byte[])_val); @@ -507,19 +503,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 25: - if (buf.remaining() < 1) - return false; + onePhaseCommit = commState.getBoolean("onePhaseCommit"); - onePhaseCommit = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 26: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -529,7 +525,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; pendingVers.add((GridCacheVersion)_val); @@ -544,46 +540,42 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 27: - if (buf.remaining() < 1) - return false; + sysInvalidate = commState.getBoolean("sysInvalidate"); - sysInvalidate = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 28: - if (buf.remaining() < 8) - return false; + topVer = commState.getLong("topVer"); - topVer = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 29: - GridCacheVersion writeVer0 = commState.getCacheVersion(null); + writeVer = commState.getCacheVersion("writeVer"); - if (writeVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - writeVer = writeVer0; - commState.idx++; case 30: - UUID subjId0 = commState.getUuid(null); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 31: - if (buf.remaining() < 4) - return false; + taskNameHash = commState.getInt("taskNameHash"); - taskNameHash = commState.getInt(null); + if (!commState.lastRead()) + return false; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index 1215f1e..c881d47 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -116,13 +116,11 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon switch (commState.idx) { case 5: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java index 4f5b01b..c9e598d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java @@ -354,31 +354,31 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 22: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 23: - if (!commState.putBitSet(null, invalidateNearEntries)) + if (!commState.putBitSet("invalidateNearEntries", invalidateNearEntries)) return false; commState.idx++; case 24: - if (!commState.putBoolean(null, last)) + if (!commState.putBoolean("last", last)) return false; commState.idx++; case 25: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 26: - if (!commState.putUuid(null, nearNodeId)) + if (!commState.putUuid("nearNodeId", nearNodeId)) return false; commState.idx++; @@ -411,37 +411,37 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 28: - if (!commState.putCacheVersion(null, nearXidVer)) + if (!commState.putCacheVersion("nearXidVer", nearXidVer)) return false; commState.idx++; case 29: - if (!commState.putByteArray(null, ownedBytes)) + if (!commState.putByteArray("ownedBytes", ownedBytes)) return false; commState.idx++; case 30: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 31: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 32: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 33: - if (!commState.putBitSet(null, preloadKeys)) + if (!commState.putBitSet("preloadKeys", preloadKeys)) return false; commState.idx++; @@ -461,59 +461,51 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque switch (commState.idx) { case 22: - IgniteUuid futId0 = commState.getGridUuid(null); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 23: - BitSet invalidateNearEntries0 = commState.getBitSet(null); + invalidateNearEntries = commState.getBitSet("invalidateNearEntries"); - if (invalidateNearEntries0 == BIT_SET_NOT_READ) + if (!commState.lastRead()) return false; - invalidateNearEntries = invalidateNearEntries0; - commState.idx++; case 24: - if (buf.remaining() < 1) - return false; + last = commState.getBoolean("last"); - last = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(null); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 26: - UUID nearNodeId0 = commState.getUuid(null); + nearNodeId = commState.getUuid("nearNodeId"); - if (nearNodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - nearNodeId = nearNodeId0; - commState.idx++; case 27: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -523,7 +515,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearWritesBytes.add((byte[])_val); @@ -538,59 +530,51 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque commState.idx++; case 28: - GridCacheVersion nearXidVer0 = commState.getCacheVersion(null); + nearXidVer = commState.getCacheVersion("nearXidVer"); - if (nearXidVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - nearXidVer = nearXidVer0; - commState.idx++; case 29: - byte[] ownedBytes0 = commState.getByteArray(null); + ownedBytes = commState.getByteArray("ownedBytes"); - if (ownedBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - ownedBytes = ownedBytes0; - commState.idx++; case 30: - if (buf.remaining() < 8) - return false; + topVer = commState.getLong("topVer"); - topVer = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 31: - UUID subjId0 = commState.getUuid(null); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 32: - if (buf.remaining() < 4) - return false; + taskNameHash = commState.getInt("taskNameHash"); - taskNameHash = commState.getInt(null); + if (!commState.lastRead()) + return false; commState.idx++; case 33: - BitSet preloadKeys0 = commState.getBitSet(null); + preloadKeys = commState.getBitSet("preloadKeys"); - if (preloadKeys0 == BIT_SET_NOT_READ) + if (!commState.lastRead()) return false; - preloadKeys = preloadKeys0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index 1692d0a..e499fd9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -345,21 +345,19 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp switch (commState.idx) { case 10: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 11: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -367,11 +365,11 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp invalidParts = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + invalidParts.add((Integer)_val); commState.readItems++; @@ -384,21 +382,19 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp commState.idx++; case 12: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 13: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -408,7 +404,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearEvictedBytes.add((byte[])_val); @@ -424,10 +420,10 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 14: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -437,7 +433,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; preloadEntriesBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 3a4c289..2acc96d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -174,10 +174,10 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest= 0) { @@ -187,7 +187,7 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage< switch (commState.idx) { case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -154,7 +154,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; futVers.add((GridCacheVersion)_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 18ba7c4..4911c4b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -921,31 +921,27 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList("drExpireTimes"); + drExpireTimes = commState.getLongList("drExpireTimes"); - if (drExpireTimes0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - drExpireTimes = drExpireTimes0; - commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList("drTtls"); + drTtls = commState.getLongList("drTtls"); - if (drTtls0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - drTtls = drTtls0; - commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -955,7 +951,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; drVers.add((GridCacheVersion)_val); @@ -970,21 +966,19 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 6: - GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); + futVer = commState.getCacheVersion("futVer"); - if (futVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - futVer = futVer0; - commState.idx++; case 7: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -994,7 +988,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keyBytes.add((byte[])_val); @@ -1009,47 +1003,45 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - UUID nodeId0 = commState.getUuid("nodeId"); + nodeId = commState.getUuid("nodeId"); - if (nodeId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - nodeId = nodeId0; - commState.idx++; case 9: - if (buf.remaining() < 1) - return false; - byte syncMode0 = commState.getByte("syncMode"); + if (!commState.lastRead()) + return false; + syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); commState.idx++; case 10: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 11: - if (buf.remaining() < 8) - return false; - ttl = commState.getLong("ttl"); + if (!commState.lastRead()) + return false; + commState.idx++; case 12: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1059,7 +1051,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheValueBytes _val = commState.getValueBytes(null); - if (_val == VAL_BYTES_NOT_READ) + if (!commState.lastRead()) return false; valBytes.add((GridCacheValueBytes)_val); @@ -1074,21 +1066,19 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 13: - GridCacheVersion writeVer0 = commState.getCacheVersion("writeVer"); + writeVer = commState.getCacheVersion("writeVer"); - if (writeVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - writeVer = writeVer0; - commState.idx++; case 14: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1098,7 +1088,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearKeyBytes.add((byte[])_val); @@ -1114,10 +1104,10 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 15: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1127,7 +1117,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheValueBytes _val = commState.getValueBytes(null); - if (_val == VAL_BYTES_NOT_READ) + if (!commState.lastRead()) return false; nearValBytes.add((GridCacheValueBytes)_val); @@ -1142,19 +1132,19 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 16: - if (buf.remaining() < 1) - return false; - forceTransformBackups = commState.getBoolean("forceTransformBackups"); + if (!commState.lastRead()) + return false; + commState.idx++; case 17: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1164,7 +1154,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearTransformClosBytes.add((byte[])_val); @@ -1180,10 +1170,10 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 18: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1193,7 +1183,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; transformClosBytes.add((byte[])_val); @@ -1208,21 +1198,19 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 19: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 20: - if (buf.remaining() < 4) - return false; - taskNameHash = commState.getInt("taskNameHash"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index bc54e2f..c48dfb9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -270,41 +270,35 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray("failedKeysBytes"); + failedKeysBytes = commState.getByteArray("failedKeysBytes"); - if (failedKeysBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - failedKeysBytes = failedKeysBytes0; - commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); + futVer = commState.getCacheVersion("futVer"); - if (futVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - futVer = futVer0; - commState.idx++; case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -314,7 +308,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearEvictedBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 353446a..161c591 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -759,31 +759,27 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im switch (commState.idx) { case 3: - GridLongList drExpireTimes0 = commState.getLongList("drExpireTimes"); + drExpireTimes = commState.getLongList("drExpireTimes"); - if (drExpireTimes0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - drExpireTimes = drExpireTimes0; - commState.idx++; case 4: - GridLongList drTtls0 = commState.getLongList("drTtls"); + drTtls = commState.getLongList("drTtls"); - if (drTtls0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - drTtls = drTtls0; - commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -793,7 +789,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; drVers.add((GridCacheVersion)_val); @@ -808,19 +804,19 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 6: - if (buf.remaining() < 1) - return false; - fastMap = commState.getBoolean("fastMap"); + if (!commState.lastRead()) + return false; + commState.idx++; case 7: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -830,7 +826,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; filterBytes[i] = (byte[])_val; @@ -845,29 +841,27 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 8: - GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); + futVer = commState.getCacheVersion("futVer"); - if (futVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - futVer = futVer0; - commState.idx++; case 9: - if (buf.remaining() < 1) - return false; - hasPrimary = commState.getBoolean("hasPrimary"); + if (!commState.lastRead()) + return false; + commState.idx++; case 10: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -877,7 +871,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keyBytes.add((byte[])_val); @@ -892,65 +886,63 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 11: - if (buf.remaining() < 1) - return false; - byte op0 = commState.getByte("op"); + if (!commState.lastRead()) + return false; + op = GridCacheOperation.fromOrdinal(op0); commState.idx++; case 12: - if (buf.remaining() < 1) - return false; - retval = commState.getBoolean("retval"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - if (buf.remaining() < 1) - return false; - byte syncMode0 = commState.getByte("syncMode"); + if (!commState.lastRead()) + return false; + syncMode = GridCacheWriteSynchronizationMode.fromOrdinal(syncMode0); commState.idx++; case 14: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 15: - if (buf.remaining() < 8) - return false; - ttl = commState.getLong("ttl"); + if (!commState.lastRead()) + return false; + commState.idx++; case 16: - GridCacheVersion updateVer0 = commState.getCacheVersion("updateVer"); + updateVer = commState.getCacheVersion("updateVer"); - if (updateVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - updateVer = updateVer0; - commState.idx++; case 17: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -960,7 +952,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheValueBytes _val = commState.getValueBytes(null); - if (_val == VAL_BYTES_NOT_READ) + if (!commState.lastRead()) return false; valBytes.add((GridCacheValueBytes)_val); @@ -975,29 +967,27 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 18: - if (buf.remaining() < 1) - return false; - forceTransformBackups = commState.getBoolean("forceTransformBackups"); + if (!commState.lastRead()) + return false; + commState.idx++; case 19: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 20: - if (buf.remaining() < 4) - return false; - taskNameHash = commState.getInt("taskNameHash"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 363ac8b..1908c00 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -541,61 +541,51 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i switch (commState.idx) { case 3: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 4: - byte[] failedKeysBytes0 = commState.getByteArray("failedKeysBytes"); + failedKeysBytes = commState.getByteArray("failedKeysBytes"); - if (failedKeysBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - failedKeysBytes = failedKeysBytes0; - commState.idx++; case 5: - GridCacheVersion futVer0 = commState.getCacheVersion("futVer"); + futVer = commState.getCacheVersion("futVer"); - if (futVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - futVer = futVer0; - commState.idx++; case 6: - byte[] remapKeysBytes0 = commState.getByteArray("remapKeysBytes"); + remapKeysBytes = commState.getByteArray("remapKeysBytes"); - if (remapKeysBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - remapKeysBytes = remapKeysBytes0; - commState.idx++; case 7: - byte[] retValBytes0 = commState.getByteArray("retValBytes"); + retValBytes = commState.getByteArray("retValBytes"); - if (retValBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - retValBytes = retValBytes0; - commState.idx++; case 8: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -603,11 +593,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i nearSkipIdxs = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + nearSkipIdxs.add((Integer)_val); commState.readItems++; @@ -620,19 +610,19 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 9: - if (buf.remaining() < 8) - return false; - nearTtl = commState.getLong("nearTtl"); + if (!commState.lastRead()) + return false; + commState.idx++; case 10: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -642,7 +632,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheValueBytes _val = commState.getValueBytes(null); - if (_val == VAL_BYTES_NOT_READ) + if (!commState.lastRead()) return false; nearValBytes.add((GridCacheValueBytes)_val); @@ -658,10 +648,10 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 11: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -669,11 +659,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i nearValsIdxs = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + nearValsIdxs.add((Integer)_val); commState.readItems++; @@ -686,13 +676,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 12: - GridCacheVersion nearVer0 = commState.getCacheVersion("nearVer"); + nearVer = commState.getCacheVersion("nearVer"); - if (nearVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - nearVer = nearVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 60f9144..fdf4189 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -252,21 +252,19 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 4: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -276,7 +274,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keyBytes.add((byte[])_val); @@ -291,21 +289,19 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 6: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index bd56937..60c058d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -256,41 +256,35 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple switch (commState.idx) { case 3: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 4: - byte[] infosBytes0 = commState.getByteArray("infosBytes"); + infosBytes = commState.getByteArray("infosBytes"); - if (infosBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - infosBytes = infosBytes0; - commState.idx++; case 5: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -300,7 +294,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; missedKeyBytes.add((byte[])_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index bb036cd..28496db 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -295,10 +295,10 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage switch (commState.idx) { case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -306,11 +306,11 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage parts = new HashSet<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + parts.add((Integer)_val); commState.readItems++; @@ -323,45 +323,43 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage commState.idx++; case 4: - if (buf.remaining() < 8) - return false; - timeout = commState.getLong("timeout"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 6: - byte[] topicBytes0 = commState.getByteArray("topicBytes"); + topicBytes = commState.getByteArray("topicBytes"); - if (topicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - topicBytes = topicBytes0; - commState.idx++; case 7: - if (buf.remaining() < 8) - return false; - updateSeq = commState.getLong("updateSeq"); + if (!commState.lastRead()) + return false; + commState.idx++; case 8: - if (buf.remaining() < 4) - return false; - workerId = commState.getInt("workerId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java index 4736f5c..48d0d03 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java @@ -400,29 +400,27 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage switch (commState.idx) { case 3: - if (buf.remaining() < 1) - return false; - ack = commState.getBoolean("ack"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - byte[] infoBytes0 = commState.getByteArray("infoBytes"); + infoBytes = commState.getByteArray("infoBytes"); - if (infoBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - infoBytes = infoBytes0; - commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -430,11 +428,11 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage last = new HashSet<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + last.add((Integer)_val); commState.readItems++; @@ -448,10 +446,10 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -459,11 +457,11 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage missed = new HashSet<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + missed.add((Integer)_val); commState.readItems++; @@ -476,19 +474,19 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage commState.idx++; case 7: - if (buf.remaining() < 8) - return false; - updateSeq = commState.getLong("updateSeq"); + if (!commState.lastRead()) + return false; + commState.idx++; case 8: - if (buf.remaining() < 4) - return false; - workerId = commState.getInt("workerId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java index 6b975e7..4f9e7e2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java @@ -118,23 +118,19 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage extends GridDhtPartitionsAbstrac switch (commState.idx) { case 5: - byte[] affAssignmentBytes0 = commState.getByteArray("affAssignmentBytes"); + affAssignmentBytes = commState.getByteArray("affAssignmentBytes"); - if (affAssignmentBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - affAssignmentBytes = affAssignmentBytes0; - commState.idx++; case 6: - byte[] partsBytes0 = commState.getByteArray("partsBytes"); + partsBytes = commState.getByteArray("partsBytes"); - if (partsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - partsBytes = partsBytes0; - commState.idx++; case 7: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java index a2cee94..7216ab6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java @@ -142,13 +142,11 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr switch (commState.idx) { case 5: - byte[] partsBytes0 = commState.getByteArray("partsBytes"); + partsBytes = commState.getByteArray("partsBytes"); - if (partsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - partsBytes = partsBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java index 133569a..362c101 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java @@ -380,10 +380,10 @@ public class GridNearGetRequest extends GridCacheMessage implements switch (commState.idx) { case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -393,7 +393,7 @@ public class GridNearGetRequest extends GridCacheMessage implements for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; filterBytes[i] = (byte[])_val; @@ -408,21 +408,19 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 4: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -433,18 +431,18 @@ public class GridNearGetRequest extends GridCacheMessage implements if (!commState.keyDone) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; commState.keyDone = true; } - if (buf.remaining() < 1) - return false; - boolean _val = commState.getBoolean(null); + if (!commState.lastRead()) + return false; + keyBytes.put((byte[])commState.cur, _val); commState.keyDone = false; @@ -460,57 +458,51 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 7: - if (buf.remaining() < 1) - return false; - reload = commState.getBoolean("reload"); + if (!commState.lastRead()) + return false; + commState.idx++; case 8: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion("ver"); + ver = commState.getCacheVersion("ver"); - if (ver0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - ver = ver0; - commState.idx++; case 10: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 11: - if (buf.remaining() < 4) - return false; - taskNameHash = commState.getInt("taskNameHash"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java index c652c52..a53e0d8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java @@ -311,41 +311,35 @@ public class GridNearGetResponse extends GridCacheMessage implements switch (commState.idx) { case 3: - byte[] entriesBytes0 = commState.getByteArray("entriesBytes"); + entriesBytes = commState.getByteArray("entriesBytes"); - if (entriesBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - entriesBytes = entriesBytes0; - commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 5: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -353,11 +347,11 @@ public class GridNearGetResponse extends GridCacheMessage implements invalidParts = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + invalidParts.add((Integer)_val); commState.readItems++; @@ -370,31 +364,27 @@ public class GridNearGetResponse extends GridCacheMessage implements commState.idx++; case 7: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 8: - if (buf.remaining() < 8) - return false; - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; + commState.idx++; case 9: - GridCacheVersion ver0 = commState.getCacheVersion("ver"); + ver = commState.getCacheVersion("ver"); - if (ver0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - ver = ver0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java index d0086ba..4d5be8b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java @@ -428,34 +428,35 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; case 30: - if (!commState.putLong("topVer", topVer)) + if (!commState.putBoolean("syncCommit", syncCommit)) return false; commState.idx++; case 31: - if (!commState.putUuid("subjId", subjId)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 32: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 33: - if (!commState.putBoolean("hasTransforms", hasTransforms)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 34: - if (!commState.putBoolean("syncCommit", syncCommit)) + if (!commState.putBoolean("hasTransforms", hasTransforms)) return false; commState.idx++; + } return true; @@ -472,10 +473,10 @@ public class GridNearLockRequest extends GridDistributedLockRequest switch (commState.idx) { case 24: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -485,7 +486,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; dhtVers[i] = (GridCacheVersion)_val; @@ -501,10 +502,10 @@ public class GridNearLockRequest extends GridDistributedLockRequest case 25: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -514,7 +515,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; filterBytes[i] = (byte[])_val; @@ -529,80 +530,77 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; case 26: - if (buf.remaining() < 1) - return false; - implicitSingleTx = commState.getBoolean("implicitSingleTx"); + if (!commState.lastRead()) + return false; + commState.idx++; case 27: - if (buf.remaining() < 1) - return false; - implicitTx = commState.getBoolean("implicitTx"); + if (!commState.lastRead()) + return false; + commState.idx++; case 28: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 29: - if (buf.remaining() < 1) - return false; - onePhaseCommit = commState.getBoolean("onePhaseCommit"); + if (!commState.lastRead()) + return false; + commState.idx++; case 30: - if (buf.remaining() < 8) - return false; + syncCommit = commState.getBoolean("syncCommit"); - topVer = commState.getLong("topVer"); + if (!commState.lastRead()) + return false; commState.idx++; case 31: - UUID subjId0 = commState.getUuid("subjId"); + topVer = commState.getLong("topVer"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 32: - if (buf.remaining() < 4) - return false; + subjId = commState.getUuid("subjId"); - taskNameHash = commState.getInt("taskNameHash"); + if (!commState.lastRead()) + return false; commState.idx++; case 33: - if (buf.remaining() < 1) - return false; + taskNameHash = commState.getInt("taskNameHash"); - hasTransforms = commState.getBoolean("hasTransforms"); + if (!commState.lastRead()) + return false; commState.idx++; case 34: - if (buf.remaining() < 1) - return false; + hasTransforms = commState.getBoolean("hasTransforms"); - syncCommit = commState.getBoolean("syncCommit"); + if (!commState.lastRead()) + return false; commState.idx++; + } return true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java index 9c0a0b0..9000530 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java @@ -318,10 +318,10 @@ public class GridNearLockResponse extends GridDistributedLockResponse= 0) { @@ -331,7 +331,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { @@ -370,7 +368,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { @@ -409,7 +405,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedTxFinishReques switch (commState.idx) { case 21: - if (!commState.putBoolean(null, explicitLock)) + if (!commState.putBoolean("explicitLock", explicitLock)) return false; commState.idx++; case 22: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 23: - if (!commState.putLong(null, topVer)) + if (!commState.putBoolean("storeEnabled", storeEnabled)) return false; commState.idx++; case 24: - if (!commState.putUuid(null, subjId)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 25: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 26: - if (!commState.putBoolean(null, storeEnabled)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; + } return true; @@ -242,56 +243,53 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques switch (commState.idx) { case 21: - if (buf.remaining() < 1) - return false; + explicitLock = commState.getBoolean("explicitLock"); - explicitLock = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 22: - IgniteUuid miniId0 = commState.getGridUuid(null); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 23: - if (buf.remaining() < 8) - return false; + storeEnabled = commState.getBoolean("storeEnabled"); - topVer = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 24: - UUID subjId0 = commState.getUuid(null); + topVer = commState.getLong("topVer"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 25: - if (buf.remaining() < 4) - return false; + subjId = commState.getUuid("subjId"); - taskNameHash = commState.getInt(null); + if (!commState.lastRead()) + return false; commState.idx++; case 26: - if (buf.remaining() < 1) - return false; + taskNameHash = commState.getInt("taskNameHash"); - storeEnabled = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; + } return true; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java index 93629bf..e1b4dbc 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -175,31 +175,27 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo switch (commState.idx) { case 5: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 6: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 7: - if (buf.remaining() < 8) - return false; - nearThreadId = commState.getLong("nearThreadId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java index 7eb57a6..c94089b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java @@ -220,6 +220,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ _clone.futId = futId; _clone.miniId = miniId; + _clone.near = near; _clone.topVer = topVer; _clone.last = last; _clone.lastBackups = lastBackups; @@ -244,13 +245,13 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 22: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 23: - if (!commState.putBoolean(null, last)) + if (!commState.putBoolean("last", last)) return false; commState.idx++; @@ -283,31 +284,31 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 25: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 26: - if (!commState.putBoolean(null, near)) + if (!commState.putBoolean("near", near)) return false; commState.idx++; case 27: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 28: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 29: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -327,29 +328,27 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ switch (commState.idx) { case 22: - IgniteUuid futId0 = commState.getGridUuid(null); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 23: - if (buf.remaining() < 1) - return false; + last = commState.getBoolean("last"); - last = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 24: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -359,7 +358,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ for (int i = commState.readItems; i < commState.readSize; i++) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; lastBackups.add((UUID)_val); @@ -374,46 +373,42 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ commState.idx++; case 25: - IgniteUuid miniId0 = commState.getGridUuid(null); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 26: - if (buf.remaining() < 1) - return false; + near = commState.getBoolean("near"); - near = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 27: - if (buf.remaining() < 8) - return false; + topVer = commState.getLong("topVer"); - topVer = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 28: - UUID subjId0 = commState.getUuid(null); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 29: - if (buf.remaining() < 4) - return false; + taskNameHash = commState.getInt("taskNameHash"); - taskNameHash = commState.getInt(null); + if (!commState.lastRead()) + return false; commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java index 8faee91..a7b2268 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java @@ -369,31 +369,27 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes switch (commState.idx) { case 10: - GridCacheVersion dhtVer0 = commState.getCacheVersion("dhtVer"); + dhtVer = commState.getCacheVersion("dhtVer"); - if (dhtVer0 == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; - dhtVer = dhtVer0; - commState.idx++; case 11: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 12: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -401,11 +397,11 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes invalidParts = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - if (buf.remaining() < 4) - return false; - int _val = commState.getInt(null); + if (!commState.lastRead()) + return false; + invalidParts.add((Integer)_val); commState.readItems++; @@ -418,21 +414,19 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes commState.idx++; case 13: - IgniteUuid miniId0 = commState.getGridUuid("miniId"); + miniId = commState.getGridUuid("miniId"); - if (miniId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - miniId = miniId0; - commState.idx++; case 14: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -442,7 +436,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; ownedValsBytes.add((byte[])_val); @@ -458,10 +452,10 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 15: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -471,7 +465,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; pending.add((GridCacheVersion)_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java index 4614513..01715b0 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java @@ -622,175 +622,157 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen switch (commState.idx) { case 3: - if (buf.remaining() < 1) - return false; - all = commState.getBoolean("all"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - byte[] argsBytes0 = commState.getByteArray("argsBytes"); + argsBytes = commState.getByteArray("argsBytes"); - if (argsBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - argsBytes = argsBytes0; - commState.idx++; case 5: - String cacheName0 = commState.getString("cacheName"); + cacheName = commState.getString("cacheName"); - if (cacheName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - cacheName = cacheName0; - commState.idx++; case 6: - if (buf.remaining() < 1) - return false; - cancel = commState.getBoolean("cancel"); + if (!commState.lastRead()) + return false; + commState.idx++; case 7: - String clause0 = commState.getString("clause"); + clause = commState.getString("clause"); - if (clause0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - clause = clause0; - commState.idx++; case 8: - String clsName0 = commState.getString("clsName"); + clsName = commState.getString("clsName"); - if (clsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - clsName = clsName0; - commState.idx++; case 9: - if (buf.remaining() < 1) - return false; - fields = commState.getBoolean("fields"); + if (!commState.lastRead()) + return false; + commState.idx++; case 10: - if (buf.remaining() < 8) - return false; - id = commState.getLong("id"); + if (!commState.lastRead()) + return false; + commState.idx++; case 11: - if (buf.remaining() < 1) - return false; - incBackups = commState.getBoolean("incBackups"); + if (!commState.lastRead()) + return false; + commState.idx++; case 12: - if (buf.remaining() < 1) - return false; - incMeta = commState.getBoolean("incMeta"); + if (!commState.lastRead()) + return false; + commState.idx++; case 13: - byte[] keyValFilterBytes0 = commState.getByteArray("keyValFilterBytes"); + keyValFilterBytes = commState.getByteArray("keyValFilterBytes"); - if (keyValFilterBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - keyValFilterBytes = keyValFilterBytes0; - commState.idx++; case 14: - if (buf.remaining() < 4) - return false; - pageSize = commState.getInt("pageSize"); + if (!commState.lastRead()) + return false; + commState.idx++; case 15: - byte[] prjFilterBytes0 = commState.getByteArray("prjFilterBytes"); + prjFilterBytes = commState.getByteArray("prjFilterBytes"); - if (prjFilterBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - prjFilterBytes = prjFilterBytes0; - commState.idx++; case 16: - byte[] rdcBytes0 = commState.getByteArray("rdcBytes"); + rdcBytes = commState.getByteArray("rdcBytes"); - if (rdcBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - rdcBytes = rdcBytes0; - commState.idx++; case 17: - byte[] transBytes0 = commState.getByteArray("transBytes"); + transBytes = commState.getByteArray("transBytes"); - if (transBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - transBytes = transBytes0; - commState.idx++; case 18: - if (buf.remaining() < 1) - return false; - byte type0 = commState.getByte("type"); + if (!commState.lastRead()) + return false; + type = GridCacheQueryType.fromOrdinal(type0); commState.idx++; case 19: - if (buf.remaining() < 1) - return false; - keepPortable = commState.getBoolean("keepPortable"); + if (!commState.lastRead()) + return false; + commState.idx++; case 20: - UUID subjId0 = commState.getUuid("subjId"); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 21: - if (buf.remaining() < 4) - return false; - taskHash = commState.getInt("taskHash"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java index 825a575..6799609 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java @@ -330,10 +330,10 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme switch (commState.idx) { case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -343,7 +343,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; dataBytes.add((byte[])_val); @@ -358,37 +358,35 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 4: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 5: - if (buf.remaining() < 1) - return false; - fields = commState.getBoolean("fields"); + if (!commState.lastRead()) + return false; + commState.idx++; case 6: - if (buf.remaining() < 1) - return false; - finished = commState.getBoolean("finished"); + if (!commState.lastRead()) + return false; + commState.idx++; case 7: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -398,7 +396,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; metaDataBytes.add((byte[])_val); @@ -413,11 +411,11 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme commState.idx++; case 8: - if (buf.remaining() < 8) - return false; - reqId = commState.getLong("reqId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java index cca184b..c641b52 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java @@ -151,10 +151,10 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd switch (commState.idx) { case 0: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -165,18 +165,18 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; commState.keyDone = true; } - if (buf.remaining() < 8) - return false; - long _val = commState.getLong(null); + if (!commState.lastRead()) + return false; + deltas.put((UUID)commState.cur, _val); commState.keyDone = false; @@ -192,13 +192,11 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd commState.idx++; case 1: - GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion("snapVer"); + snapVer = commState.getClockDeltaVersion("snapVer"); - if (snapVer0 == CLOCK_DELTA_VER_NOT_READ) + if (!commState.lastRead()) return false; - snapVer = snapVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java index 6f0ef14..83f3a05 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java @@ -166,31 +166,27 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] dataBytes0 = commState.getByteArray("dataBytes"); + dataBytes = commState.getByteArray("dataBytes"); - if (dataBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - dataBytes = dataBytes0; - commState.idx++; case 1: - UUID routineId0 = commState.getUuid("routineId"); + routineId = commState.getUuid("routineId"); - if (routineId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - routineId = routineId0; - commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - byte type0 = commState.getByte("type"); + if (!commState.lastRead()) + return false; + type = GridContinuousMessageType.fromOrdinal(type0); commState.idx++; diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java index d7b815e..3f50b48 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java @@ -328,67 +328,61 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - String cacheName0 = commState.getString("cacheName"); + cacheName = commState.getString("cacheName"); - if (cacheName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - cacheName = cacheName0; - commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 2: - byte[] colBytes0 = commState.getByteArray("colBytes"); + colBytes = commState.getByteArray("colBytes"); - if (colBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - colBytes = colBytes0; - commState.idx++; case 3: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 4: - if (buf.remaining() < 1) - return false; - forceLocDep = commState.getBoolean("forceLocDep"); + if (!commState.lastRead()) + return false; + commState.idx++; case 5: - if (buf.remaining() < 1) - return false; - ignoreDepOwnership = commState.getBoolean("ignoreDepOwnership"); + if (!commState.lastRead()) + return false; + commState.idx++; case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -399,7 +393,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -408,7 +402,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; ldrParticipants.put((UUID)commState.cur, _val); @@ -426,51 +420,43 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapte commState.idx++; case 7: - if (buf.remaining() < 8) - return false; - reqId = commState.getLong("reqId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 8: - byte[] resTopicBytes0 = commState.getByteArray("resTopicBytes"); + resTopicBytes = commState.getByteArray("resTopicBytes"); - if (resTopicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - resTopicBytes = resTopicBytes0; - commState.idx++; case 9: - String sampleClsName0 = commState.getString("sampleClsName"); + sampleClsName = commState.getString("sampleClsName"); - if (sampleClsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - sampleClsName = sampleClsName0; - commState.idx++; case 10: - byte[] updaterBytes0 = commState.getByteArray("updaterBytes"); + updaterBytes = commState.getByteArray("updaterBytes"); - if (updaterBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - updaterBytes = updaterBytes0; - commState.idx++; case 11: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java index 46bab85..20e1678 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java @@ -136,29 +136,27 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - forceLocDep = commState.getBoolean("forceLocDep"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - reqId = commState.getLong("reqId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java index d3cb730..fa5b23b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java @@ -165,31 +165,27 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid("fileId"); + fileId = commState.getGridUuid("fileId"); - if (fileId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - fileId = fileId0; - commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - id = commState.getLong("id"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java index 0675e7b..9417334 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java @@ -219,39 +219,35 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid("affKey"); + affKey = commState.getGridUuid("affKey"); - if (affKey0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - affKey = affKey0; - commState.idx++; case 1: - if (buf.remaining() < 8) - return false; - blockId = commState.getLong("blockId"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - evictExclude = commState.getBoolean("evictExclude"); + if (!commState.lastRead()) + return false; + commState.idx++; case 3: - IgniteUuid fileId0 = commState.getGridUuid("fileId"); + fileId = commState.getGridUuid("fileId"); - if (fileId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - fileId = fileId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java index 0b169a7..52e4e96 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java @@ -12,7 +12,6 @@ package org.gridgain.grid.kernal.processors.ggfs; import org.apache.ignite.lang.*; import org.gridgain.grid.kernal.*; import org.gridgain.grid.util.direct.*; -import org.gridgain.grid.util.typedef.internal.*; import java.io.*; import java.nio.*; @@ -179,10 +178,10 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -191,9 +190,9 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { for (int i = commState.readItems; i < commState.readSize; i++) { if (!commState.keyDone) { - Object _val = commState.getMessage(null); + GridGgfsBlockKey _val = (GridGgfsBlockKey)commState.getMessage(null); - if (_val == MSG_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -202,7 +201,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; blocks.put((GridGgfsBlockKey)commState.cur, _val); @@ -220,21 +219,19 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { commState.idx++; case 1: - IgniteUuid fileId0 = commState.getGridUuid("fileId"); + fileId = commState.getGridUuid("fileId"); - if (fileId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - fileId = fileId0; - commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - id = commState.getLong("id"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java index e2fedec..f247c7d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java @@ -162,23 +162,19 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 1: - IgniteUuid id0 = commState.getGridUuid("id"); + id = commState.getGridUuid("id"); - if (id0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - id = id0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java index ce82844..f120fdc 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java @@ -330,45 +330,43 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid affKey0 = commState.getGridUuid("affKey"); + affKey = commState.getGridUuid("affKey"); - if (affKey0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - affKey = affKey0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - done = commState.getBoolean("done"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - if (buf.remaining() < 8) - return false; - endOff = commState.getLong("endOff"); + if (!commState.lastRead()) + return false; + commState.idx++; case 3: - if (buf.remaining() < 8) - return false; - startOff = commState.getLong("startOff"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - if (buf.remaining() < 4) - return false; - status = commState.getInt("status"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java index b35991b..34c8a0f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java @@ -154,21 +154,19 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid("fileId"); + fileId = commState.getGridUuid("fileId"); - if (fileId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - fileId = fileId0; - commState.idx++; case 1: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -176,9 +174,9 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { fragmentRanges = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - Object _val = commState.getMessage(null); + GridGgfsFileAffinityRange _val = (GridGgfsFileAffinityRange)commState.getMessage(null); - if (_val == MSG_NOT_READ) + if (!commState.lastRead()) return false; fragmentRanges.add((GridGgfsFileAffinityRange)_val); diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java index 5ea3ae5..a52d671 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java @@ -102,13 +102,11 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - IgniteUuid fileId0 = commState.getGridUuid("fileId"); + fileId = commState.getGridUuid("fileId"); - if (fileId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - fileId = fileId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java index 4cbec78..3ba6969 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java @@ -126,19 +126,19 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: - if (buf.remaining() < 8) - return false; - order = commState.getLong("order"); + if (!commState.lastRead()) + return false; + commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - res = commState.getBoolean("res"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index df9fd66..25a1938 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -78,13 +78,11 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa switch (commState.idx) { case 0: - byte[] bytes0 = commState.getByteArray("bytes"); + bytes = commState.getByteArray("bytes"); - if (bytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - bytes = bytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index bf3ee7c..5833251 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -67,11 +67,11 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess switch (commState.idx) { case 0: - if (buf.remaining() < 1) - return false; - code = commState.getByte("code"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java index 128c657..c866797 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java @@ -173,49 +173,43 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - UUID clientId0 = commState.getUuid("clientId"); + clientId = commState.getUuid("clientId"); - if (clientId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - clientId = clientId0; - commState.idx++; case 1: - UUID destId0 = commState.getUuid("destId"); + destId = commState.getUuid("destId"); - if (destId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - destId = destId0; - commState.idx++; case 2: - ByteBuffer msg0 = commState.getByteBuffer("msg"); + msg = commState.getByteBuffer("msg"); - if (msg0 == BYTE_BUF_NOT_READ) + if (!commState.lastRead()) return false; - msg = msg0; - commState.idx++; case 3: - if (buf.remaining() < 4) - return false; - msgSize = commState.getInt("msgSize"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: - if (buf.remaining() < 8) - return false; - reqId = commState.getLong("reqId"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java index ea1da3d..e4d06c3 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -53,11 +53,11 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - if (buf.remaining() < 4) - return false; - size = commState.getInt("size"); + if (!commState.lastRead()) + return false; + commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java index 1894d03..cd06c68 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -146,23 +146,19 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - IgniteUuid taskId0 = commState.getGridUuid("taskId"); + taskId = commState.getGridUuid("taskId"); - if (taskId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - taskId = taskId0; - commState.idx++; case 1: - byte[] topicBytes0 = commState.getByteArray("topicBytes"); + topicBytes = commState.getByteArray("topicBytes"); - if (topicBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - topicBytes = topicBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java index 6d30432..6810315 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -178,39 +178,35 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - String err0 = commState.getString("err"); + err = commState.getString("err"); - if (err0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - err = err0; - commState.idx++; case 1: - if (buf.remaining() < 1) - return false; - finished = commState.getBoolean("finished"); + if (!commState.lastRead()) + return false; + commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - found = commState.getBoolean("found"); + if (!commState.lastRead()) + return false; + commState.idx++; case 3: - byte[] resBytes0 = commState.getByteArray("resBytes"); + resBytes = commState.getByteArray("resBytes"); - if (resBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - resBytes = resBytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 4aebe54..bc5dc95 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -82,13 +82,11 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap switch (commState.idx) { case 0: - byte[] bytes0 = commState.getByteArray("bytes"); + bytes = commState.getByteArray("bytes"); - if (bytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - bytes = bytes0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java index 358b7a4..879952e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java @@ -94,13 +94,11 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte switch (commState.idx) { case 0: - IgniteUuid cancelledFutId0 = commState.getGridUuid("cancelledFutId"); + cancelledFutId = commState.getGridUuid("cancelledFutId"); - if (cancelledFutId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - cancelledFutId = cancelledFutId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java index be546c6..709e718 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java @@ -263,49 +263,45 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda switch (commState.idx) { case 0: - byte[] batchBytes0 = commState.getByteArray("batchBytes"); + batchBytes = commState.getByteArray("batchBytes"); - if (batchBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - batchBytes = batchBytes0; - commState.idx++; case 1: - IgniteUuid clsLdrId0 = commState.getGridUuid("clsLdrId"); + clsLdrId = commState.getGridUuid("clsLdrId"); - if (clsLdrId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - clsLdrId = clsLdrId0; - commState.idx++; case 2: - if (buf.remaining() < 1) - return false; - byte depMode0 = commState.getByte("depMode"); + if (!commState.lastRead()) + return false; + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); commState.idx++; case 3: - if (buf.remaining() < 1) - return false; - forceLocDep = commState.getBoolean("forceLocDep"); + if (!commState.lastRead()) + return false; + commState.idx++; case 4: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -316,7 +312,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda if (!commState.keyDone) { UUID _val = commState.getUuid(null); - if (_val == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.cur = _val; @@ -325,7 +321,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda IgniteUuid _val = commState.getGridUuid(null); - if (_val == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; ldrParticipants.put((UUID)commState.cur, _val); @@ -343,23 +339,19 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda commState.idx++; case 5: - String sampleClsName0 = commState.getString("sampleClsName"); + sampleClsName = commState.getString("sampleClsName"); - if (sampleClsName0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - sampleClsName = sampleClsName0; - commState.idx++; case 6: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); - if (userVer0 == STR_NOT_READ) + if (!commState.lastRead()) return false; - userVer = userVer0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java index bfaeb09..790432e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java @@ -121,23 +121,19 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { switch (commState.idx) { case 0: - byte[] errBytes0 = commState.getByteArray("errBytes"); + errBytes = commState.getByteArray("errBytes"); - if (errBytes0 == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; - errBytes = errBytes0; - commState.idx++; case 1: - IgniteUuid futId0 = commState.getGridUuid("futId"); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java index 108425c..c08d15f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java @@ -9,12 +9,19 @@ package org.gridgain.grid.util.direct; +import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.gridgain.grid.kernal.processors.cache.distributed.dht.preloader.*; +import org.gridgain.grid.kernal.processors.clock.*; +import org.gridgain.grid.util.*; import java.io.*; import java.nio.*; import java.util.*; +import static org.apache.ignite.events.IgniteEventType.*; + /** * Communication message adapter. */ @@ -23,6 +30,89 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable private static final long serialVersionUID = 0L; /** */ + public static final byte[] BYTE_ARR_NOT_READ = new byte[0]; + + /** */ + public static final short[] SHORT_ARR_NOT_READ = new short[0]; + + /** */ + public static final int[] INT_ARR_NOT_READ = new int[0]; + + /** */ + public static final long[] LONG_ARR_NOT_READ = new long[0]; + + /** */ + public static final float[] FLOAT_ARR_NOT_READ = new float[0]; + + /** */ + public static final double[] DOUBLE_ARR_NOT_READ = new double[0]; + + /** */ + public static final char[] CHAR_ARR_NOT_READ = new char[0]; + + /** */ + public static final boolean[] BOOLEAN_ARR_NOT_READ = new boolean[0]; + + /** */ + public static final UUID UUID_NOT_READ = new UUID(0, 0); + + /** */ + public static final ByteBuffer BYTE_BUF_NOT_READ = ByteBuffer.allocate(0); + + /** */ + public static final IgniteUuid GRID_UUID_NOT_READ = new IgniteUuid(new UUID(0, 0), 0); + + /** */ + public static final GridClockDeltaVersion CLOCK_DELTA_VER_NOT_READ = new GridClockDeltaVersion(0, 0); + + /** */ + public static final GridByteArrayList BYTE_ARR_LIST_NOT_READ = new GridByteArrayList(new byte[0]); + + /** */ + public static final GridLongList LONG_LIST_NOT_READ = new GridLongList(0); + + /** */ + public static final GridCacheVersion CACHE_VER_NOT_READ = new GridCacheVersion(0, 0, 0, 0); + + /** */ + public static final GridDhtPartitionExchangeId DHT_PART_EXCHANGE_ID_NOT_READ = + new GridDhtPartitionExchangeId(new UUID(0, 0), EVT_NODE_LEFT, 1); + + /** */ + public static final GridCacheValueBytes VAL_BYTES_NOT_READ = new GridCacheValueBytes(); + + /** */ + @SuppressWarnings("RedundantStringConstructorCall") + public static final String STR_NOT_READ = new String(); + + /** */ + public static final BitSet BIT_SET_NOT_READ = new BitSet(); + + /** */ + public static final GridTcpCommunicationMessageAdapter MSG_NOT_READ = new GridTcpCommunicationMessageAdapter() { + @SuppressWarnings("CloneDoesntCallSuperClone") + @Override public GridTcpCommunicationMessageAdapter clone() { + throw new UnsupportedOperationException(); + } + + @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + throw new UnsupportedOperationException(); + } + + @Override public boolean writeTo(ByteBuffer buf) { + throw new UnsupportedOperationException(); + } + + @Override public boolean readFrom(ByteBuffer buf) { + throw new UnsupportedOperationException(); + } + + @Override public byte directType() { + throw new UnsupportedOperationException(); + } + }; + + /** */ protected static final Object NULL = new Object(); /** */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java index 6f6cf81..b61e418 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java @@ -759,4 +759,8 @@ public class GridTcpCommunicationMessageState { public final GridTcpCommunicationMessageAdapter getMessage(String name) { return reader.readMessage(name); } + + public final boolean lastRead() { + return reader.isLastRead(); + } } -- 1.9.3 (Apple Git-50) From 7c93b5e9def21eed8b35795035d9ed2fa0acfb3b Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sun, 1 Feb 2015 19:26:40 -0800 Subject: [PATCH 13/71] # IGNITE-61 - Fixed compilation --- .../ignite/internal/GridJobExecuteRequest.java | 2 +- .../internal/managers/GridManagerAdapter.java | 2 +- .../managers/communication/GridIoManager.java | 19 ++++---- .../distributed/GridCacheTtlUpdateRequest.java | 50 +++++++++++----------- .../cache/distributed/dht/GridDhtLockRequest.java | 4 +- .../distributed/dht/GridDhtTxFinishRequest.java | 8 ++-- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 10 ++--- .../dht/atomic/GridNearAtomicUpdateRequest.java | 4 +- .../cache/distributed/near/GridNearGetRequest.java | 4 +- .../apache/ignite/internal/util/IgniteUtils.java | 1 + .../direct/GridTcpCommunicationMessageAdapter.java | 5 ++- .../direct/GridTcpCommunicationMessageState.java | 5 ++- .../ignite/internal/util/ipc/IpcToNioAdapter.java | 1 + .../ignite/internal/util/nio/GridDirectParser.java | 5 +-- .../extensions/communication/MessageReader.java | 2 +- .../extensions/communication/MessageWriter.java | 2 +- .../org/apache/ignite/spi/IgniteSpiAdapter.java | 3 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 8 ++-- .../GridTcpCommunicationByteBufferStream.java | 8 ++-- .../direct/GridTcpCommunicationMessageReader.java | 3 +- .../direct/GridTcpCommunicationMessageWriter.java | 1 + .../ignite/testframework/GridSpiTestContext.java | 13 +++--- 22 files changed, 83 insertions(+), 77 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index 929f718..d26ce22 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -832,7 +832,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 16: - UUID subjId0 = commState.getUuid(); + UUID subjId0 = commState.getUuid(null); if (subjId0 == UUID_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java index a5c5e47..3cb470c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java @@ -516,7 +516,7 @@ public abstract class GridManagerAdapter implements GridMan return e != null ? (V)e.value() : null; } - @Override public MessageFactory messageFactory() { + @Override public GridTcpMessageFactory messageFactory() { return ctx.io().messageFactory(); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index b918b68..e26a124 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -21,21 +21,22 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.marshaller.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.spi.*; -import org.apache.ignite.spi.communication.*; import org.apache.ignite.internal.managers.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.timeout.*; +import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.direct.*; 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.internal.util.worker.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; +import org.apache.ignite.spi.*; +import org.apache.ignite.spi.communication.*; +import org.gridgain.grid.util.direct.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -138,7 +139,7 @@ public class GridIoManager extends GridManagerAdapter pluginMsgs; /** */ - private MessageFactory msgFactory; + private GridTcpMessageFactory msgFactory; /** */ private MessageWriterFactory writerFactory; @@ -200,7 +201,7 @@ public class GridIoManager extends GridManagerAdapter extends GridCacheMessage { return false; if (!commState.typeWritten) { - if (!commState.putByte(directType())) + if (!commState.putByte(null, directType())) return false; commState.typeWritten = true; @@ -211,7 +211,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 3: if (keysBytes != null) { if (commState.it == null) { - if (!commState.putInt(keysBytes.size())) + if (!commState.putInt(null, keysBytes.size())) return false; commState.it = keysBytes.iterator(); @@ -221,7 +221,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -229,7 +229,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -238,7 +238,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 4: if (nearKeysBytes != null) { if (commState.it == null) { - if (!commState.putInt(nearKeysBytes.size())) + if (!commState.putInt(null, nearKeysBytes.size())) return false; commState.it = nearKeysBytes.iterator(); @@ -248,7 +248,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putByteArray((byte[])commState.cur)) + if (!commState.putByteArray(null, (byte[])commState.cur)) return false; commState.cur = NULL; @@ -256,7 +256,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -265,7 +265,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 5: if (nearVers != null) { if (commState.it == null) { - if (!commState.putInt(nearVers.size())) + if (!commState.putInt(null, nearVers.size())) return false; commState.it = nearVers.iterator(); @@ -275,7 +275,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -283,20 +283,20 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } commState.idx++; case 6: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 7: - if (!commState.putLong(ttl)) + if (!commState.putLong(null, ttl)) return false; commState.idx++; @@ -304,7 +304,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 8: if (vers != null) { if (commState.it == null) { - if (!commState.putInt(vers.size())) + if (!commState.putInt(null, vers.size())) return false; commState.it = vers.iterator(); @@ -314,7 +314,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (commState.cur == NULL) commState.cur = commState.it.next(); - if (!commState.putCacheVersion((GridCacheVersion)commState.cur)) + if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) return false; commState.cur = NULL; @@ -322,7 +322,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.it = null; } else { - if (!commState.putInt(-1)) + if (!commState.putInt(null, -1)) return false; } @@ -346,7 +346,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -354,7 +354,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { keysBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -375,7 +375,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -383,7 +383,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { nearKeysBytes = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -404,7 +404,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -412,7 +412,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { nearVers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; @@ -432,7 +432,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 8) return false; - topVer = commState.getLong(); + topVer = commState.getLong(null); commState.idx++; @@ -440,7 +440,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 8) return false; - ttl = commState.getLong(); + ttl = commState.getLong(null); commState.idx++; @@ -449,7 +449,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -457,7 +457,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { vers = new ArrayList<>(commState.readSize); for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(); + GridCacheVersion _val = commState.getCacheVersion(null); if (_val == CACHE_VER_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java index b5fe8b3..8ed9715 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java @@ -458,7 +458,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 32: - if (!commState.putLong(accessTtl)) + if (!commState.putLong(null, accessTtl)) return false; commState.idx++; @@ -566,7 +566,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { if (buf.remaining() < 8) return false; - accessTtl = commState.getLong(); + accessTtl = commState.getLong(null); commState.idx++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 30987df..c394cf6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -506,13 +506,13 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 32: - if (!commState.putLongList(ttls)) + if (!commState.putLongList(null, ttls)) return false; commState.idx++; case 33: - if (!commState.putLongList(nearTtls)) + if (!commState.putLongList(null, nearTtls)) return false; commState.idx++; @@ -664,7 +664,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 32: - GridLongList ttls0 = commState.getLongList(); + GridLongList ttls0 = commState.getLongList(null); if (ttls0 == LONG_LIST_NOT_READ) return false; @@ -674,7 +674,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 33: - GridLongList nearTtls0 = commState.getLongList(); + GridLongList nearTtls0 = commState.getLongList(null); if (nearTtls0 == LONG_LIST_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 6f7ce44..baf929b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -866,13 +866,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 12: - if (!commState.putLong(topVer)) + if (!commState.putLong(null, topVer)) return false; commState.idx++; case 13: - if (!commState.putLongList(ttls)) + if (!commState.putLongList(null, ttls)) return false; commState.idx++; @@ -1100,7 +1100,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { @@ -1154,7 +1154,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - GridLongList nearExpireTimes0 = commState.getLongList(); + GridLongList nearExpireTimes0 = commState.getLongList(null); if (nearExpireTimes0 == LONG_LIST_NOT_READ) return false; @@ -1164,7 +1164,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 9: - GridLongList nearTtls0 = commState.getLongList(); + GridLongList nearTtls0 = commState.getLongList(null); if (nearTtls0 == LONG_LIST_NOT_READ) return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index e095e1f..e27065e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -955,7 +955,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im invokeArgsBytes = new byte[commState.readSize][]; for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(); + byte[] _val = commState.getByteArray(null); if (_val == BYTE_ARR_NOT_READ) return false; @@ -976,7 +976,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im if (buf.remaining() < 4) return false; - commState.readSize = commState.getInt(); + commState.readSize = commState.getInt(null); } if (commState.readSize >= 0) { 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 2a51d59..033e793 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 @@ -297,7 +297,7 @@ public class GridNearGetRequest extends GridCacheMessage implements switch (commState.idx) { case 3: - if (!commState.putLong(accessTtl)) + if (!commState.putLong(null, accessTtl)) return false; commState.idx++; @@ -433,7 +433,7 @@ public class GridNearGetRequest extends GridCacheMessage implements if (buf.remaining() < 8) return false; - accessTtl = commState.getLong(); + accessTtl = commState.getLong(null); commState.idx++; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 5ba3403..75939e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -27,6 +27,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.mxbean.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; import org.apache.ignite.portables.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java index 822c0bc..3580cb7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java @@ -18,11 +18,12 @@ package org.apache.ignite.internal.util.direct; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java index 85717e4..44b22ce 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java @@ -18,11 +18,12 @@ package org.apache.ignite.internal.util.direct; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import sun.misc.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java index d9daba6..043e2bb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.util.ipc; import org.apache.ignite.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; +import org.apache.ignite.internal.util.typedef.internal.*; import java.io.*; import java.nio.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java index 350d0b1..b87236c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java @@ -18,9 +18,8 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.spi.*; import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.spi.*; import org.jetbrains.annotations.*; import java.io.*; @@ -37,7 +36,7 @@ public class GridDirectParser implements GridNioParser { private IgniteSpiAdapter spi; /** */ - private MessageFactory msgFactory; + private GridTcpMessageFactory msgFactory; /** * @param spi Spi. diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index dc2bee8..1431738 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -9,8 +9,8 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.plugin.*; -import org.gridgain.grid.util.direct.*; import java.nio.*; diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index ce0b249..125c84c 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -9,8 +9,8 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.plugin.*; -import org.gridgain.grid.util.direct.*; import java.nio.*; diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java index 892c0de..4b07a0e 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.authentication.*; import org.apache.ignite.internal.managers.communication.*; @@ -727,7 +728,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement } /** {@inheritDoc} */ - @Override public MessageFactory messageFactory() { + @Override public GridTcpMessageFactory messageFactory() { return null; } } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java index 822dae7..af4c54a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java @@ -20,11 +20,11 @@ package org.apache.ignite.spi; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.plugin.security.*; -import org.apache.ignite.spi.swapspace.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.security.*; +import org.apache.ignite.spi.swapspace.*; import org.jetbrains.annotations.*; import java.io.*; @@ -399,5 +399,5 @@ public interface IgniteSpiContext { /** * @return Message factory. */ - public MessageFactory messageFactory(); + public GridTcpMessageFactory messageFactory(); } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index 0de1ea3..85ce982 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -9,8 +9,8 @@ package org.gridgain.grid.util.direct; -import org.apache.ignite.plugin.extensions.communication.*; -import org.gridgain.grid.util.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.direct.*; import org.jetbrains.annotations.*; import sun.misc.*; import sun.nio.ch.*; @@ -193,7 +193,7 @@ public class GridTcpCommunicationByteBufferStream { }; /** */ - private final MessageFactory msgFactory; + private final GridTcpMessageFactory msgFactory; /** */ private ByteBuffer buf; @@ -228,7 +228,7 @@ public class GridTcpCommunicationByteBufferStream { /** * @param msgFactory Message factory. */ - public GridTcpCommunicationByteBufferStream(@Nullable MessageFactory msgFactory) { + public GridTcpCommunicationByteBufferStream(@Nullable GridTcpMessageFactory msgFactory) { this.msgFactory = msgFactory; } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java index 1645fb5..278beca 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java @@ -9,6 +9,7 @@ package org.gridgain.grid.util.direct; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; @@ -27,7 +28,7 @@ public class GridTcpCommunicationMessageReader implements MessageReader { /** * @param msgFactory Message factory. */ - public GridTcpCommunicationMessageReader(MessageFactory msgFactory) { + public GridTcpCommunicationMessageReader(GridTcpMessageFactory msgFactory) { this.stream = new GridTcpCommunicationByteBufferStream(msgFactory); } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java index 101015c..82ad4f8 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java @@ -9,6 +9,7 @@ package org.gridgain.grid.util.direct; +import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index 6b5003f..4bba5eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -21,15 +21,14 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.plugin.security.*; -import org.apache.ignite.spi.*; -import org.apache.ignite.spi.swapspace.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.security.*; +import org.apache.ignite.spi.*; +import org.apache.ignite.spi.swapspace.*; import org.jetbrains.annotations.*; import java.io.*; @@ -518,8 +517,8 @@ public class GridSpiTestContext implements IgniteSpiContext { } /** {@inheritDoc} */ - @Override public MessageFactory messageFactory() { - return new MessageFactory() { + @Override public GridTcpMessageFactory messageFactory() { + return new GridTcpMessageFactory() { @Override public GridTcpCommunicationMessageAdapter create(byte type) { return GridTcpCommunicationMessageFactory.create(type); } -- 1.9.3 (Apple Git-50) From b2d5666fae0665156d2b75d093919602eab0de56 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 2 Feb 2015 11:22:28 -0800 Subject: [PATCH 14/71] # IGNITE-61 - Moved code generator --- modules/tools/pom.xml | 6 + .../codegen/CommunicationMessageCodeGenerator.java | 1233 ++++++++++++++++++++ .../ignite/codegen/generated-classes-order.txt | 79 ++ 3 files changed, 1318 insertions(+) create mode 100644 modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java create mode 100644 modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml index deab202..d81e692 100644 --- a/modules/tools/pom.xml +++ b/modules/tools/pom.xml @@ -42,6 +42,12 @@ + org.apache.ignite + ignite-core + ${ignite.version} + + + org.jodd jodd-lagarto 3.4.8 diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java new file mode 100644 index 0000000..8679aeb --- /dev/null +++ b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -0,0 +1,1233 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.codegen; + +import com.sun.istack.internal.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; + +import java.io.*; +import java.lang.reflect.*; +import java.net.*; +import java.nio.*; +import java.util.*; + +import static java.lang.reflect.Modifier.*; + +/** + * Direct marshallable code generator. + */ +public class CommunicationMessageCodeGenerator { + /** */ + private static final Comparator FIELD_CMP = new Comparator() { + @Override public int compare(Field f1, Field f2) { + int ver1 = 0; + + GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); + + if (verAnn1 != null) { + ver1 = verAnn1.value(); + + assert ver1 > 0; + } + + int ver2 = 0; + + GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); + + if (verAnn2 != null) { + ver2 = verAnn2.value(); + + assert ver2 > 0; + } + + return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); + } + }; + + /** */ + private static final String CLASSES_ORDER_FILE = U.getGridGainHome() + + "/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt"; + + /** */ + private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; + + /** */ + private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; + + /** */ + private static final String EMPTY = ""; + + /** */ + private static final String TAB = " "; + + /** */ + private static final String COMM_STATE_VAR = "commState"; + + /** */ + private static final String BUF_VAR = "buf"; + + /** */ + private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; + + /** */ + private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; + + /** */ + private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; + + /** */ + private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; + + /** */ + private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; + + /** */ + private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; + + /** */ + private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; + + /** */ + private static final String DFLT_LOC_VAR = "_val"; + + /** */ + private final Collection write = new ArrayList<>(); + + /** */ + private final Collection read = new ArrayList<>(); + + /** */ + private final Collection clone = new ArrayList<>(); + + /** */ + private final Collection clone0 = new ArrayList<>(); + + /** */ + private final Map, Integer> fieldCnt = new HashMap<>(); + + /** */ + private byte type = -1; + + /** */ + private List fields; + + /** */ + private int indent; + + /** + * @param args Arguments. + */ + public static void main(String[] args) { + CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); + + try { +// gen.generateAndWrite(GridDistributedLockRequest.class); +// gen.generateAndWrite(GridNearLockRequest.class); +// gen.generateAndWrite(GridDhtLockRequest.class); +// gen.generateAndWrite(GridDistributedLockResponse.class); +// gen.generateAndWrite(GridNearLockResponse.class); +// gen.generateAndWrite(GridDhtLockResponse.class); +// +// gen.generateAndWrite(GridDistributedTxPrepareRequest.class); +// gen.generateAndWrite(GridNearTxPrepareRequest.class); +// gen.generateAndWrite(GridDhtTxPrepareRequest.class); +// gen.generateAndWrite(GridDistributedTxPrepareResponse.class); +// gen.generateAndWrite(GridNearTxPrepareResponse.class); +// gen.generateAndWrite(GridDhtTxPrepareResponse.class); +// +// gen.generateAndWrite(GridDistributedTxFinishRequest.class); +// gen.generateAndWrite(GridNearTxFinishRequest.class); +// gen.generateAndWrite(GridDhtTxFinishRequest.class); +// gen.generateAndWrite(GridDistributedTxFinishResponse.class); +// gen.generateAndWrite(GridNearTxFinishResponse.class); +// gen.generateAndWrite(GridDhtTxFinishResponse.class); + + gen.generateAll(true); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Generates code for all classes. + * + * @param write Whether to write to file. + * @throws Exception In case of error. + */ + public void generateAll(boolean write) throws Exception { + type = 0; + + Map classesOrder = classesOrder(); + + Collection> classes = classes(classesOrder); + + for (Class cls : classes) { + Integer t = classesOrder.get(cls.getName()); + + type = t != null ? t.byteValue() : 0; + + System.out.println("Processing class: " + cls.getName() + + (Modifier.isAbstract(cls.getModifiers()) ? " (abstract)" : "")); + + if (write) + generateAndWrite(cls); + else + generate(cls); + } + } + + /** + * Generates code for provided class and writes it to source file. + * Note: this method must be called only from {@code generateAll(boolean)} + * and only with updating {@code CLASSES_ORDER_FILE} and other auto generated files. + * + * @param cls Class. + * @throws Exception In case of error. + */ + @SuppressWarnings("ConstantConditions") + private void generateAndWrite(Class cls) throws Exception { + assert cls != null; + + generate(cls); + + File file = new File(SRC_DIR, cls.getName().replace('.', File.separatorChar) + ".java"); + + if (!file.exists() || !file.isFile()) { + System.out.println(" Source file not found: " + file.getPath()); + + return; + } + + Collection src = new ArrayList<>(); + + BufferedReader rdr = null; + + try { + rdr = new BufferedReader(new FileReader(file)); + + String line; + boolean skip = false; + + boolean writeFound = false; + boolean readFound = false; + boolean typeFound = false; + boolean cloneFound = false; + boolean clone0Found = false; + + while ((line = rdr.readLine()) != null) { + if (!skip) { + src.add(line); + + if (line.contains("public boolean writeTo(ByteBuffer buf)")) { + src.addAll(write); + + skip = true; + + writeFound = true; + } + else if (line.contains("public boolean readFrom(ByteBuffer buf)")) { + src.addAll(read); + + skip = true; + + readFound = true; + } +// else if (type >= 0 && line.contains("public byte directType()")) { +// src.add(TAB + TAB + "return " + type + ';'); +// +// skip = true; +// +// typeFound = true; +// } + else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { + src.addAll(clone); + + skip = true; + + cloneFound = true; + } + else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { + src.addAll(clone0); + + skip = true; + + clone0Found = true; + } + } + else if (line.startsWith(TAB + "}")) { + src.add(line); + + skip = false; + } + } + + if (!writeFound) + System.out.println(" writeTo method doesn't exist."); + + if (!readFound) + System.out.println(" readFrom method doesn't exist."); + + if (!typeFound) + System.out.println(" directType method doesn't exist."); + + if (!cloneFound) + System.out.println(" clone method doesn't exist."); + + if (!clone0Found) + System.out.println(" clone0 method doesn't exist."); + } + finally { + if (rdr != null) + rdr.close(); + } + + BufferedWriter wr = null; + + try { + wr = new BufferedWriter(new FileWriter(file)); + + for (String line : src) + wr.write(line + '\n'); + } + finally { + if (wr != null) + wr.close(); + } + } + + /** + * Generates code for provided class. + * + * @param cls Class. + * @throws Exception In case of error. + */ + public void generate(Class cls) throws Exception { + assert cls != null; + + write.clear(); + read.clear(); + clone.clear(); + clone0.clear(); + + fields = new ArrayList<>(); + + Field[] declaredFields = cls.getDeclaredFields(); + + for (Field field : declaredFields) { + int mod = field.getModifiers(); + + if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) + fields.add(field); + } + + Collections.sort(fields, FIELD_CMP); + + indent = 2; + + boolean hasSuper = cls.getSuperclass() != BASE_CLS; + + String clsName = cls.getSimpleName(); + + if (!Modifier.isAbstract(cls.getModifiers())) { + clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString()); + clone.add(EMPTY); + clone.add(builder().a("clone0(_clone);").toString()); + clone.add(EMPTY); + clone.add(builder().a("return _clone;").toString()); + } + + if (hasSuper) { + clone0.add(builder().a("super.clone0(_msg);").toString()); + clone0.add(EMPTY); + } + + Collection cloningFields = new ArrayList<>(declaredFields.length); + + for (Field field: declaredFields) + if (!isStatic(field.getModifiers())) + cloningFields.add(field); + + if (!cloningFields.isEmpty()) { + clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString()); + clone0.add(EMPTY); + + for (Field field : cloningFields) { + String name = field.getName(); + Class type = field.getType(); + + String res = name; + + if (BASE_CLS.isAssignableFrom(type)) + res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; + + clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); + } + } + + start(write, hasSuper ? "writeTo" : null, true); + start(read, hasSuper ? "readFrom" : null, false); + + indent++; + + int state = startState(cls); + + for (Field field : fields) + processField(field, state++); + + indent--; + + finish(write); + finish(read); + } + + /** + * @param cls Message class. + * @return Start state. + */ + private int startState(Class cls) { + assert cls != null; + + Class superCls = cls.getSuperclass(); + + Integer state = fieldCnt.get(superCls); + + if (state != null) + return state; + + state = 0; + + while (cls.getSuperclass() != BASE_CLS) { + cls = cls.getSuperclass(); + + for (Field field : cls.getDeclaredFields()) { + int mod = field.getModifiers(); + + if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) + state++; + } + } + + fieldCnt.put(superCls, state); + + return state; + } + + /** + * @param code Code lines. + * @param superMtd Super class method name. + * @param writeType Whether to write message type. + */ + private void start(Collection code, @Nullable String superMtd, boolean writeType) { + assert code != null; + + code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); + code.add(EMPTY); + + if (superMtd != null) { + returnFalseIfFailed(code, "super." + superMtd, BUF_VAR); + + code.add(EMPTY); + } + + if (writeType) { + code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); + + indent++; + + returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); + + code.add(EMPTY); + code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); + + indent--; + + code.add(builder().a("}").toString()); + code.add(EMPTY); + } + + if (!fields.isEmpty()) + code.add(builder().a("switch (").a(STATE_VAR).a(") {").toString()); + } + + /** + * @param code Code lines. + */ + private void finish(Collection code) { + assert code != null; + + if (!fields.isEmpty()) { + code.add(builder().a("}").toString()); + code.add(EMPTY); + } + + code.add(builder().a("return true;").toString()); + } + + /** + * @param field Field. + * @param opt Case option. + */ + private void processField(Field field, int opt) { + assert field != null; + assert opt >= 0; + + GridDirectCollection colAnn = field.getAnnotation(GridDirectCollection.class); + GridDirectMap mapAnn = field.getAnnotation(GridDirectMap.class); + + if (colAnn == null && Collection.class.isAssignableFrom(field.getType())) + throw new IllegalStateException("@GridDirectCollection annotation is not provided for field: " + + field.getName()); + + if (mapAnn == null && Map.class.isAssignableFrom(field.getType())) + throw new IllegalStateException("@GridDirectMap annotation is not provided for field: " + field.getName()); + + writeField(field, opt, colAnn, mapAnn); + readField(field, opt, colAnn, mapAnn); + } + + /** + * @param field Field. + * @param opt Case option. + * @param colAnn Collection annotation. + * @param mapAnn Map annotation. + */ + private void writeField(Field field, int opt, @Nullable GridDirectCollection colAnn, + @Nullable GridDirectMap mapAnn) { + assert field != null; + assert opt >= 0; + + write.add(builder().a("case ").a(opt).a(":").toString()); + + indent++; + + returnFalseIfWriteFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, + mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); + + write.add(EMPTY); + write.add(builder().a(STATE_VAR).a("++;").toString()); + write.add(EMPTY); + + indent--; + } + + /** + * @param field Field. + * @param opt Case option. + * @param colAnn Collection annotation. + * @param mapAnn Map annotation. + */ + private void readField(Field field, int opt, @Nullable GridDirectCollection colAnn, + @Nullable GridDirectMap mapAnn) { + assert field != null; + assert opt >= 0; + + read.add(builder().a("case ").a(opt).a(":").toString()); + + indent++; + + returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, + mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); + + read.add(EMPTY); + read.add(builder().a(STATE_VAR).a("++;").toString()); + read.add(EMPTY); + + indent--; + } + + /** + * @param type Field type. + * @param name Field name. + * @param colItemType Collection item type. + * @param mapKeyType Map key type. + * @param mapValType Map key value. + * @param raw Raw write flag. + */ + private void returnFalseIfWriteFailed(Class type, String name, @Nullable Class colItemType, + @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { + assert type != null; + assert name != null; + + String field = raw ? "null" : '"' + name + '"'; + + if (type == byte.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); + else if (type == short.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); + else if (type == int.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); + else if (type == long.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); + else if (type == float.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); + else if (type == double.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); + else if (type == char.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); + else if (type == boolean.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); + else if (type == byte[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); + else if (type == short[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); + else if (type == int[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); + else if (type == long[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); + else if (type == float[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); + else if (type == double[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); + else if (type == char[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); + else if (type == boolean[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); + else if (type == UUID.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); + else if (type == ByteBuffer.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); + else if (type == IgniteUuid.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); + else if (type == GridClockDeltaVersion.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); + else if (type == GridByteArrayList.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); + else if (type == GridLongList.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); + else if (type == GridCacheVersion.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); + else if (type == GridDhtPartitionExchangeId.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); + else if (type == GridCacheValueBytes.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); + //else if (type == GridDrInternalRequestEntry.class) + // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); + else if (type == String.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); + else if (type == BitSet.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); + else if (type.isEnum()) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); + else if (BASE_CLS.isAssignableFrom(type)) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); + else if (type.isArray() || Collection.class.isAssignableFrom(type)) { + boolean isArr = type.isArray(); + + if (isArr) + colItemType = type.getComponentType(); + + assert colItemType != null; + + write.add(builder().a("if (").a(name).a(" != null) {").toString()); + + indent++; + + write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); + + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). + a(";").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). + toString()); + + indent++; + + write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); + + indent++; + + write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); + + indent--; + + write.add(EMPTY); + + returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, + null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = null;").toString()); + + indent--; + + write.add(builder().a("} else {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); + + indent--; + + write.add(builder().a("}").toString()); + } + else if (Map.class.isAssignableFrom(type)) { + assert mapKeyType != null; + assert mapValType != null; + + write.add(builder().a("if (").a(name).a(" != null) {").toString()); + + indent++; + + write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); + + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). + toString()); + + indent++; + + write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); + + indent++; + + write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); + + indent--; + + String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + + U.box(mapValType).getSimpleName() + ">"; + + write.add(EMPTY); + write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); + write.add(EMPTY); + write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); + + indent++; + + returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + + returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); + write.add(EMPTY); + write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = null;").toString()); + + indent--; + + write.add(builder().a("} else {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); + + indent--; + + write.add(builder().a("}").toString()); + } + else + throw new IllegalStateException("Unsupported type: " + type); + } + + /** + * @param type Field type. + * @param name Field name. + * @param colItemType Collection item type. + * @param mapKeyType Map key type. + * @param mapValType Map value type. + * @param raw Raw read flag. + */ + private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, + @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { + assert type != null; + + String field = raw ? "null" : '"' + name + '"'; + + String retType = type.getSimpleName(); + + if (type == byte.class) + returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); + else if (type == short.class) + returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); + else if (type == int.class) + returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); + else if (type == long.class) + returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); + else if (type == float.class) + returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); + else if (type == double.class) + returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); + else if (type == char.class) + returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); + else if (type == boolean.class) + returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); + else if (type == byte[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); + else if (type == short[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); + else if (type == int[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); + else if (type == long[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); + else if (type == float[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); + else if (type == double[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); + else if (type == char[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); + else if (type == boolean[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); + else if (type == UUID.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); + else if (type == ByteBuffer.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); + else if (type == IgniteUuid.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); + else if (type == GridClockDeltaVersion.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); + else if (type == GridLongList.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); + else if (type == GridByteArrayList.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); + else if (type == GridCacheVersion.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); + else if (type == GridDhtPartitionExchangeId.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); + else if (type == GridCacheValueBytes.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); + //else if (type == GridDrInternalRequestEntry.class) + // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); + else if (type == String.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); + else if (type == BitSet.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); + else if (type.isEnum()) { + assert name != null; + + returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); + + read.add(EMPTY); + read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); + } + else if (BASE_CLS.isAssignableFrom(type)) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); + else if (type.isArray() || Collection.class.isAssignableFrom(type)) { + assert name != null; + + boolean isArr = type.isArray(); + + if (isArr) + colItemType = type.getComponentType(); + + assert colItemType != null; + + Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; + + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); + + indent++; + + returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); + + indent++; + + read.add(builder().a("if (").a(name).a(" == null)").toString()); + + indent++; + + if (isArr) { + String val = colItemType.isArray() ? + colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : + colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; + + read.add(builder().a(name).a(" = new ").a(val).a(";"). + toString()); + } + else { + read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). + toString()); + } + + indent--; + + read.add(EMPTY); + read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). + toString()); + + indent++; + + String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(colItemType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). + a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); + read.add(EMPTY); + read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); + read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); + } + else if (Map.class.isAssignableFrom(type)) { + assert name != null; + assert mapKeyType != null; + assert mapValType != null; + + Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; + + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); + + indent++; + + returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); + + indent++; + + read.add(builder().a("if (").a(name).a(" == null)").toString()); + + indent++; + + read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). + toString()); + + indent--; + + read.add(EMPTY); + read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). + toString()); + + indent++; + + read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); + + indent++; + + String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); + read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + + var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(mapValType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). + a(", ").a(DFLT_LOC_VAR).a(");").toString()); + read.add(EMPTY); + read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); + read.add(EMPTY); + read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); + read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); + read.add(builder().a(CUR_VAR).a(" = null;").toString()); + } + else + throw new IllegalStateException("Unsupported type: " + type); + } + + /** + * @param retType Return type. + * @param var Variable name. + * @param locVar Local variable name. + * @param mtd Method name. + * @param arg Method argument. + * @param cast Whether cast is needed. + */ + private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, + @Nullable String arg, boolean cast) { + assert retType != null; + assert mtd != null; + + if (var == null) + var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); + + read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). + a(arg != null ? "(" + arg + ");" : "();").toString()); + read.add(EMPTY); + + read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); + + indent++; + + read.add(builder().a("return false;").toString()); + + indent--; + } + + /** + * @param code Code lines. + * @param accessor Field or method name. + * @param args Method arguments. + */ + private void returnFalseIfFailed(Collection code, String accessor, @Nullable String... args) { + assert code != null; + assert accessor != null; + + String argsStr = ""; + + if (args != null && args.length > 0) { + for (String arg : args) + argsStr += arg + ", "; + + argsStr = argsStr.substring(0, argsStr.length() - 2); + } + + code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); + + indent++; + + code.add(builder().a("return false;").toString()); + + indent--; + } + + /** + * Creates new builder with correct indent. + * + * @return Builder. + */ + private SB builder() { + assert indent > 0; + + SB sb = new SB(); + + for (int i = 0; i < indent; i++) + sb.a(TAB); + + return sb; + } + + /** + * Gets all direct marshallable classes. + * First classes will be classes from {@code classesOrder} with same order + * as ordered values. Other classes will be at the end and ordered by name + * (with package prefix). + * That orders need for saving {@code directType} value. + * + * @param classesOrder Map {class name => order number}. + * @return Classes. + * @throws Exception In case of error. + */ + private Collection> classes(final Map classesOrder) throws Exception { + Collection> col = new TreeSet<>(new Comparator>() { + @Override public int compare(Class o1, Class o2) { + Integer c1 = classesOrder.get(o1.getName()); + + Integer c2 = classesOrder.get(o2.getName()); + + if (c1 == null) + return c2 == null ? o1.getName().compareTo(o2.getName()) : 1; + else + return c2 == null ? -1 : c1.compareTo(c2); + } + }); + + URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); + + for (URL url : ldr.getURLs()) { + File file = new File(url.toURI()); + + int prefixLen = file.getPath().length() + 1; + + processFile(file, ldr, prefixLen, col); + } + + return col; + } + + /** + * Reads class names from {@code CLASSES_ORDER_FILE}. + * + * @return Map {class name => order number} + * @throws IOException In case of io error. + */ + private Map classesOrder() throws IOException { + BufferedReader reader = null; + + try { + reader = new BufferedReader(new FileReader(CLASSES_ORDER_FILE)); + + Map res = new HashMap<>(); + + while (true) { + String line = reader.readLine(); + + if (line == null) + break; + + line = line.trim(); + + if (!line.isEmpty()) + res.put(line, res.size()); + } + + return res; + } + finally { + if (reader != null) + reader.close(); + } + } + + /** + * Writes class names in {@code CLASSES_ORDER_FILE}. + * + * @param classes Classes for saving. + * @throws IOException In case of io error. + */ + private void classesOrder(Iterable> classes) + throws IOException { + Collection src = new ArrayList<>(); + + for (Class cls : classes) + src.add(cls.getName()); + + writeLines(new File(CLASSES_ORDER_FILE), src); + } + + /** + * Recursively process provided file or directory. + * + * @param file File. + * @param ldr Class loader. + * @param prefixLen Path prefix length. + * @param col Classes. + * @throws Exception In case of error. + */ + private void processFile(File file, ClassLoader ldr, int prefixLen, + Collection> col) throws Exception { + assert file != null; + assert ldr != null; + assert prefixLen > 0; + assert col != null; + + if (!file.exists()) + throw new FileNotFoundException("File doesn't exist: " + file); + + if (file.isDirectory()) { + for (File f : file.listFiles()) + processFile(f, ldr, prefixLen, col); + } + else { + assert file.isFile(); + + String path = file.getPath(); + + if (path.endsWith(".class")) { + String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); + + Class cls = Class.forName(clsName, false, ldr); + + if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && + !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) + col.add((Class)cls); + } + } + } + + /** + * Writes lines in file. + * + * @param file File. + * @param lines Lines. + * @throws IOException In case of io error. + */ + private void writeLines(File file, Iterable lines) throws IOException { + BufferedWriter writer = null; + + try { + writer = new BufferedWriter(new FileWriter(file)); + + for (String line : lines) + writer.write(line + '\n'); + } + finally { + if (writer != null) + writer.close(); + } + } +} diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt b/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt new file mode 100644 index 0000000..88ca4ac --- /dev/null +++ b/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt @@ -0,0 +1,79 @@ +org.apache.ignite.internal.GridJobCancelRequest +org.apache.ignite.internal.GridJobExecuteRequest +org.apache.ignite.internal.GridJobExecuteResponse +org.apache.ignite.internal.GridJobSiblingsRequest +org.apache.ignite.internal.GridJobSiblingsResponse +org.apache.ignite.internal.GridTaskCancelRequest +org.apache.ignite.internal.GridTaskSessionRequest +org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest +org.apache.ignite.internal.managers.communication.GridIoMessage +org.apache.ignite.internal.managers.communication.GridIoUserMessage +org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean +org.apache.ignite.internal.managers.deployment.GridDeploymentRequest +org.apache.ignite.internal.managers.deployment.GridDeploymentResponse +org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage +org.apache.ignite.internal.processors.cache.GridCacheEvictionRequest +org.apache.ignite.internal.processors.cache.GridCacheEvictionResponse +org.apache.ignite.internal.processors.cache.distributed.GridCacheOptimisticCheckPreparedTxRequest +org.apache.ignite.internal.processors.cache.distributed.GridCacheOptimisticCheckPreparedTxResponse +org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxRequest +org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxResponse +org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest +org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockResponse +org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest +org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse +org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest +org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareResponse +org.apache.ignite.internal.processors.cache.distributed.GridDistributedUnlockRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest +org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse +org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest +org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse +org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest +org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest +org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest +org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse +org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest +org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse +org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest +org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse +org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest +org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse +org.apache.ignite.internal.processors.cache.distributed.near.GridNearUnlockRequest +org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest +org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse +org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage +org.apache.ignite.internal.processors.continuous.GridContinuousMessage +org.apache.ignite.internal.processors.dataload.GridDataLoadRequest +org.apache.ignite.internal.processors.dataload.GridDataLoadResponse +org.apache.ignite.internal.processors.dr.messages.internal.GridDrInternalRequest +org.apache.ignite.internal.processors.dr.messages.internal.GridDrInternalResponse +org.apache.ignite.internal.processors.ggfs.GridGgfsAckMessage +org.apache.ignite.internal.processors.ggfs.GridGgfsBlockKey +org.apache.ignite.internal.processors.ggfs.GridGgfsBlocksMessage +org.apache.ignite.internal.processors.ggfs.GridGgfsDeleteMessage +org.apache.ignite.internal.processors.ggfs.GridGgfsFileAffinityRange +org.apache.ignite.internal.processors.ggfs.GridGgfsFragmentizerRequest +org.apache.ignite.internal.processors.ggfs.GridGgfsFragmentizerResponse +org.apache.ignite.internal.processors.ggfs.GridGgfsSyncMessage +org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest +org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultResponse +org.apache.ignite.internal.processors.streamer.GridStreamerCancelRequest +org.apache.ignite.internal.processors.streamer.GridStreamerExecutionRequest +org.apache.ignite.internal.processors.streamer.GridStreamerResponse +org.apache.ignite.spi.collision.jobstealing.JobStealingRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentRequest +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse -- 1.9.3 (Apple Git-50) From 1f80aebe8025ae9e72809319d8a9c017913f217e Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 2 Feb 2015 12:27:58 -0800 Subject: [PATCH 15/71] # IGNITE-61 - Direct marshalling --- .../ignite/internal/processors/continuous/GridContinuousMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java index 11339c6..50e1b40 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java @@ -141,8 +141,8 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter msg) { - GridContinuousMessage clone = (GridContinuousMessage)msg; + @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + GridContinuousMessage clone = (GridContinuousMessage)_msg; clone.type = type; clone.routineId = routineId; -- 1.9.3 (Apple Git-50) From 3f388b4e9e05690938f19428eaf2f2e7112d6101 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 2 Feb 2015 14:49:17 -0800 Subject: [PATCH 16/71] # IGNITE-61 - Direct marshalling --- .../ignite/internal/GridJobExecuteRequest.java | 14 +- .../processors/cache/GridCacheEvictionRequest.java | 2 +- .../cache/GridCacheEvictionResponse.java | 2 +- .../GridCacheOptimisticCheckPreparedTxRequest.java | 2 +- ...GridCacheOptimisticCheckPreparedTxResponse.java | 2 +- ...ridCachePessimisticCheckCommittedTxRequest.java | 2 +- ...idCachePessimisticCheckCommittedTxResponse.java | 2 +- .../distributed/GridCacheTtlUpdateRequest.java | 50 +++---- .../distributed/GridDistributedLockRequest.java | 2 +- .../distributed/GridDistributedLockResponse.java | 2 +- .../GridDistributedTxFinishRequest.java | 2 +- .../GridDistributedTxFinishResponse.java | 2 +- .../GridDistributedTxPrepareRequest.java | 2 +- .../GridDistributedTxPrepareResponse.java | 2 +- .../distributed/GridDistributedUnlockRequest.java | 2 +- .../dht/GridDhtAffinityAssignmentRequest.java | 2 +- .../dht/GridDhtAffinityAssignmentResponse.java | 2 +- .../cache/distributed/dht/GridDhtLockRequest.java | 57 ++++---- .../cache/distributed/dht/GridDhtLockResponse.java | 2 +- .../distributed/dht/GridDhtTxFinishRequest.java | 70 +++++---- .../distributed/dht/GridDhtTxFinishResponse.java | 2 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 2 +- .../distributed/dht/GridDhtTxPrepareResponse.java | 2 +- .../distributed/dht/GridDhtUnlockRequest.java | 2 +- .../GridDhtAtomicDeferredUpdateResponse.java | 2 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 30 ++-- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 2 +- .../dht/atomic/GridNearAtomicUpdateRequest.java | 12 +- .../dht/atomic/GridNearAtomicUpdateResponse.java | 77 +++++----- .../dht/preloader/GridDhtForceKeysRequest.java | 2 +- .../dht/preloader/GridDhtForceKeysResponse.java | 2 +- .../preloader/GridDhtPartitionDemandMessage.java | 2 +- .../preloader/GridDhtPartitionSupplyMessage.java | 2 +- .../preloader/GridDhtPartitionsFullMessage.java | 2 +- .../preloader/GridDhtPartitionsSingleMessage.java | 2 +- .../preloader/GridDhtPartitionsSingleRequest.java | 2 +- .../cache/distributed/near/GridNearGetRequest.java | 53 +++---- .../distributed/near/GridNearGetResponse.java | 2 +- .../distributed/near/GridNearLockRequest.java | 72 +++++----- .../distributed/near/GridNearLockResponse.java | 2 +- .../distributed/near/GridNearTxFinishRequest.java | 2 +- .../distributed/near/GridNearTxFinishResponse.java | 2 +- .../distributed/near/GridNearTxPrepareRequest.java | 2 +- .../near/GridNearTxPrepareResponse.java | 2 +- .../distributed/near/GridNearUnlockRequest.java | 2 +- .../cache/query/GridCacheQueryRequest.java | 2 +- .../cache/query/GridCacheQueryResponse.java | 2 +- .../clock/GridClockDeltaSnapshotMessage.java | 2 +- .../continuous/GridContinuousMessage.java | 32 ++--- .../processors/dataload/GridDataLoadRequest.java | 18 +-- .../processors/dataload/GridDataLoadResponse.java | 2 +- .../internal/processors/fs/GridGgfsAckMessage.java | 2 +- .../internal/processors/fs/GridGgfsBlockKey.java | 2 +- .../processors/fs/GridGgfsBlocksMessage.java | 2 +- .../processors/fs/GridGgfsDeleteMessage.java | 2 +- .../processors/fs/GridGgfsFileAffinityRange.java | 2 +- .../processors/fs/GridGgfsFragmentizerRequest.java | 2 +- .../fs/GridGgfsFragmentizerResponse.java | 2 +- .../processors/fs/GridGgfsSyncMessage.java | 2 +- .../internal/processors/fs/IgniteFsProcessor.java | 18 +-- .../message/GridClientHandshakeRequestWrapper.java | 2 +- .../GridClientHandshakeResponseWrapper.java | 2 +- .../client/message/GridClientMessageWrapper.java | 2 +- .../message/GridClientPingPacketWrapper.java | 2 +- .../rest/handlers/task/GridTaskResultRequest.java | 2 +- .../rest/handlers/task/GridTaskResultResponse.java | 2 +- .../protocols/tcp/GridMemcachedMessageWrapper.java | 2 +- .../streamer/GridStreamerCancelRequest.java | 2 +- .../streamer/GridStreamerExecutionRequest.java | 2 +- .../processors/streamer/GridStreamerResponse.java | 2 +- .../direct/GridTcpCommunicationMessageFactory.java | 134 ++++++++++-------- .../collision/jobstealing/JobStealingRequest.java | 2 +- .../codegen/CommunicationMessageCodeGenerator.java | 156 ++++----------------- .../ignite/codegen/generated-classes-order.txt | 79 ----------- 74 files changed, 405 insertions(+), 585 deletions(-) delete mode 100644 modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index d26ce22..44d2bd2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -832,17 +832,15 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 16: - UUID subjId0 = commState.getUuid(null); + subjId = commState.getUuid("subjId"); - if (subjId0 == UUID_NOT_READ) + if (!commState.lastRead()) return false; - subjId = subjId0; - commState.idx++; case 17: - String taskClsName0 = commState.getString("taskClsName"); + taskClsName = commState.getString("taskClsName"); if (!commState.lastRead()) return false; @@ -850,7 +848,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 18: - String taskName0 = commState.getString("taskName"); + taskName = commState.getString("taskName"); if (!commState.lastRead()) return false; @@ -895,7 +893,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im commState.idx++; case 21: - String userVer0 = commState.getString("userVer"); + userVer = commState.getString("userVer"); if (!commState.lastRead()) return false; @@ -909,7 +907,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @Override public byte directType() { - return 81; + return 1; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java index b0b773c..9059d75 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java @@ -240,7 +240,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple /** {@inheritDoc} */ @Override public byte directType() { - return 16; + return 14; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java index 10adb63..1ff9225 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java @@ -271,7 +271,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 17; + return 15; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index 5fcef9f..2317653 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -211,7 +211,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib /** {@inheritDoc} */ @Override public byte directType() { - return 18; + return 16; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index e2a66fc..9e5e8d1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -184,7 +184,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri /** {@inheritDoc} */ @Override public byte directType() { - return 19; + return 17; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index e2d45d7..386a604 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -274,7 +274,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr /** {@inheritDoc} */ @Override public byte directType() { - return 20; + return 18; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 3ac0aac..0954c99 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -216,7 +216,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist /** {@inheritDoc} */ @Override public byte directType() { - return 21; + return 19; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java index 6b0fa97..5c60c0c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java @@ -180,7 +180,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 82; + return 20; } /** {@inheritDoc} */ @@ -290,13 +290,13 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.idx++; case 6: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 7: - if (!commState.putLong(null, ttl)) + if (!commState.putLong("ttl", ttl)) return false; commState.idx++; @@ -343,10 +343,10 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { switch (commState.idx) { case 3: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -356,7 +356,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; keysBytes.add((byte[])_val); @@ -372,10 +372,10 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 4: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -385,7 +385,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; nearKeysBytes.add((byte[])_val); @@ -401,10 +401,10 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 5: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -414,7 +414,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; nearVers.add((GridCacheVersion)_val); @@ -429,27 +429,27 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { commState.idx++; case 6: - if (buf.remaining() < 8) - return false; + topVer = commState.getLong("topVer"); - topVer = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 7: - if (buf.remaining() < 8) - return false; + ttl = commState.getLong("ttl"); - ttl = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; case 8: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -459,7 +459,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { for (int i = commState.readItems; i < commState.readSize; i++) { GridCacheVersion _val = commState.getCacheVersion(null); - if (_val == CACHE_VER_NOT_READ) + if (!commState.lastRead()) return false; vers.add((GridCacheVersion)_val); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index db47889..09f6877 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -811,7 +811,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage /** {@inheritDoc} */ @Override public byte directType() { - return 22; + return 21; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java index 9287763..5c37853 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java @@ -421,7 +421,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag /** {@inheritDoc} */ @Override public byte directType() { - return 23; + return 22; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java index 8b84546..b378c31 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -681,7 +681,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes /** {@inheritDoc} */ @Override public byte directType() { - return 24; + return 23; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java index 0b2acfa..4b3c43c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -159,7 +159,7 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridDistributedBaseMe /** {@inheritDoc} */ @Override public byte directType() { - return 26; + return 25; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index b61c667..d7d2ce8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -236,7 +236,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM /** {@inheritDoc} */ @Override public byte directType() { - return 27; + return 26; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java index 9971d88..45b44cc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -228,7 +228,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa /** {@inheritDoc} */ @Override public byte directType() { - return 28; + return 27; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index 50d8f1c..0e101c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -63,7 +63,7 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { switch (commState.idx) { case 24: - if (!commState.putBitSet("invalidateEntries", invalidateEntries)) + if (!commState.putLong("accessTtl", accessTtl)) return false; commState.idx++; case 25: - if (!commState.putGridUuid("miniId", miniId)) + if (!commState.putBitSet("invalidateEntries", invalidateEntries)) return false; commState.idx++; case 26: + if (!commState.putGridUuid("miniId", miniId)) + return false; + + commState.idx++; + + case 27: if (nearKeyBytes != null) { if (commState.it == null) { if (!commState.putInt(null, nearKeyBytes.size())) @@ -427,38 +433,32 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 27: - if (!commState.putByteArray("ownedBytes", ownedBytes)) - return false; - - commState.idx++; - case 28: - if (!commState.putLong("topVer", topVer)) + if (!commState.putByteArray("ownedBytes", ownedBytes)) return false; commState.idx++; case 29: - if (!commState.putUuid("subjId", subjId)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 30: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 31: - if (!commState.putBitSet("preloadKeys", preloadKeys)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 32: - if (!commState.putLong(null, accessTtl)) + if (!commState.putBitSet("preloadKeys", preloadKeys)) return false; commState.idx++; @@ -478,7 +478,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { switch (commState.idx) { case 24: - invalidateEntries = commState.getBitSet("invalidateEntries"); + accessTtl = commState.getLong("accessTtl"); if (!commState.lastRead()) return false; @@ -486,7 +486,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 25: - miniId = commState.getGridUuid("miniId"); + invalidateEntries = commState.getBitSet("invalidateEntries"); if (!commState.lastRead()) return false; @@ -494,6 +494,14 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; case 26: + miniId = commState.getGridUuid("miniId"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 27: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -522,7 +530,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 27: + case 28: ownedBytes = commState.getByteArray("ownedBytes"); if (!commState.lastRead()) @@ -530,7 +538,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 28: + case 29: topVer = commState.getLong("topVer"); if (!commState.lastRead()) @@ -538,7 +546,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 29: + case 30: subjId = commState.getUuid("subjId"); if (!commState.lastRead()) @@ -546,7 +554,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 30: + case 31: taskNameHash = commState.getInt("taskNameHash"); if (!commState.lastRead()) @@ -554,7 +562,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 31: + case 32: preloadKeys = commState.getBitSet("preloadKeys"); if (!commState.lastRead()) @@ -562,13 +570,6 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { commState.idx++; - case 32: - if (buf.remaining() < 8) - return false; - - accessTtl = commState.getLong(null); - - commState.idx++; } return true; @@ -576,7 +577,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { /** {@inheritDoc} */ @Override public byte directType() { - return 29; + return 30; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index 84d7eff..5cba82c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -442,7 +442,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** {@inheritDoc} */ @Override public byte directType() { - return 30; + return 31; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index c394cf6..23c7eb5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -416,6 +416,12 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 24: + if (!commState.putLongList("nearTtls", nearTtls)) + return false; + + commState.idx++; + + case 25: if (nearWritesBytes != null) { if (commState.it == null) { if (!commState.putInt(null, nearWritesBytes.size())) @@ -442,13 +448,13 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; - case 25: + case 26: if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) return false; commState.idx++; - case 26: + case 27: if (pendingVers != null) { if (commState.it == null) { if (!commState.putInt(null, pendingVers.size())) @@ -475,44 +481,38 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; - case 27: - if (!commState.putBoolean("sysInvalidate", sysInvalidate)) - return false; - - commState.idx++; - case 28: - if (!commState.putLong("topVer", topVer)) + if (!commState.putBoolean("sysInvalidate", sysInvalidate)) return false; commState.idx++; case 29: - if (!commState.putCacheVersion("writeVer", writeVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 30: - if (!commState.putUuid("subjId", subjId)) + if (!commState.putLongList("ttls", ttls)) return false; commState.idx++; case 31: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!commState.putCacheVersion("writeVer", writeVer)) return false; commState.idx++; case 32: - if (!commState.putLongList(null, ttls)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 33: - if (!commState.putLongList(null, nearTtls)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -558,6 +558,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 24: + nearTtls = commState.getLongList("nearTtls"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 25: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -586,7 +594,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; - case 25: + case 26: onePhaseCommit = commState.getBoolean("onePhaseCommit"); if (!commState.lastRead()) @@ -594,7 +602,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; - case 26: + case 27: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -623,16 +631,8 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; - case 27: - sysInvalidate = commState.getBoolean("sysInvalidate"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - case 28: - topVer = commState.getLong("topVer"); + sysInvalidate = commState.getBoolean("sysInvalidate"); if (!commState.lastRead()) return false; @@ -640,7 +640,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 29: - writeVer = commState.getCacheVersion("writeVer"); + topVer = commState.getLong("topVer"); if (!commState.lastRead()) return false; @@ -648,7 +648,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 30: - subjId = commState.getUuid("subjId"); + ttls = commState.getLongList("ttls"); if (!commState.lastRead()) return false; @@ -656,7 +656,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 31: - taskNameHash = commState.getInt("taskNameHash"); + writeVer = commState.getCacheVersion("writeVer"); if (!commState.lastRead()) return false; @@ -664,23 +664,19 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest commState.idx++; case 32: - GridLongList ttls0 = commState.getLongList(null); + subjId = commState.getUuid("subjId"); - if (ttls0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - ttls = ttls0; - commState.idx++; case 33: - GridLongList nearTtls0 = commState.getLongList(null); + taskNameHash = commState.getInt("taskNameHash"); - if (nearTtls0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - nearTtls = nearTtls0; - commState.idx++; } @@ -690,6 +686,6 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest /** {@inheritDoc} */ @Override public byte directType() { - return 31; + return 32; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index 1ee5a3f..c749d53 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -138,6 +138,6 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon /** {@inheritDoc} */ @Override public byte directType() { - return 32; + return 33; } } 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 819db64..e522459 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 @@ -593,6 +593,6 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque /** {@inheritDoc} */ @Override public byte directType() { - return 33; + return 34; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index ec59dae..54d8c9a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -463,6 +463,6 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp /** {@inheritDoc} */ @Override public byte directType() { - return 34; + return 35; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 3c3c657..91df862 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -216,6 +216,6 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage< /** {@inheritDoc} */ @Override public byte directType() { - return 36; + return 37; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index baf929b..f55a8de 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -866,13 +866,13 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 12: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 13: - if (!commState.putLongList(null, ttls)) + if (!commState.putLongList("ttls", ttls)) return false; commState.idx++; @@ -1097,10 +1097,10 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 6: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1110,7 +1110,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; invokeArgsBytes[i] = (byte[])_val; @@ -1154,27 +1154,23 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 8: - GridLongList nearExpireTimes0 = commState.getLongList(null); + nearExpireTimes = commState.getLongList("nearExpireTimes"); - if (nearExpireTimes0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - nearExpireTimes = nearExpireTimes0; - commState.idx++; case 9: - GridLongList nearTtls0 = commState.getLongList(null); + nearTtls = commState.getLongList("nearTtls"); - if (nearTtls0 == LONG_LIST_NOT_READ) + if (!commState.lastRead()) return false; - nearTtls = nearTtls0; - commState.idx++; case 10: - UUID nodeId0 = commState.getUuid("nodeId"); + nodeId = commState.getUuid("nodeId"); if (!commState.lastRead()) return false; @@ -1237,7 +1233,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp commState.idx++; case 15: - GridCacheVersion writeVer0 = commState.getCacheVersion("writeVer"); + writeVer = commState.getCacheVersion("writeVer"); if (!commState.lastRead()) return false; @@ -1391,7 +1387,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** {@inheritDoc} */ @Override public byte directType() { - return 37; + return 38; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 1ef4e54..5fc3ef7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -338,7 +338,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im /** {@inheritDoc} */ @Override public byte directType() { - return 38; + return 39; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index e27065e..69cd546 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -882,7 +882,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im commState.idx++; case 6: - byte[] expiryPlcBytes = commState.getByteArray("expiryPlcBytes"); + expiryPlcBytes = commState.getByteArray("expiryPlcBytes"); if (!commState.lastRead()) return false; @@ -957,7 +957,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im for (int i = commState.readItems; i < commState.readSize; i++) { byte[] _val = commState.getByteArray(null); - if (_val == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; invokeArgsBytes[i] = (byte[])_val; @@ -973,10 +973,10 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 12: if (commState.readSize == -1) { - if (buf.remaining() < 4) - return false; - commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; } if (commState.readSize >= 0) { @@ -1104,7 +1104,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im /** {@inheritDoc} */ @Override public byte directType() { - return 39; + return 40; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 42ee3db..2d8f00b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -491,18 +491,30 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 6: - if (!commState.putByteArray("remapKeysBytes", remapKeysBytes)) + if (!commState.putLongList("nearExpireTimes", nearExpireTimes)) return false; commState.idx++; case 7: - if (!commState.putByteArray("retValBytes", retValBytes)) + if (!commState.putLongList("nearTtls", nearTtls)) return false; commState.idx++; case 8: + if (!commState.putByteArray("remapKeysBytes", remapKeysBytes)) + return false; + + commState.idx++; + + case 9: + if (!commState.putByteArray("retValBytes", retValBytes)) + return false; + + commState.idx++; + + case 10: if (nearSkipIdxs != null) { if (commState.it == null) { if (!commState.putInt(null, nearSkipIdxs.size())) @@ -529,7 +541,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 9: + case 11: if (nearValBytes != null) { if (commState.it == null) { if (!commState.putInt(null, nearValBytes.size())) @@ -556,7 +568,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 10: + case 12: if (nearValsIdxs != null) { if (commState.it == null) { if (!commState.putInt(null, nearValsIdxs.size())) @@ -583,23 +595,12 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 11: + case 13: if (!commState.putCacheVersion("nearVer", nearVer)) return false; commState.idx++; - case 12: - if (!commState.putLongList("nearExpireTimes", nearExpireTimes)) - return false; - - commState.idx++; - - case 13: - if (!commState.putLongList("nearTtls", nearTtls)) - return false; - - commState.idx++; } return true; @@ -639,7 +640,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 6: - remapKeysBytes = commState.getByteArray("remapKeysBytes"); + nearExpireTimes = commState.getLongList("nearExpireTimes"); if (!commState.lastRead()) return false; @@ -647,7 +648,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 7: - retValBytes = commState.getByteArray("retValBytes"); + nearTtls = commState.getLongList("nearTtls"); if (!commState.lastRead()) return false; @@ -655,6 +656,22 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; case 8: + remapKeysBytes = commState.getByteArray("remapKeysBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 9: + retValBytes = commState.getByteArray("retValBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 10: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -683,7 +700,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 9: + case 11: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -712,7 +729,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 10: + case 12: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -741,24 +758,8 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i commState.idx++; - case 11: - nearVer = commState.getCacheVersion("nearVer"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 12: - nearExpireTimes = commState.getLongList("nearExpireTimes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - case 13: - nearTtls = commState.getLongList("nearTtls"); + nearVer = commState.getCacheVersion("nearVer"); if (!commState.lastRead()) return false; @@ -772,7 +773,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** {@inheritDoc} */ @Override public byte directType() { - return 40; + return 41; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 1d94c2e..20920a7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -319,7 +319,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem /** {@inheritDoc} */ @Override public byte directType() { - return 41; + return 42; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index 73fcb03..55845ac 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -323,7 +323,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple /** {@inheritDoc} */ @Override public byte directType() { - return 42; + return 43; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index bf41e14..6931543 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -377,7 +377,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** {@inheritDoc} */ @Override public byte directType() { - return 43; + return 44; } /** {@inheritDoc} */ 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 417ab84..d7e785f 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 @@ -504,7 +504,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** {@inheritDoc} */ @Override public byte directType() { - return 44; + return 45; } /** {@inheritDoc} */ 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 ec138fd..fa67ac0 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 @@ -244,7 +244,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @Override public byte directType() { - return 45; + return 46; } /** {@inheritDoc} */ 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 823f1f6..57888bc 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 @@ -165,7 +165,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @Override public byte directType() { - return 46; + return 47; } /** {@inheritDoc} */ 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 d3fbe40..9cbd7d4 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 @@ -91,7 +91,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @Override public byte directType() { - return 47; + return 48; } /** {@inheritDoc} */ 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 033e793..8abde42 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 @@ -297,7 +297,7 @@ public class GridNearGetRequest extends GridCacheMessage implements switch (commState.idx) { case 3: - if (!commState.putLong(null, accessTtl)) + if (!commState.putLong("accessTtl", accessTtl)) return false; commState.idx++; @@ -330,7 +330,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 5: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; @@ -374,43 +374,43 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 7: - if (!commState.putGridUuid(null, miniId)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 8: - if (!commState.putBoolean(null, readThrough)) + if (!commState.putBoolean("readThrough", readThrough)) return false; commState.idx++; case 9: - if (!commState.putBoolean(null, reload)) + if (!commState.putBoolean("reload", reload)) return false; commState.idx++; case 10: - if (!commState.putLong(null, topVer)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 11: - if (!commState.putCacheVersion(null, ver)) + if (!commState.putCacheVersion("ver", ver)) return false; commState.idx++; case 12: - if (!commState.putUuid(null, subjId)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 13: - if (!commState.putInt(null, taskNameHash)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; @@ -430,10 +430,10 @@ public class GridNearGetRequest extends GridCacheMessage implements switch (commState.idx) { case 3: - if (buf.remaining() < 8) - return false; + accessTtl = commState.getLong("accessTtl"); - accessTtl = commState.getLong(null); + if (!commState.lastRead()) + return false; commState.idx++; @@ -467,7 +467,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 5: - IgniteUuid futId0 = commState.getGridUuid(null); + futId = commState.getGridUuid("futId"); if (!commState.lastRead()) return false; @@ -517,7 +517,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 7: - IgniteUuid miniId0 = commState.getGridUuid(null); + miniId = commState.getGridUuid("miniId"); if (!commState.lastRead()) return false; @@ -525,29 +525,31 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 8: - if (buf.remaining() < 1) - return false; + readThrough = commState.getBoolean("readThrough"); - readThrough = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 9: - if (buf.remaining() < 1) - return false; + reload = commState.getBoolean("reload"); - reload = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 10: - if (buf.remaining() < 8) + topVer = commState.getLong("topVer"); + + if (!commState.lastRead()) return false; commState.idx++; case 11: - GridCacheVersion ver0 = commState.getCacheVersion(null); + ver = commState.getCacheVersion("ver"); if (!commState.lastRead()) return false; @@ -555,7 +557,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 12: - UUID subjId0 = commState.getUuid(null); + subjId = commState.getUuid("subjId"); if (!commState.lastRead()) return false; @@ -563,8 +565,7 @@ public class GridNearGetRequest extends GridCacheMessage implements commState.idx++; case 13: - if (buf.remaining() < 4) - return false; + taskNameHash = commState.getInt("taskNameHash"); if (!commState.lastRead()) return false; @@ -578,7 +579,7 @@ public class GridNearGetRequest extends GridCacheMessage implements /** {@inheritDoc} */ @Override public byte directType() { - return 48; + return 49; } /** {@inheritDoc} */ 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 77dd8f6..0504d70 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 @@ -403,7 +403,7 @@ public class GridNearGetResponse extends GridCacheMessage implements /** {@inheritDoc} */ @Override public byte directType() { - return 49; + return 50; } /** {@inheritDoc} */ 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 2d8e08f..efe60bd 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 @@ -381,6 +381,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest switch (commState.idx) { case 24: + if (!commState.putLong("accessTtl", accessTtl)) + return false; + + commState.idx++; + + case 25: if (dhtVers != null) { if (commState.it == null) { if (!commState.putInt(null, dhtVers.length)) @@ -407,7 +413,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 25: + case 26: if (filterBytes != null) { if (commState.it == null) { if (!commState.putInt(null, filterBytes.length)) @@ -434,62 +440,56 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 26: - if (!commState.putBoolean("implicitSingleTx", implicitSingleTx)) - return false; - - commState.idx++; - case 27: - if (!commState.putBoolean("implicitTx", implicitTx)) + if (!commState.putBoolean("implicitSingleTx", implicitSingleTx)) return false; commState.idx++; case 28: - if (!commState.putGridUuid("miniId", miniId)) + if (!commState.putBoolean("implicitTx", implicitTx)) return false; commState.idx++; case 29: - if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) + if (!commState.putGridUuid("miniId", miniId)) return false; commState.idx++; case 30: - if (!commState.putBoolean("syncCommit", syncCommit)) + if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) return false; commState.idx++; case 31: - if (!commState.putLong("topVer", topVer)) + if (!commState.putBoolean("syncCommit", syncCommit)) return false; commState.idx++; case 32: - if (!commState.putUuid("subjId", subjId)) + if (!commState.putLong("topVer", topVer)) return false; commState.idx++; case 33: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!commState.putUuid("subjId", subjId)) return false; commState.idx++; case 34: - if (!commState.putBoolean("hasTransforms", hasTransforms)) + if (!commState.putInt("taskNameHash", taskNameHash)) return false; commState.idx++; case 35: - if (!commState.putLong("accessTtl", accessTtl)) + if (!commState.putBoolean("hasTransforms", hasTransforms)) return false; commState.idx++; @@ -509,6 +509,14 @@ public class GridNearLockRequest extends GridDistributedLockRequest switch (commState.idx) { case 24: + accessTtl = commState.getLong("accessTtl"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 25: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -537,7 +545,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 25: + case 26: if (commState.readSize == -1) { commState.readSize = commState.getInt(null); @@ -566,7 +574,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 26: + case 27: implicitSingleTx = commState.getBoolean("implicitSingleTx"); if (!commState.lastRead()) @@ -574,7 +582,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 27: + case 28: implicitTx = commState.getBoolean("implicitTx"); if (!commState.lastRead()) @@ -582,7 +590,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 28: + case 29: miniId = commState.getGridUuid("miniId"); if (!commState.lastRead()) @@ -590,7 +598,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 29: + case 30: onePhaseCommit = commState.getBoolean("onePhaseCommit"); if (!commState.lastRead()) @@ -598,7 +606,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 30: + case 31: syncCommit = commState.getBoolean("syncCommit"); if (!commState.lastRead()) @@ -606,7 +614,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 31: + case 32: topVer = commState.getLong("topVer"); if (!commState.lastRead()) @@ -614,7 +622,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 32: + case 33: subjId = commState.getUuid("subjId"); if (!commState.lastRead()) @@ -622,7 +630,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 33: + case 34: taskNameHash = commState.getInt("taskNameHash"); if (!commState.lastRead()) @@ -630,22 +638,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest commState.idx++; - case 34: + case 35: hasTransforms = commState.getBoolean("hasTransforms"); if (!commState.lastRead()) return false; - syncCommit = commState.getBoolean(null); - - commState.idx++; - - case 35: - if (buf.remaining() < 8) - return false; - - accessTtl = commState.getLong(null); - commState.idx++; } @@ -655,7 +653,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest /** {@inheritDoc} */ @Override public byte directType() { - return 50; + return 51; } /** {@inheritDoc} */ 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 98cbe8e..e53f1a2 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 @@ -436,7 +436,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedTxFinishReques /** {@inheritDoc} */ @Override public byte directType() { - return 52; + return 53; } /** {@inheritDoc} */ 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 22c68e9..ac4ae2c 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 @@ -214,7 +214,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @Override public byte directType() { - return 53; + return 54; } /** {@inheritDoc} */ 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 e0bc216..6e57ee4 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 @@ -434,7 +434,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @Override public byte directType() { - return 54; + return 55; } /** {@inheritDoc} */ 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 7c53dba..efb5f60 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 @@ -495,7 +495,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @Override public byte directType() { - return 55; + return 56; } /** {@inheritDoc} */ 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 40d3506..8df4302 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 @@ -93,7 +93,7 @@ public class GridNearUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage implemen /** {@inheritDoc} */ @Override public byte directType() { - return 57; + return 58; } /** {@inheritDoc} */ 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 01569cd..9738d60 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 @@ -433,7 +433,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme /** {@inheritDoc} */ @Override public byte directType() { - return 58; + return 59; } /** {@inheritDoc} */ 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 4f9345c..04e3f50 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 @@ -214,7 +214,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd /** {@inheritDoc} */ @Override public byte directType() { - return 59; + return 60; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java index 50e1b40..0cc1d32 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java @@ -142,13 +142,13 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { - GridContinuousMessage clone = (GridContinuousMessage)_msg; + GridContinuousMessage _clone = (GridContinuousMessage)_msg; - clone.type = type; - clone.routineId = routineId; - clone.futId = futId; - clone.data = data; - clone.dataBytes = dataBytes; + _clone.type = type; + _clone.routineId = routineId; + _clone.data = data; + _clone.dataBytes = dataBytes; + _clone.futId = futId; } /** {@inheritDoc} */ @@ -171,19 +171,19 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - if (!commState.putGridUuid(null, futId)) + if (!commState.putGridUuid("futId", futId)) return false; commState.idx++; case 2: - if (!commState.putUuid(null, routineId)) + if (!commState.putUuid("routineId", routineId)) return false; commState.idx++; case 3: - if (!commState.putEnum(null, type)) + if (!commState.putEnum("type", type)) return false; commState.idx++; @@ -208,17 +208,15 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 1: - IgniteUuid futId0 = commState.getGridUuid(null); + futId = commState.getGridUuid("futId"); - if (futId0 == GRID_UUID_NOT_READ) + if (!commState.lastRead()) return false; - futId = futId0; - commState.idx++; case 2: - UUID routineId0 = commState.getUuid(null); + routineId = commState.getUuid("routineId"); if (!commState.lastRead()) return false; @@ -226,12 +224,12 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { commState.idx++; case 3: - if (buf.remaining() < 1) - return false; + byte type0 = commState.getByte("type"); if (!commState.lastRead()) return false; + type = GridContinuousMessageType.fromOrdinal(type0); commState.idx++; @@ -242,7 +240,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 60; + return 61; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java index c842a06..3a9c605 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java @@ -327,19 +327,19 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 10: - if (!commState.putBoolean(null, skipStore)) + if (!commState.putBoolean("skipStore", skipStore)) return false; commState.idx++; case 11: - if (!commState.putByteArray(null, updaterBytes)) + if (!commState.putByteArray("updaterBytes", updaterBytes)) return false; commState.idx++; case 12: - if (!commState.putString(null, userVer)) + if (!commState.putString("userVer", userVer)) return false; commState.idx++; @@ -471,15 +471,15 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 10: - if (buf.remaining() < 1) - return false; + skipStore = commState.getBoolean("skipStore"); - skipStore = commState.getBoolean(null); + if (!commState.lastRead()) + return false; commState.idx++; case 11: - byte[] updaterBytes0 = commState.getByteArray(null); + updaterBytes = commState.getByteArray("updaterBytes"); if (!commState.lastRead()) return false; @@ -487,7 +487,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { commState.idx++; case 12: - String userVer0 = commState.getString(null); + userVer = commState.getString("userVer"); if (!commState.lastRead()) return false; @@ -501,7 +501,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 61; + return 62; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java index ed193a9..faff1d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java @@ -174,6 +174,6 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 62; + return 63; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java index e39bc6b..dd73817 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java @@ -203,6 +203,6 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 65; + return 64; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java index 101db19..a157f03 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java @@ -265,7 +265,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @Override public byte directType() { - return 66; + return 65; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java index 2a1f8a1..9e3f4c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java @@ -249,6 +249,6 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 67; + return 66; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java index cc64415..8032bc3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java @@ -192,7 +192,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 68; + return 67; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java index 6fb4699..2216182 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java @@ -384,7 +384,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte /** {@inheritDoc} */ @Override public byte directType() { - return 69; + return 68; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java index 37954a3..37f7cf0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java @@ -205,6 +205,6 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 70; + return 69; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java index 19a04d2..1b337cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java @@ -124,6 +124,6 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 71; + return 70; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java index fa917a0..8251242 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java @@ -156,6 +156,6 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @Override public byte directType() { - return 72; + return 71; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java index 8087d11..2f9fe76 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java @@ -85,28 +85,28 @@ public class IgniteFsProcessor extends IgniteFsProcessorAdapter { @Override public GridTcpCommunicationMessageAdapter create(byte type) { switch (type) { - case 65: + case 64: return new GridGgfsAckMessage(); - case 66: + case 65: return new GridGgfsBlockKey(); - case 67: + case 66: return new GridGgfsBlocksMessage(); - case 68: + case 67: return new GridGgfsDeleteMessage(); - case 69: + case 68: return new GridGgfsFileAffinityRange(); - case 70: + case 69: return new GridGgfsFragmentizerRequest(); - case 71: + case 70: return new GridGgfsFragmentizerResponse(); - case 72: + case 71: return new GridGgfsSyncMessage(); default: @@ -115,7 +115,7 @@ public class IgniteFsProcessor extends IgniteFsProcessorAdapter { return null; } } - }, 65, 66, 67, 68, 69,70, 71, 72); + }, 64, 65, 66, 67, 68, 69, 70, 71); // Register HDFS edition usage with license manager. GridLicenseUseRegistry.onUsage(HADOOP, getClass()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index 1c0366a..e0dd381 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -100,7 +100,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa /** {@inheritDoc} */ @Override public byte directType() { - return HANDSHAKE_HEADER; + return 72; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index dff1f45..00ebc5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -89,7 +89,7 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess /** {@inheritDoc} */ @Override public byte directType() { - return code; + return 73; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java index 6e6f485..04edfc7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java @@ -227,7 +227,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @Override public byte directType() { - return REQ_HEADER; + return 74; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java index 64e61c9..9e42be0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -75,7 +75,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public byte directType() { - return GridClientMessageWrapper.REQ_HEADER; + return 75; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java index 4abd359..ba70ee5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -176,6 +176,6 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 73; + return 76; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java index 06cec21..caa42dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -224,6 +224,6 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 74; + return 77; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 3cc4358..33f9b27 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -104,7 +104,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public byte directType() { - return MEMCACHE_RES_FLAG; + return 78; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java index efc80cb..f5d3bdb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java @@ -116,6 +116,6 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte /** {@inheritDoc} */ @Override public byte directType() { - return 75; + return 79; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java index e62a003..03db23d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java @@ -369,6 +369,6 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda /** {@inheritDoc} */ @Override public byte directType() { - return 76; + return 80; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java index fdd21df..c143ca1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java @@ -151,6 +151,6 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 77; + return 81; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java index 7007493..ddcbddd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java @@ -32,7 +32,9 @@ import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.processors.continuous.*; import org.apache.ignite.internal.processors.dataload.*; +import org.apache.ignite.internal.processors.rest.client.message.*; import org.apache.ignite.internal.processors.rest.handlers.task.*; +import org.apache.ignite.internal.processors.rest.protocols.tcp.*; import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.spi.collision.jobstealing.*; import org.apache.ignite.spi.communication.tcp.*; @@ -62,6 +64,9 @@ public class GridTcpCommunicationMessageFactory { case 0: return new GridJobCancelRequest(); + case 1: + return new GridJobExecuteRequest(); + case 2: return new GridJobExecuteResponse(); @@ -98,179 +103,190 @@ public class GridTcpCommunicationMessageFactory { case 13: return new GridEventStorageMessage(); - case 16: + case 14: return new GridCacheEvictionRequest(); - case 17: + case 15: return new GridCacheEvictionResponse(); - case 18: + case 16: return new GridCacheOptimisticCheckPreparedTxRequest(); - case 19: + case 17: return new GridCacheOptimisticCheckPreparedTxResponse(); - case 20: + case 18: return new GridCachePessimisticCheckCommittedTxRequest(); - case 21: + case 19: return new GridCachePessimisticCheckCommittedTxResponse(); - case 22: + case 20: + return new GridCacheTtlUpdateRequest(); + + case 21: return new GridDistributedLockRequest(); - case 23: + case 22: return new GridDistributedLockResponse(); - case 24: + case 23: return new GridDistributedTxFinishRequest(); - case 25: + case 24: return new GridDistributedTxFinishResponse(); - case 26: + case 25: return new GridDistributedTxPrepareRequest(); - case 27: + case 26: return new GridDistributedTxPrepareResponse(); - case 28: + case 27: return new GridDistributedUnlockRequest(); + case 28: + return new GridDhtAffinityAssignmentRequest(); + case 29: - return new GridDhtLockRequest(); + return new GridDhtAffinityAssignmentResponse(); case 30: - return new GridDhtLockResponse(); + return new GridDhtLockRequest(); case 31: - return new GridDhtTxFinishRequest(); + return new GridDhtLockResponse(); case 32: - return new GridDhtTxFinishResponse(); + return new GridDhtTxFinishRequest(); case 33: - return new GridDhtTxPrepareRequest(); + return new GridDhtTxFinishResponse(); case 34: - return new GridDhtTxPrepareResponse(); + return new GridDhtTxPrepareRequest(); case 35: - return new GridDhtUnlockRequest(); + return new GridDhtTxPrepareResponse(); case 36: - return new GridDhtAtomicDeferredUpdateResponse(); + return new GridDhtUnlockRequest(); case 37: - return new GridDhtAtomicUpdateRequest(); + return new GridDhtAtomicDeferredUpdateResponse(); case 38: - return new GridDhtAtomicUpdateResponse(); + return new GridDhtAtomicUpdateRequest(); case 39: - return new GridNearAtomicUpdateRequest(); + return new GridDhtAtomicUpdateResponse(); case 40: - return new GridNearAtomicUpdateResponse(); + return new GridNearAtomicUpdateRequest(); case 41: - return new GridDhtForceKeysRequest(); + return new GridNearAtomicUpdateResponse(); case 42: - return new GridDhtForceKeysResponse(); + return new GridDhtForceKeysRequest(); case 43: - return new GridDhtPartitionDemandMessage(); + return new GridDhtForceKeysResponse(); case 44: - return new GridDhtPartitionSupplyMessage(); + return new GridDhtPartitionDemandMessage(); case 45: - return new GridDhtPartitionsFullMessage(); + return new GridDhtPartitionSupplyMessage(); case 46: - return new GridDhtPartitionsSingleMessage(); + return new GridDhtPartitionsFullMessage(); case 47: - return new GridDhtPartitionsSingleRequest(); + return new GridDhtPartitionsSingleMessage(); case 48: - return new GridNearGetRequest(); + return new GridDhtPartitionsSingleRequest(); case 49: - return new GridNearGetResponse(); + return new GridNearGetRequest(); case 50: - return new GridNearLockRequest(); + return new GridNearGetResponse(); case 51: - return new GridNearLockResponse(); + return new GridNearLockRequest(); case 52: - return new GridNearTxFinishRequest(); + return new GridNearLockResponse(); case 53: - return new GridNearTxFinishResponse(); + return new GridNearTxFinishRequest(); case 54: - return new GridNearTxPrepareRequest(); + return new GridNearTxFinishResponse(); case 55: - return new GridNearTxPrepareResponse(); + return new GridNearTxPrepareRequest(); case 56: - return new GridNearUnlockRequest(); + return new GridNearTxPrepareResponse(); case 57: - return new GridCacheQueryRequest(); + return new GridNearUnlockRequest(); case 58: - return new GridCacheQueryResponse(); + return new GridCacheQueryRequest(); case 59: - return new GridClockDeltaSnapshotMessage(); + return new GridCacheQueryResponse(); case 60: - return new GridContinuousMessage(); + return new GridClockDeltaSnapshotMessage(); case 61: - return new GridDataLoadRequest(); + return new GridContinuousMessage(); case 62: + return new GridDataLoadRequest(); + + case 63: return new GridDataLoadResponse(); - // 65-72 are GGFS messages (see GridGgfsOpProcessor). + // 64-71: IgniteFS messages. + + case 72: + return new GridClientHandshakeRequestWrapper(); case 73: - return new GridTaskResultRequest(); + return new GridClientHandshakeResponseWrapper(); case 74: - return new GridTaskResultResponse(); + return new GridClientMessageWrapper(); - // TODO: Register from streamer processor. case 75: - return new GridStreamerCancelRequest(); + return new GridClientPingPacketWrapper(); case 76: - return new GridStreamerExecutionRequest(); + return new GridTaskResultRequest(); case 77: - return new GridStreamerResponse(); + return new GridTaskResultResponse(); case 78: - return new JobStealingRequest(); + return new GridMemcachedMessageWrapper(); case 79: - return new GridDhtAffinityAssignmentRequest(); + return new GridStreamerCancelRequest(); case 80: - return new GridDhtAffinityAssignmentResponse(); + return new GridStreamerExecutionRequest(); case 81: - return new GridJobExecuteRequest(); + return new GridStreamerResponse(); case 82: - return new GridCacheTtlUpdateRequest(); + return new JobStealingRequest(); default: assert false : "Invalid message type."; @@ -281,7 +297,7 @@ public class GridTcpCommunicationMessageFactory { }, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, /* 65-72 - GGFS messages. */ 73, 74, 75, 76, 77, 78, 79, + 60, 61, 62, 63, /* 64-71: IgniteFS messages. */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82); } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index b903738..0653dcd 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -116,7 +116,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 78; + return 82; } /** {@inheritDoc} */ diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 8679aeb..5ab27cc 100644 --- a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -60,10 +60,6 @@ public class CommunicationMessageCodeGenerator { }; /** */ - private static final String CLASSES_ORDER_FILE = U.getGridGainHome() + - "/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt"; - - /** */ private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; /** */ @@ -121,9 +117,6 @@ public class CommunicationMessageCodeGenerator { private final Map, Integer> fieldCnt = new HashMap<>(); /** */ - private byte type = -1; - - /** */ private List fields; /** */ @@ -136,27 +129,6 @@ public class CommunicationMessageCodeGenerator { CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); try { -// gen.generateAndWrite(GridDistributedLockRequest.class); -// gen.generateAndWrite(GridNearLockRequest.class); -// gen.generateAndWrite(GridDhtLockRequest.class); -// gen.generateAndWrite(GridDistributedLockResponse.class); -// gen.generateAndWrite(GridNearLockResponse.class); -// gen.generateAndWrite(GridDhtLockResponse.class); -// -// gen.generateAndWrite(GridDistributedTxPrepareRequest.class); -// gen.generateAndWrite(GridNearTxPrepareRequest.class); -// gen.generateAndWrite(GridDhtTxPrepareRequest.class); -// gen.generateAndWrite(GridDistributedTxPrepareResponse.class); -// gen.generateAndWrite(GridNearTxPrepareResponse.class); -// gen.generateAndWrite(GridDhtTxPrepareResponse.class); -// -// gen.generateAndWrite(GridDistributedTxFinishRequest.class); -// gen.generateAndWrite(GridNearTxFinishRequest.class); -// gen.generateAndWrite(GridDhtTxFinishRequest.class); -// gen.generateAndWrite(GridDistributedTxFinishResponse.class); -// gen.generateAndWrite(GridNearTxFinishResponse.class); -// gen.generateAndWrite(GridDhtTxFinishResponse.class); - gen.generateAll(true); } catch (Exception e) { @@ -171,25 +143,31 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ public void generateAll(boolean write) throws Exception { - type = 0; + Collection> classes = classes(); - Map classesOrder = classesOrder(); - - Collection> classes = classes(classesOrder); + byte type = 0; for (Class cls : classes) { - Integer t = classesOrder.get(cls.getName()); - - type = t != null ? t.byteValue() : 0; + boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); - System.out.println("Processing class: " + cls.getName() + - (Modifier.isAbstract(cls.getModifiers()) ? " (abstract)" : "")); + System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); if (write) - generateAndWrite(cls); + generateAndWrite(cls, isAbstract ? -1 : type++); else generate(cls); } + +// type = 0; +// +// for (Class cls : classes) { +// if (Modifier.isAbstract(cls.getModifiers())) +// continue; +// +// System.out.println("case " + type++ + ":"); +// System.out.println(" return new " + cls.getSimpleName() + "();"); +// System.out.println(); +// } } /** @@ -201,7 +179,7 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ @SuppressWarnings("ConstantConditions") - private void generateAndWrite(Class cls) throws Exception { + private void generateAndWrite(Class cls, byte type) throws Exception { assert cls != null; generate(cls); @@ -226,7 +204,6 @@ public class CommunicationMessageCodeGenerator { boolean writeFound = false; boolean readFound = false; - boolean typeFound = false; boolean cloneFound = false; boolean clone0Found = false; @@ -252,8 +229,6 @@ public class CommunicationMessageCodeGenerator { // src.add(TAB + TAB + "return " + type + ';'); // // skip = true; -// -// typeFound = true; // } else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { src.addAll(clone); @@ -283,9 +258,6 @@ public class CommunicationMessageCodeGenerator { if (!readFound) System.out.println(" readFrom method doesn't exist."); - if (!typeFound) - System.out.println(" directType method doesn't exist."); - if (!cloneFound) System.out.println(" clone method doesn't exist."); @@ -1088,23 +1060,17 @@ public class CommunicationMessageCodeGenerator { * (with package prefix). * That orders need for saving {@code directType} value. * - * @param classesOrder Map {class name => order number}. * @return Classes. * @throws Exception In case of error. */ - private Collection> classes(final Map classesOrder) throws Exception { - Collection> col = new TreeSet<>(new Comparator>() { - @Override public int compare(Class o1, Class o2) { - Integer c1 = classesOrder.get(o1.getName()); - - Integer c2 = classesOrder.get(o2.getName()); - - if (c1 == null) - return c2 == null ? o1.getName().compareTo(o2.getName()) : 1; - else - return c2 == null ? -1 : c1.compareTo(c2); - } - }); + private Collection> classes() throws Exception { + Collection> col = new TreeSet<>( + new Comparator>() { + @Override public int compare(Class c1, + Class c2) { + return c1.getName().compareTo(c2.getName()); + } + }); URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); @@ -1120,56 +1086,6 @@ public class CommunicationMessageCodeGenerator { } /** - * Reads class names from {@code CLASSES_ORDER_FILE}. - * - * @return Map {class name => order number} - * @throws IOException In case of io error. - */ - private Map classesOrder() throws IOException { - BufferedReader reader = null; - - try { - reader = new BufferedReader(new FileReader(CLASSES_ORDER_FILE)); - - Map res = new HashMap<>(); - - while (true) { - String line = reader.readLine(); - - if (line == null) - break; - - line = line.trim(); - - if (!line.isEmpty()) - res.put(line, res.size()); - } - - return res; - } - finally { - if (reader != null) - reader.close(); - } - } - - /** - * Writes class names in {@code CLASSES_ORDER_FILE}. - * - * @param classes Classes for saving. - * @throws IOException In case of io error. - */ - private void classesOrder(Iterable> classes) - throws IOException { - Collection src = new ArrayList<>(); - - for (Class cls : classes) - src.add(cls.getName()); - - writeLines(new File(CLASSES_ORDER_FILE), src); - } - - /** * Recursively process provided file or directory. * * @param file File. @@ -1208,26 +1124,4 @@ public class CommunicationMessageCodeGenerator { } } } - - /** - * Writes lines in file. - * - * @param file File. - * @param lines Lines. - * @throws IOException In case of io error. - */ - private void writeLines(File file, Iterable lines) throws IOException { - BufferedWriter writer = null; - - try { - writer = new BufferedWriter(new FileWriter(file)); - - for (String line : lines) - writer.write(line + '\n'); - } - finally { - if (writer != null) - writer.close(); - } - } } diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt b/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt deleted file mode 100644 index 88ca4ac..0000000 --- a/modules/tools/src/main/java/org/apache/ignite/codegen/generated-classes-order.txt +++ /dev/null @@ -1,79 +0,0 @@ -org.apache.ignite.internal.GridJobCancelRequest -org.apache.ignite.internal.GridJobExecuteRequest -org.apache.ignite.internal.GridJobExecuteResponse -org.apache.ignite.internal.GridJobSiblingsRequest -org.apache.ignite.internal.GridJobSiblingsResponse -org.apache.ignite.internal.GridTaskCancelRequest -org.apache.ignite.internal.GridTaskSessionRequest -org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest -org.apache.ignite.internal.managers.communication.GridIoMessage -org.apache.ignite.internal.managers.communication.GridIoUserMessage -org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean -org.apache.ignite.internal.managers.deployment.GridDeploymentRequest -org.apache.ignite.internal.managers.deployment.GridDeploymentResponse -org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage -org.apache.ignite.internal.processors.cache.GridCacheEvictionRequest -org.apache.ignite.internal.processors.cache.GridCacheEvictionResponse -org.apache.ignite.internal.processors.cache.distributed.GridCacheOptimisticCheckPreparedTxRequest -org.apache.ignite.internal.processors.cache.distributed.GridCacheOptimisticCheckPreparedTxResponse -org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxRequest -org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxResponse -org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest -org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockResponse -org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest -org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse -org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest -org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareResponse -org.apache.ignite.internal.processors.cache.distributed.GridDistributedUnlockRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest -org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse -org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest -org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse -org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest -org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest -org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest -org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest -org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest -org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse -org.apache.ignite.internal.processors.cache.distributed.near.GridNearUnlockRequest -org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest -org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse -org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage -org.apache.ignite.internal.processors.continuous.GridContinuousMessage -org.apache.ignite.internal.processors.dataload.GridDataLoadRequest -org.apache.ignite.internal.processors.dataload.GridDataLoadResponse -org.apache.ignite.internal.processors.dr.messages.internal.GridDrInternalRequest -org.apache.ignite.internal.processors.dr.messages.internal.GridDrInternalResponse -org.apache.ignite.internal.processors.ggfs.GridGgfsAckMessage -org.apache.ignite.internal.processors.ggfs.GridGgfsBlockKey -org.apache.ignite.internal.processors.ggfs.GridGgfsBlocksMessage -org.apache.ignite.internal.processors.ggfs.GridGgfsDeleteMessage -org.apache.ignite.internal.processors.ggfs.GridGgfsFileAffinityRange -org.apache.ignite.internal.processors.ggfs.GridGgfsFragmentizerRequest -org.apache.ignite.internal.processors.ggfs.GridGgfsFragmentizerResponse -org.apache.ignite.internal.processors.ggfs.GridGgfsSyncMessage -org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest -org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultResponse -org.apache.ignite.internal.processors.streamer.GridStreamerCancelRequest -org.apache.ignite.internal.processors.streamer.GridStreamerExecutionRequest -org.apache.ignite.internal.processors.streamer.GridStreamerResponse -org.apache.ignite.spi.collision.jobstealing.JobStealingRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentRequest -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse -- 1.9.3 (Apple Git-50) From f8f78d6a7ca5f1352c5401527d22de77de33465f Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 2 Feb 2015 16:55:33 -0800 Subject: [PATCH 17/71] # IGNITE-61 - Direct marshalling --- .../util/direct/GridTcpCommunicationByteBufferStream.java | 12 ++++++++++-- .../grid/util/direct/GridTcpCommunicationMessageReader.java | 6 +++++- .../processors/cache/GridCacheAbstractFullApiSelfTest.java | 1 - 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index 85ce982..42f7777 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -527,8 +527,11 @@ public class GridTcpCommunicationByteBufferStream { */ public GridTcpCommunicationMessageAdapter readMessage() { if (!msgTypeDone) { - if (!buf.hasRemaining()) + if (!buf.hasRemaining()) { + lastFinished = false; + return null; + } byte type = readByte(); @@ -543,10 +546,15 @@ public class GridTcpCommunicationByteBufferStream { msgTypeDone = false; msg = null; + lastFinished = true; + return msg0; } - else + else { + lastFinished = false; + return null; + } } /** diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java index 278beca..574378f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java @@ -223,7 +223,11 @@ public class GridTcpCommunicationMessageReader implements MessageReader { /** {@inheritDoc} */ @Nullable @Override public GridTcpCommunicationMessageAdapter readMessage(String name) { - return stream.readMessage(); + GridTcpCommunicationMessageAdapter msg = stream.readMessage(); + + lastRead = stream.lastFinished(); + + return msg; } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 4f55e2f..e9a7660 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -129,7 +129,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); - for (int i = 0; i < gridCount(); i++) info("Grid " + i + ": " + grid(i).localNode().id()); } -- 1.9.3 (Apple Git-50) From 8027fc90f66631ae0b59567705816939371bb1e2 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Tue, 3 Feb 2015 12:10:17 -0800 Subject: [PATCH 18/71] Merge branch 'sprint-1' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61 Conflicts: modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java --- .../apache/ignite/internal/managers/communication/GridIoManager.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 9a45c59..51ece70 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.managers.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.timeout.*; @@ -32,10 +33,6 @@ import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; -import org.apache.ignite.spi.*; -import org.apache.ignite.spi.communication.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.marshaller.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.*; -- 1.9.3 (Apple Git-50) From 8bbac3570e8f6ff1bcf996ff8d4e46c9150e908d Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Wed, 4 Feb 2015 18:48:25 -0800 Subject: [PATCH 19/71] IGNITE-61 - Direct marshalling --- .../internal/util/direct/GridTcpCommunicationMessageState.java | 7 ++++--- .../grid/util/direct/GridTcpCommunicationByteBufferStream.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java index 44b22ce..f0ac50e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java @@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; +import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import sun.misc.*; @@ -44,7 +45,7 @@ public class GridTcpCommunicationMessageState { private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); /** */ - private MessageWriter writer; + private final MessageWriter writer = new GridTcpCommunicationMessageWriter(); /** */ private MessageReader reader; @@ -74,8 +75,8 @@ public class GridTcpCommunicationMessageState { * @param writer Writer. */ public final void setWriter(MessageWriter writer) { - if (this.writer == null) - this.writer = writer; +// if (this.writer == null) +// this.writer = writer; } /** diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index 42f7777..379cc46 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -391,7 +391,7 @@ public class GridTcpCommunicationByteBufferStream { public void writeMessage(GridTcpCommunicationMessageAdapter msg) { assert msg != null; - lastFinished = msg.writeTo(buf); + lastFinished = buf.hasRemaining() && msg.writeTo(buf); } /** {@inheritDoc} */ -- 1.9.3 (Apple Git-50) From 06a542d121fe078b1307b1defcc6bff451509ccd Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Wed, 4 Feb 2015 18:59:25 -0800 Subject: [PATCH 20/71] IGNITE-61 - Temporary compilation fix --- modules/tools/pom.xml | 10 +- .../codegen/CommunicationMessageCodeGenerator.java | 2240 ++++++++++---------- 2 files changed, 1125 insertions(+), 1125 deletions(-) diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml index d81e692..3a01471 100644 --- a/modules/tools/pom.xml +++ b/modules/tools/pom.xml @@ -41,11 +41,11 @@ - - org.apache.ignite - ignite-core - ${ignite.version} - + + + + + org.jodd diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 5ab27cc..fdd9991 100644 --- a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -1,1127 +1,1127 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.apache.ignite.codegen; - -import com.sun.istack.internal.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; - -import java.io.*; -import java.lang.reflect.*; -import java.net.*; -import java.nio.*; -import java.util.*; - -import static java.lang.reflect.Modifier.*; - -/** - * Direct marshallable code generator. - */ -public class CommunicationMessageCodeGenerator { - /** */ - private static final Comparator FIELD_CMP = new Comparator() { - @Override public int compare(Field f1, Field f2) { - int ver1 = 0; - - GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); - - if (verAnn1 != null) { - ver1 = verAnn1.value(); - - assert ver1 > 0; - } - - int ver2 = 0; - - GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); - - if (verAnn2 != null) { - ver2 = verAnn2.value(); - - assert ver2 > 0; - } - - return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); - } - }; - - /** */ - private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; - - /** */ - private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; - - /** */ - private static final String EMPTY = ""; - - /** */ - private static final String TAB = " "; - - /** */ - private static final String COMM_STATE_VAR = "commState"; - - /** */ - private static final String BUF_VAR = "buf"; - - /** */ - private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; - - /** */ - private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; - - /** */ - private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; - - /** */ - private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; - - /** */ - private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; - - /** */ - private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; - - /** */ - private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; - - /** */ - private static final String DFLT_LOC_VAR = "_val"; - - /** */ - private final Collection write = new ArrayList<>(); - - /** */ - private final Collection read = new ArrayList<>(); - - /** */ - private final Collection clone = new ArrayList<>(); - - /** */ - private final Collection clone0 = new ArrayList<>(); - - /** */ - private final Map, Integer> fieldCnt = new HashMap<>(); - - /** */ - private List fields; - - /** */ - private int indent; - - /** - * @param args Arguments. - */ - public static void main(String[] args) { - CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); - - try { - gen.generateAll(true); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Generates code for all classes. - * - * @param write Whether to write to file. - * @throws Exception In case of error. - */ - public void generateAll(boolean write) throws Exception { - Collection> classes = classes(); - - byte type = 0; - - for (Class cls : classes) { - boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); - - System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); - - if (write) - generateAndWrite(cls, isAbstract ? -1 : type++); - else - generate(cls); - } - -// type = 0; +///* @java.file.header */ +// +///* _________ _____ __________________ _____ +// * __ ____/___________(_)______ /__ ____/______ ____(_)_______ +// * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ +// * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / +// * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +// */ +// +//package org.apache.ignite.codegen; +// +//import com.sun.istack.internal.*; +//import org.apache.ignite.internal.*; +//import org.apache.ignite.internal.processors.cache.*; +//import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +//import org.apache.ignite.internal.processors.cache.version.*; +//import org.apache.ignite.internal.processors.clock.*; +//import org.apache.ignite.internal.util.*; +//import org.apache.ignite.internal.util.direct.*; +//import org.apache.ignite.internal.util.typedef.internal.*; +//import org.apache.ignite.lang.*; +// +//import java.io.*; +//import java.lang.reflect.*; +//import java.net.*; +//import java.nio.*; +//import java.util.*; +// +//import static java.lang.reflect.Modifier.*; +// +///** +// * Direct marshallable code generator. +// */ +//public class CommunicationMessageCodeGenerator { +// /** */ +// private static final Comparator FIELD_CMP = new Comparator() { +// @Override public int compare(Field f1, Field f2) { +// int ver1 = 0; +// +// GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); +// +// if (verAnn1 != null) { +// ver1 = verAnn1.value(); +// +// assert ver1 > 0; +// } +// +// int ver2 = 0; +// +// GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); +// +// if (verAnn2 != null) { +// ver2 = verAnn2.value(); +// +// assert ver2 > 0; +// } +// +// return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); +// } +// }; +// +// /** */ +// private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; +// +// /** */ +// private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; +// +// /** */ +// private static final String EMPTY = ""; +// +// /** */ +// private static final String TAB = " "; +// +// /** */ +// private static final String COMM_STATE_VAR = "commState"; +// +// /** */ +// private static final String BUF_VAR = "buf"; +// +// /** */ +// private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; +// +// /** */ +// private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; +// +// /** */ +// private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; +// +// /** */ +// private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; +// +// /** */ +// private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; +// +// /** */ +// private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; +// +// /** */ +// private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; +// +// /** */ +// private static final String DFLT_LOC_VAR = "_val"; +// +// /** */ +// private final Collection write = new ArrayList<>(); +// +// /** */ +// private final Collection read = new ArrayList<>(); +// +// /** */ +// private final Collection clone = new ArrayList<>(); +// +// /** */ +// private final Collection clone0 = new ArrayList<>(); +// +// /** */ +// private final Map, Integer> fieldCnt = new HashMap<>(); +// +// /** */ +// private List fields; +// +// /** */ +// private int indent; +// +// /** +// * @param args Arguments. +// */ +// public static void main(String[] args) { +// CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); +// +// try { +// gen.generateAll(true); +// } +// catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// /** +// * Generates code for all classes. +// * +// * @param write Whether to write to file. +// * @throws Exception In case of error. +// */ +// public void generateAll(boolean write) throws Exception { +// Collection> classes = classes(); +// +// byte type = 0; // // for (Class cls : classes) { -// if (Modifier.isAbstract(cls.getModifiers())) -// continue; +// boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); +// +// System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); +// +// if (write) +// generateAndWrite(cls, isAbstract ? -1 : type++); +// else +// generate(cls); +// } +// +//// type = 0; +//// +//// for (Class cls : classes) { +//// if (Modifier.isAbstract(cls.getModifiers())) +//// continue; +//// +//// System.out.println("case " + type++ + ":"); +//// System.out.println(" return new " + cls.getSimpleName() + "();"); +//// System.out.println(); +//// } +// } +// +// /** +// * Generates code for provided class and writes it to source file. +// * Note: this method must be called only from {@code generateAll(boolean)} +// * and only with updating {@code CLASSES_ORDER_FILE} and other auto generated files. +// * +// * @param cls Class. +// * @throws Exception In case of error. +// */ +// @SuppressWarnings("ConstantConditions") +// private void generateAndWrite(Class cls, byte type) throws Exception { +// assert cls != null; +// +// generate(cls); +// +// File file = new File(SRC_DIR, cls.getName().replace('.', File.separatorChar) + ".java"); +// +// if (!file.exists() || !file.isFile()) { +// System.out.println(" Source file not found: " + file.getPath()); // -// System.out.println("case " + type++ + ":"); -// System.out.println(" return new " + cls.getSimpleName() + "();"); -// System.out.println(); +// return; // } - } - - /** - * Generates code for provided class and writes it to source file. - * Note: this method must be called only from {@code generateAll(boolean)} - * and only with updating {@code CLASSES_ORDER_FILE} and other auto generated files. - * - * @param cls Class. - * @throws Exception In case of error. - */ - @SuppressWarnings("ConstantConditions") - private void generateAndWrite(Class cls, byte type) throws Exception { - assert cls != null; - - generate(cls); - - File file = new File(SRC_DIR, cls.getName().replace('.', File.separatorChar) + ".java"); - - if (!file.exists() || !file.isFile()) { - System.out.println(" Source file not found: " + file.getPath()); - - return; - } - - Collection src = new ArrayList<>(); - - BufferedReader rdr = null; - - try { - rdr = new BufferedReader(new FileReader(file)); - - String line; - boolean skip = false; - - boolean writeFound = false; - boolean readFound = false; - boolean cloneFound = false; - boolean clone0Found = false; - - while ((line = rdr.readLine()) != null) { - if (!skip) { - src.add(line); - - if (line.contains("public boolean writeTo(ByteBuffer buf)")) { - src.addAll(write); - - skip = true; - - writeFound = true; - } - else if (line.contains("public boolean readFrom(ByteBuffer buf)")) { - src.addAll(read); - - skip = true; - - readFound = true; - } -// else if (type >= 0 && line.contains("public byte directType()")) { -// src.add(TAB + TAB + "return " + type + ';'); +// +// Collection src = new ArrayList<>(); +// +// BufferedReader rdr = null; +// +// try { +// rdr = new BufferedReader(new FileReader(file)); +// +// String line; +// boolean skip = false; +// +// boolean writeFound = false; +// boolean readFound = false; +// boolean cloneFound = false; +// boolean clone0Found = false; +// +// while ((line = rdr.readLine()) != null) { +// if (!skip) { +// src.add(line); +// +// if (line.contains("public boolean writeTo(ByteBuffer buf)")) { +// src.addAll(write); // // skip = true; +// +// writeFound = true; // } - else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { - src.addAll(clone); - - skip = true; - - cloneFound = true; - } - else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { - src.addAll(clone0); - - skip = true; - - clone0Found = true; - } - } - else if (line.startsWith(TAB + "}")) { - src.add(line); - - skip = false; - } - } - - if (!writeFound) - System.out.println(" writeTo method doesn't exist."); - - if (!readFound) - System.out.println(" readFrom method doesn't exist."); - - if (!cloneFound) - System.out.println(" clone method doesn't exist."); - - if (!clone0Found) - System.out.println(" clone0 method doesn't exist."); - } - finally { - if (rdr != null) - rdr.close(); - } - - BufferedWriter wr = null; - - try { - wr = new BufferedWriter(new FileWriter(file)); - - for (String line : src) - wr.write(line + '\n'); - } - finally { - if (wr != null) - wr.close(); - } - } - - /** - * Generates code for provided class. - * - * @param cls Class. - * @throws Exception In case of error. - */ - public void generate(Class cls) throws Exception { - assert cls != null; - - write.clear(); - read.clear(); - clone.clear(); - clone0.clear(); - - fields = new ArrayList<>(); - - Field[] declaredFields = cls.getDeclaredFields(); - - for (Field field : declaredFields) { - int mod = field.getModifiers(); - - if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) - fields.add(field); - } - - Collections.sort(fields, FIELD_CMP); - - indent = 2; - - boolean hasSuper = cls.getSuperclass() != BASE_CLS; - - String clsName = cls.getSimpleName(); - - if (!Modifier.isAbstract(cls.getModifiers())) { - clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString()); - clone.add(EMPTY); - clone.add(builder().a("clone0(_clone);").toString()); - clone.add(EMPTY); - clone.add(builder().a("return _clone;").toString()); - } - - if (hasSuper) { - clone0.add(builder().a("super.clone0(_msg);").toString()); - clone0.add(EMPTY); - } - - Collection cloningFields = new ArrayList<>(declaredFields.length); - - for (Field field: declaredFields) - if (!isStatic(field.getModifiers())) - cloningFields.add(field); - - if (!cloningFields.isEmpty()) { - clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString()); - clone0.add(EMPTY); - - for (Field field : cloningFields) { - String name = field.getName(); - Class type = field.getType(); - - String res = name; - - if (BASE_CLS.isAssignableFrom(type)) - res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; - - clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); - } - } - - start(write, hasSuper ? "writeTo" : null, true); - start(read, hasSuper ? "readFrom" : null, false); - - indent++; - - int state = startState(cls); - - for (Field field : fields) - processField(field, state++); - - indent--; - - finish(write); - finish(read); - } - - /** - * @param cls Message class. - * @return Start state. - */ - private int startState(Class cls) { - assert cls != null; - - Class superCls = cls.getSuperclass(); - - Integer state = fieldCnt.get(superCls); - - if (state != null) - return state; - - state = 0; - - while (cls.getSuperclass() != BASE_CLS) { - cls = cls.getSuperclass(); - - for (Field field : cls.getDeclaredFields()) { - int mod = field.getModifiers(); - - if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) - state++; - } - } - - fieldCnt.put(superCls, state); - - return state; - } - - /** - * @param code Code lines. - * @param superMtd Super class method name. - * @param writeType Whether to write message type. - */ - private void start(Collection code, @Nullable String superMtd, boolean writeType) { - assert code != null; - - code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); - code.add(EMPTY); - - if (superMtd != null) { - returnFalseIfFailed(code, "super." + superMtd, BUF_VAR); - - code.add(EMPTY); - } - - if (writeType) { - code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); - - indent++; - - returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); - - code.add(EMPTY); - code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); - - indent--; - - code.add(builder().a("}").toString()); - code.add(EMPTY); - } - - if (!fields.isEmpty()) - code.add(builder().a("switch (").a(STATE_VAR).a(") {").toString()); - } - - /** - * @param code Code lines. - */ - private void finish(Collection code) { - assert code != null; - - if (!fields.isEmpty()) { - code.add(builder().a("}").toString()); - code.add(EMPTY); - } - - code.add(builder().a("return true;").toString()); - } - - /** - * @param field Field. - * @param opt Case option. - */ - private void processField(Field field, int opt) { - assert field != null; - assert opt >= 0; - - GridDirectCollection colAnn = field.getAnnotation(GridDirectCollection.class); - GridDirectMap mapAnn = field.getAnnotation(GridDirectMap.class); - - if (colAnn == null && Collection.class.isAssignableFrom(field.getType())) - throw new IllegalStateException("@GridDirectCollection annotation is not provided for field: " + - field.getName()); - - if (mapAnn == null && Map.class.isAssignableFrom(field.getType())) - throw new IllegalStateException("@GridDirectMap annotation is not provided for field: " + field.getName()); - - writeField(field, opt, colAnn, mapAnn); - readField(field, opt, colAnn, mapAnn); - } - - /** - * @param field Field. - * @param opt Case option. - * @param colAnn Collection annotation. - * @param mapAnn Map annotation. - */ - private void writeField(Field field, int opt, @Nullable GridDirectCollection colAnn, - @Nullable GridDirectMap mapAnn) { - assert field != null; - assert opt >= 0; - - write.add(builder().a("case ").a(opt).a(":").toString()); - - indent++; - - returnFalseIfWriteFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, - mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); - - write.add(EMPTY); - write.add(builder().a(STATE_VAR).a("++;").toString()); - write.add(EMPTY); - - indent--; - } - - /** - * @param field Field. - * @param opt Case option. - * @param colAnn Collection annotation. - * @param mapAnn Map annotation. - */ - private void readField(Field field, int opt, @Nullable GridDirectCollection colAnn, - @Nullable GridDirectMap mapAnn) { - assert field != null; - assert opt >= 0; - - read.add(builder().a("case ").a(opt).a(":").toString()); - - indent++; - - returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, - mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); - - read.add(EMPTY); - read.add(builder().a(STATE_VAR).a("++;").toString()); - read.add(EMPTY); - - indent--; - } - - /** - * @param type Field type. - * @param name Field name. - * @param colItemType Collection item type. - * @param mapKeyType Map key type. - * @param mapValType Map key value. - * @param raw Raw write flag. - */ - private void returnFalseIfWriteFailed(Class type, String name, @Nullable Class colItemType, - @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { - assert type != null; - assert name != null; - - String field = raw ? "null" : '"' + name + '"'; - - if (type == byte.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); - else if (type == short.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); - else if (type == int.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); - else if (type == long.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); - else if (type == float.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); - else if (type == double.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); - else if (type == char.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); - else if (type == boolean.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); - else if (type == byte[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); - else if (type == short[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); - else if (type == int[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); - else if (type == long[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); - else if (type == float[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); - else if (type == double[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); - else if (type == char[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); - else if (type == boolean[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); - else if (type == UUID.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); - else if (type == ByteBuffer.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); - else if (type == IgniteUuid.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); - else if (type == GridClockDeltaVersion.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); - else if (type == GridByteArrayList.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); - else if (type == GridLongList.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); - else if (type == GridCacheVersion.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); - else if (type == GridDhtPartitionExchangeId.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); - else if (type == GridCacheValueBytes.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); - //else if (type == GridDrInternalRequestEntry.class) - // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); - else if (type == String.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); - else if (type == BitSet.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); - else if (type.isEnum()) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); - else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); - else if (type.isArray() || Collection.class.isAssignableFrom(type)) { - boolean isArr = type.isArray(); - - if (isArr) - colItemType = type.getComponentType(); - - assert colItemType != null; - - write.add(builder().a("if (").a(name).a(" != null) {").toString()); - - indent++; - - write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); - - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). - a(";").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). - toString()); - - indent++; - - write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); - - indent++; - - write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); - - indent--; - - write.add(EMPTY); - - returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, - null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = null;").toString()); - - indent--; - - write.add(builder().a("} else {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); - - indent--; - - write.add(builder().a("}").toString()); - } - else if (Map.class.isAssignableFrom(type)) { - assert mapKeyType != null; - assert mapValType != null; - - write.add(builder().a("if (").a(name).a(" != null) {").toString()); - - indent++; - - write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); - - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). - toString()); - - indent++; - - write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); - - indent++; - - write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); - - indent--; - - String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + - U.box(mapValType).getSimpleName() + ">"; - - write.add(EMPTY); - write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); - write.add(EMPTY); - write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); - - indent++; - - returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - - returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); - write.add(EMPTY); - write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = null;").toString()); - - indent--; - - write.add(builder().a("} else {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); - - indent--; - - write.add(builder().a("}").toString()); - } - else - throw new IllegalStateException("Unsupported type: " + type); - } - - /** - * @param type Field type. - * @param name Field name. - * @param colItemType Collection item type. - * @param mapKeyType Map key type. - * @param mapValType Map value type. - * @param raw Raw read flag. - */ - private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, - @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { - assert type != null; - - String field = raw ? "null" : '"' + name + '"'; - - String retType = type.getSimpleName(); - - if (type == byte.class) - returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); - else if (type == short.class) - returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); - else if (type == int.class) - returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); - else if (type == long.class) - returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); - else if (type == float.class) - returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); - else if (type == double.class) - returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); - else if (type == char.class) - returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); - else if (type == boolean.class) - returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); - else if (type == byte[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); - else if (type == short[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); - else if (type == int[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); - else if (type == long[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); - else if (type == float[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); - else if (type == double[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); - else if (type == char[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); - else if (type == boolean[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); - else if (type == UUID.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); - else if (type == ByteBuffer.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); - else if (type == IgniteUuid.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); - else if (type == GridClockDeltaVersion.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); - else if (type == GridLongList.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); - else if (type == GridByteArrayList.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); - else if (type == GridCacheVersion.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); - else if (type == GridDhtPartitionExchangeId.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); - else if (type == GridCacheValueBytes.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); - //else if (type == GridDrInternalRequestEntry.class) - // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); - else if (type == String.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); - else if (type == BitSet.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); - else if (type.isEnum()) { - assert name != null; - - returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); - - read.add(EMPTY); - read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); - } - else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); - else if (type.isArray() || Collection.class.isAssignableFrom(type)) { - assert name != null; - - boolean isArr = type.isArray(); - - if (isArr) - colItemType = type.getComponentType(); - - assert colItemType != null; - - Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; - - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); - - indent++; - - returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); - - indent++; - - read.add(builder().a("if (").a(name).a(" == null)").toString()); - - indent++; - - if (isArr) { - String val = colItemType.isArray() ? - colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : - colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; - - read.add(builder().a(name).a(" = new ").a(val).a(";"). - toString()); - } - else { - read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). - toString()); - } - - indent--; - - read.add(EMPTY); - read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). - toString()); - - indent++; - - String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(colItemType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). - a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); - read.add(EMPTY); - read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); - read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); - } - else if (Map.class.isAssignableFrom(type)) { - assert name != null; - assert mapKeyType != null; - assert mapValType != null; - - Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; - - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); - - indent++; - - returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); - - indent++; - - read.add(builder().a("if (").a(name).a(" == null)").toString()); - - indent++; - - read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). - toString()); - - indent--; - - read.add(EMPTY); - read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). - toString()); - - indent++; - - read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); - - indent++; - - String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); - read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - - var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(mapValType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). - a(", ").a(DFLT_LOC_VAR).a(");").toString()); - read.add(EMPTY); - read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); - read.add(EMPTY); - read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); - read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); - read.add(builder().a(CUR_VAR).a(" = null;").toString()); - } - else - throw new IllegalStateException("Unsupported type: " + type); - } - - /** - * @param retType Return type. - * @param var Variable name. - * @param locVar Local variable name. - * @param mtd Method name. - * @param arg Method argument. - * @param cast Whether cast is needed. - */ - private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, - @Nullable String arg, boolean cast) { - assert retType != null; - assert mtd != null; - - if (var == null) - var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); - - read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). - a(arg != null ? "(" + arg + ");" : "();").toString()); - read.add(EMPTY); - - read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); - - indent++; - - read.add(builder().a("return false;").toString()); - - indent--; - } - - /** - * @param code Code lines. - * @param accessor Field or method name. - * @param args Method arguments. - */ - private void returnFalseIfFailed(Collection code, String accessor, @Nullable String... args) { - assert code != null; - assert accessor != null; - - String argsStr = ""; - - if (args != null && args.length > 0) { - for (String arg : args) - argsStr += arg + ", "; - - argsStr = argsStr.substring(0, argsStr.length() - 2); - } - - code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); - - indent++; - - code.add(builder().a("return false;").toString()); - - indent--; - } - - /** - * Creates new builder with correct indent. - * - * @return Builder. - */ - private SB builder() { - assert indent > 0; - - SB sb = new SB(); - - for (int i = 0; i < indent; i++) - sb.a(TAB); - - return sb; - } - - /** - * Gets all direct marshallable classes. - * First classes will be classes from {@code classesOrder} with same order - * as ordered values. Other classes will be at the end and ordered by name - * (with package prefix). - * That orders need for saving {@code directType} value. - * - * @return Classes. - * @throws Exception In case of error. - */ - private Collection> classes() throws Exception { - Collection> col = new TreeSet<>( - new Comparator>() { - @Override public int compare(Class c1, - Class c2) { - return c1.getName().compareTo(c2.getName()); - } - }); - - URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); - - for (URL url : ldr.getURLs()) { - File file = new File(url.toURI()); - - int prefixLen = file.getPath().length() + 1; - - processFile(file, ldr, prefixLen, col); - } - - return col; - } - - /** - * Recursively process provided file or directory. - * - * @param file File. - * @param ldr Class loader. - * @param prefixLen Path prefix length. - * @param col Classes. - * @throws Exception In case of error. - */ - private void processFile(File file, ClassLoader ldr, int prefixLen, - Collection> col) throws Exception { - assert file != null; - assert ldr != null; - assert prefixLen > 0; - assert col != null; - - if (!file.exists()) - throw new FileNotFoundException("File doesn't exist: " + file); - - if (file.isDirectory()) { - for (File f : file.listFiles()) - processFile(f, ldr, prefixLen, col); - } - else { - assert file.isFile(); - - String path = file.getPath(); - - if (path.endsWith(".class")) { - String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); - - Class cls = Class.forName(clsName, false, ldr); - - if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && - !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) - col.add((Class)cls); - } - } - } -} +// else if (line.contains("public boolean readFrom(ByteBuffer buf)")) { +// src.addAll(read); +// +// skip = true; +// +// readFound = true; +// } +//// else if (type >= 0 && line.contains("public byte directType()")) { +//// src.add(TAB + TAB + "return " + type + ';'); +//// +//// skip = true; +//// } +// else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { +// src.addAll(clone); +// +// skip = true; +// +// cloneFound = true; +// } +// else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { +// src.addAll(clone0); +// +// skip = true; +// +// clone0Found = true; +// } +// } +// else if (line.startsWith(TAB + "}")) { +// src.add(line); +// +// skip = false; +// } +// } +// +// if (!writeFound) +// System.out.println(" writeTo method doesn't exist."); +// +// if (!readFound) +// System.out.println(" readFrom method doesn't exist."); +// +// if (!cloneFound) +// System.out.println(" clone method doesn't exist."); +// +// if (!clone0Found) +// System.out.println(" clone0 method doesn't exist."); +// } +// finally { +// if (rdr != null) +// rdr.close(); +// } +// +// BufferedWriter wr = null; +// +// try { +// wr = new BufferedWriter(new FileWriter(file)); +// +// for (String line : src) +// wr.write(line + '\n'); +// } +// finally { +// if (wr != null) +// wr.close(); +// } +// } +// +// /** +// * Generates code for provided class. +// * +// * @param cls Class. +// * @throws Exception In case of error. +// */ +// public void generate(Class cls) throws Exception { +// assert cls != null; +// +// write.clear(); +// read.clear(); +// clone.clear(); +// clone0.clear(); +// +// fields = new ArrayList<>(); +// +// Field[] declaredFields = cls.getDeclaredFields(); +// +// for (Field field : declaredFields) { +// int mod = field.getModifiers(); +// +// if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) +// fields.add(field); +// } +// +// Collections.sort(fields, FIELD_CMP); +// +// indent = 2; +// +// boolean hasSuper = cls.getSuperclass() != BASE_CLS; +// +// String clsName = cls.getSimpleName(); +// +// if (!Modifier.isAbstract(cls.getModifiers())) { +// clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString()); +// clone.add(EMPTY); +// clone.add(builder().a("clone0(_clone);").toString()); +// clone.add(EMPTY); +// clone.add(builder().a("return _clone;").toString()); +// } +// +// if (hasSuper) { +// clone0.add(builder().a("super.clone0(_msg);").toString()); +// clone0.add(EMPTY); +// } +// +// Collection cloningFields = new ArrayList<>(declaredFields.length); +// +// for (Field field: declaredFields) +// if (!isStatic(field.getModifiers())) +// cloningFields.add(field); +// +// if (!cloningFields.isEmpty()) { +// clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString()); +// clone0.add(EMPTY); +// +// for (Field field : cloningFields) { +// String name = field.getName(); +// Class type = field.getType(); +// +// String res = name; +// +// if (BASE_CLS.isAssignableFrom(type)) +// res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; +// +// clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); +// } +// } +// +// start(write, hasSuper ? "writeTo" : null, true); +// start(read, hasSuper ? "readFrom" : null, false); +// +// indent++; +// +// int state = startState(cls); +// +// for (Field field : fields) +// processField(field, state++); +// +// indent--; +// +// finish(write); +// finish(read); +// } +// +// /** +// * @param cls Message class. +// * @return Start state. +// */ +// private int startState(Class cls) { +// assert cls != null; +// +// Class superCls = cls.getSuperclass(); +// +// Integer state = fieldCnt.get(superCls); +// +// if (state != null) +// return state; +// +// state = 0; +// +// while (cls.getSuperclass() != BASE_CLS) { +// cls = cls.getSuperclass(); +// +// for (Field field : cls.getDeclaredFields()) { +// int mod = field.getModifiers(); +// +// if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) +// state++; +// } +// } +// +// fieldCnt.put(superCls, state); +// +// return state; +// } +// +// /** +// * @param code Code lines. +// * @param superMtd Super class method name. +// * @param writeType Whether to write message type. +// */ +// private void start(Collection code, @Nullable String superMtd, boolean writeType) { +// assert code != null; +// +// code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); +// code.add(EMPTY); +// +// if (superMtd != null) { +// returnFalseIfFailed(code, "super." + superMtd, BUF_VAR); +// +// code.add(EMPTY); +// } +// +// if (writeType) { +// code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); +// +// indent++; +// +// returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); +// +// code.add(EMPTY); +// code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); +// +// indent--; +// +// code.add(builder().a("}").toString()); +// code.add(EMPTY); +// } +// +// if (!fields.isEmpty()) +// code.add(builder().a("switch (").a(STATE_VAR).a(") {").toString()); +// } +// +// /** +// * @param code Code lines. +// */ +// private void finish(Collection code) { +// assert code != null; +// +// if (!fields.isEmpty()) { +// code.add(builder().a("}").toString()); +// code.add(EMPTY); +// } +// +// code.add(builder().a("return true;").toString()); +// } +// +// /** +// * @param field Field. +// * @param opt Case option. +// */ +// private void processField(Field field, int opt) { +// assert field != null; +// assert opt >= 0; +// +// GridDirectCollection colAnn = field.getAnnotation(GridDirectCollection.class); +// GridDirectMap mapAnn = field.getAnnotation(GridDirectMap.class); +// +// if (colAnn == null && Collection.class.isAssignableFrom(field.getType())) +// throw new IllegalStateException("@GridDirectCollection annotation is not provided for field: " + +// field.getName()); +// +// if (mapAnn == null && Map.class.isAssignableFrom(field.getType())) +// throw new IllegalStateException("@GridDirectMap annotation is not provided for field: " + field.getName()); +// +// writeField(field, opt, colAnn, mapAnn); +// readField(field, opt, colAnn, mapAnn); +// } +// +// /** +// * @param field Field. +// * @param opt Case option. +// * @param colAnn Collection annotation. +// * @param mapAnn Map annotation. +// */ +// private void writeField(Field field, int opt, @Nullable GridDirectCollection colAnn, +// @Nullable GridDirectMap mapAnn) { +// assert field != null; +// assert opt >= 0; +// +// write.add(builder().a("case ").a(opt).a(":").toString()); +// +// indent++; +// +// returnFalseIfWriteFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, +// mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); +// +// write.add(EMPTY); +// write.add(builder().a(STATE_VAR).a("++;").toString()); +// write.add(EMPTY); +// +// indent--; +// } +// +// /** +// * @param field Field. +// * @param opt Case option. +// * @param colAnn Collection annotation. +// * @param mapAnn Map annotation. +// */ +// private void readField(Field field, int opt, @Nullable GridDirectCollection colAnn, +// @Nullable GridDirectMap mapAnn) { +// assert field != null; +// assert opt >= 0; +// +// read.add(builder().a("case ").a(opt).a(":").toString()); +// +// indent++; +// +// returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, +// mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); +// +// read.add(EMPTY); +// read.add(builder().a(STATE_VAR).a("++;").toString()); +// read.add(EMPTY); +// +// indent--; +// } +// +// /** +// * @param type Field type. +// * @param name Field name. +// * @param colItemType Collection item type. +// * @param mapKeyType Map key type. +// * @param mapValType Map key value. +// * @param raw Raw write flag. +// */ +// private void returnFalseIfWriteFailed(Class type, String name, @Nullable Class colItemType, +// @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { +// assert type != null; +// assert name != null; +// +// String field = raw ? "null" : '"' + name + '"'; +// +// if (type == byte.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); +// else if (type == short.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); +// else if (type == int.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); +// else if (type == long.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); +// else if (type == float.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); +// else if (type == double.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); +// else if (type == char.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); +// else if (type == boolean.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); +// else if (type == byte[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); +// else if (type == short[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); +// else if (type == int[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); +// else if (type == long[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); +// else if (type == float[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); +// else if (type == double[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); +// else if (type == char[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); +// else if (type == boolean[].class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); +// else if (type == UUID.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); +// else if (type == ByteBuffer.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); +// else if (type == IgniteUuid.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); +// else if (type == GridClockDeltaVersion.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); +// else if (type == GridByteArrayList.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); +// else if (type == GridLongList.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); +// else if (type == GridCacheVersion.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); +// else if (type == GridDhtPartitionExchangeId.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); +// else if (type == GridCacheValueBytes.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); +// //else if (type == GridDrInternalRequestEntry.class) +// // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); +// else if (type == String.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); +// else if (type == BitSet.class) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); +// else if (type.isEnum()) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); +// else if (BASE_CLS.isAssignableFrom(type)) +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); +// else if (type.isArray() || Collection.class.isAssignableFrom(type)) { +// boolean isArr = type.isArray(); +// +// if (isArr) +// colItemType = type.getComponentType(); +// +// assert colItemType != null; +// +// write.add(builder().a("if (").a(name).a(" != null) {").toString()); +// +// indent++; +// +// write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); +// +// indent++; +// +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); +// +// write.add(EMPTY); +// write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). +// a(";").toString()); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// write.add(EMPTY); +// write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). +// toString()); +// +// indent++; +// +// write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); +// +// indent++; +// +// write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); +// +// indent--; +// +// write.add(EMPTY); +// +// returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, +// null, null, null, true); +// +// write.add(EMPTY); +// write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// write.add(EMPTY); +// write.add(builder().a(IT_VAR).a(" = null;").toString()); +// +// indent--; +// +// write.add(builder().a("} else {").toString()); +// +// indent++; +// +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// } +// else if (Map.class.isAssignableFrom(type)) { +// assert mapKeyType != null; +// assert mapValType != null; +// +// write.add(builder().a("if (").a(name).a(" != null) {").toString()); +// +// indent++; +// +// write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); +// +// indent++; +// +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); +// +// write.add(EMPTY); +// write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// write.add(EMPTY); +// write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). +// toString()); +// +// indent++; +// +// write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); +// +// indent++; +// +// write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); +// +// indent--; +// +// String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + +// U.box(mapValType).getSimpleName() + ">"; +// +// write.add(EMPTY); +// write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); +// write.add(EMPTY); +// write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); +// +// indent++; +// +// returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); +// +// write.add(EMPTY); +// write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// write.add(EMPTY); +// +// returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); +// +// write.add(EMPTY); +// write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); +// write.add(EMPTY); +// write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// write.add(EMPTY); +// write.add(builder().a(IT_VAR).a(" = null;").toString()); +// +// indent--; +// +// write.add(builder().a("} else {").toString()); +// +// indent++; +// +// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); +// +// indent--; +// +// write.add(builder().a("}").toString()); +// } +// else +// throw new IllegalStateException("Unsupported type: " + type); +// } +// +// /** +// * @param type Field type. +// * @param name Field name. +// * @param colItemType Collection item type. +// * @param mapKeyType Map key type. +// * @param mapValType Map value type. +// * @param raw Raw read flag. +// */ +// private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, +// @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { +// assert type != null; +// +// String field = raw ? "null" : '"' + name + '"'; +// +// String retType = type.getSimpleName(); +// +// if (type == byte.class) +// returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); +// else if (type == short.class) +// returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); +// else if (type == int.class) +// returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); +// else if (type == long.class) +// returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); +// else if (type == float.class) +// returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); +// else if (type == double.class) +// returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); +// else if (type == char.class) +// returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); +// else if (type == boolean.class) +// returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); +// else if (type == byte[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); +// else if (type == short[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); +// else if (type == int[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); +// else if (type == long[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); +// else if (type == float[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); +// else if (type == double[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); +// else if (type == char[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); +// else if (type == boolean[].class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); +// else if (type == UUID.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); +// else if (type == ByteBuffer.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); +// else if (type == IgniteUuid.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); +// else if (type == GridClockDeltaVersion.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); +// else if (type == GridLongList.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); +// else if (type == GridByteArrayList.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); +// else if (type == GridCacheVersion.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); +// else if (type == GridDhtPartitionExchangeId.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); +// else if (type == GridCacheValueBytes.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); +// //else if (type == GridDrInternalRequestEntry.class) +// // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); +// else if (type == String.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); +// else if (type == BitSet.class) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); +// else if (type.isEnum()) { +// assert name != null; +// +// returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); +// +// read.add(EMPTY); +// read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); +// } +// else if (BASE_CLS.isAssignableFrom(type)) +// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); +// else if (type.isArray() || Collection.class.isAssignableFrom(type)) { +// assert name != null; +// +// boolean isArr = type.isArray(); +// +// if (isArr) +// colItemType = type.getComponentType(); +// +// assert colItemType != null; +// +// Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; +// +// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); +// +// indent++; +// +// returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// read.add(EMPTY); +// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); +// +// indent++; +// +// read.add(builder().a("if (").a(name).a(" == null)").toString()); +// +// indent++; +// +// if (isArr) { +// String val = colItemType.isArray() ? +// colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : +// colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; +// +// read.add(builder().a(name).a(" = new ").a(val).a(";"). +// toString()); +// } +// else { +// read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). +// toString()); +// } +// +// indent--; +// +// read.add(EMPTY); +// read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). +// toString()); +// +// indent++; +// +// String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; +// +// returnFalseIfReadFailed(colItemType, var, null, null, null, true); +// +// read.add(EMPTY); +// read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). +// a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); +// read.add(EMPTY); +// read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// read.add(EMPTY); +// read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); +// read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); +// } +// else if (Map.class.isAssignableFrom(type)) { +// assert name != null; +// assert mapKeyType != null; +// assert mapValType != null; +// +// Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; +// +// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); +// +// indent++; +// +// returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// read.add(EMPTY); +// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); +// +// indent++; +// +// read.add(builder().a("if (").a(name).a(" == null)").toString()); +// +// indent++; +// +// read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). +// toString()); +// +// indent--; +// +// read.add(EMPTY); +// read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). +// toString()); +// +// indent++; +// +// read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); +// +// indent++; +// +// String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; +// +// returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); +// +// read.add(EMPTY); +// read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); +// read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// read.add(EMPTY); +// +// var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; +// +// returnFalseIfReadFailed(mapValType, var, null, null, null, true); +// +// read.add(EMPTY); +// read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). +// a(", ").a(DFLT_LOC_VAR).a(");").toString()); +// read.add(EMPTY); +// read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); +// read.add(EMPTY); +// read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// +// indent--; +// +// read.add(builder().a("}").toString()); +// read.add(EMPTY); +// read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); +// read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); +// read.add(builder().a(CUR_VAR).a(" = null;").toString()); +// } +// else +// throw new IllegalStateException("Unsupported type: " + type); +// } +// +// /** +// * @param retType Return type. +// * @param var Variable name. +// * @param locVar Local variable name. +// * @param mtd Method name. +// * @param arg Method argument. +// * @param cast Whether cast is needed. +// */ +// private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, +// @Nullable String arg, boolean cast) { +// assert retType != null; +// assert mtd != null; +// +// if (var == null) +// var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); +// +// read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). +// a(arg != null ? "(" + arg + ");" : "();").toString()); +// read.add(EMPTY); +// +// read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); +// +// indent++; +// +// read.add(builder().a("return false;").toString()); +// +// indent--; +// } +// +// /** +// * @param code Code lines. +// * @param accessor Field or method name. +// * @param args Method arguments. +// */ +// private void returnFalseIfFailed(Collection code, String accessor, @Nullable String... args) { +// assert code != null; +// assert accessor != null; +// +// String argsStr = ""; +// +// if (args != null && args.length > 0) { +// for (String arg : args) +// argsStr += arg + ", "; +// +// argsStr = argsStr.substring(0, argsStr.length() - 2); +// } +// +// code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); +// +// indent++; +// +// code.add(builder().a("return false;").toString()); +// +// indent--; +// } +// +// /** +// * Creates new builder with correct indent. +// * +// * @return Builder. +// */ +// private SB builder() { +// assert indent > 0; +// +// SB sb = new SB(); +// +// for (int i = 0; i < indent; i++) +// sb.a(TAB); +// +// return sb; +// } +// +// /** +// * Gets all direct marshallable classes. +// * First classes will be classes from {@code classesOrder} with same order +// * as ordered values. Other classes will be at the end and ordered by name +// * (with package prefix). +// * That orders need for saving {@code directType} value. +// * +// * @return Classes. +// * @throws Exception In case of error. +// */ +// private Collection> classes() throws Exception { +// Collection> col = new TreeSet<>( +// new Comparator>() { +// @Override public int compare(Class c1, +// Class c2) { +// return c1.getName().compareTo(c2.getName()); +// } +// }); +// +// URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); +// +// for (URL url : ldr.getURLs()) { +// File file = new File(url.toURI()); +// +// int prefixLen = file.getPath().length() + 1; +// +// processFile(file, ldr, prefixLen, col); +// } +// +// return col; +// } +// +// /** +// * Recursively process provided file or directory. +// * +// * @param file File. +// * @param ldr Class loader. +// * @param prefixLen Path prefix length. +// * @param col Classes. +// * @throws Exception In case of error. +// */ +// private void processFile(File file, ClassLoader ldr, int prefixLen, +// Collection> col) throws Exception { +// assert file != null; +// assert ldr != null; +// assert prefixLen > 0; +// assert col != null; +// +// if (!file.exists()) +// throw new FileNotFoundException("File doesn't exist: " + file); +// +// if (file.isDirectory()) { +// for (File f : file.listFiles()) +// processFile(f, ldr, prefixLen, col); +// } +// else { +// assert file.isFile(); +// +// String path = file.getPath(); +// +// if (path.endsWith(".class")) { +// String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); +// +// Class cls = Class.forName(clsName, false, ldr); +// +// if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && +// !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) +// col.add((Class)cls); +// } +// } +// } +//} -- 1.9.3 (Apple Git-50) From 0b9ef4661cd90d7f9c4e0e3cab8777b82e0e9ff5 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 11:33:56 -0800 Subject: [PATCH 21/71] Merge branch 'ignite-sprint-1' of github.com:ggprivate/ggprivate into ignite-61 --- modules/codegen/pom.xml | 50 + .../codegen/CommunicationMessageCodeGenerator.java | 1127 ++++++++++++++++++++ .../ignite/internal/GridJobExecuteRequest.java | 866 +++++++-------- modules/tools/pom.xml | 6 - .../codegen/CommunicationMessageCodeGenerator.java | 1127 -------------------- pom.xml | 1 + 6 files changed, 1611 insertions(+), 1566 deletions(-) create mode 100644 modules/codegen/pom.xml create mode 100644 modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java delete mode 100644 modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml new file mode 100644 index 0000000..66a4eab --- /dev/null +++ b/modules/codegen/pom.xml @@ -0,0 +1,50 @@ + + + + + + + 4.0.0 + + + org.apache.ignite + ignite + ${ignite.version} + ../.. + + + ignite-codegen + + + UTF-8 + 1.7 + 1.7 + + + + + org.apache.ignite + ignite-core + ${ignite.version} + + + diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java new file mode 100644 index 0000000..469b575 --- /dev/null +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -0,0 +1,1127 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ +* __ ____/___________(_)______ /__ ____/______ ____(_)_______ +* _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ +* / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / +* \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ +*/ + +package org.apache.ignite.codegen; + +import com.sun.istack.internal.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; + +import java.io.*; +import java.lang.reflect.*; +import java.net.*; +import java.nio.*; +import java.util.*; + +import static java.lang.reflect.Modifier.*; + +/** +* Direct marshallable code generator. +*/ +public class CommunicationMessageCodeGenerator { + /** */ + private static final Comparator FIELD_CMP = new Comparator() { + @Override public int compare(Field f1, Field f2) { + int ver1 = 0; + + GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); + + if (verAnn1 != null) { + ver1 = verAnn1.value(); + + assert ver1 > 0; + } + + int ver2 = 0; + + GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); + + if (verAnn2 != null) { + ver2 = verAnn2.value(); + + assert ver2 > 0; + } + + return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); + } + }; + + /** */ + private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; + + /** */ + private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; + + /** */ + private static final String EMPTY = ""; + + /** */ + private static final String TAB = " "; + + /** */ + private static final String COMM_STATE_VAR = "commState"; + + /** */ + private static final String BUF_VAR = "buf"; + + /** */ + private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; + + /** */ + private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; + + /** */ + private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; + + /** */ + private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; + + /** */ + private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; + + /** */ + private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; + + /** */ + private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; + + /** */ + private static final String DFLT_LOC_VAR = "_val"; + + /** */ + private final Collection write = new ArrayList<>(); + + /** */ + private final Collection read = new ArrayList<>(); + + /** */ + private final Collection clone = new ArrayList<>(); + + /** */ + private final Collection clone0 = new ArrayList<>(); + + /** */ + private final Map, Integer> fieldCnt = new HashMap<>(); + + /** */ + private List fields; + + /** */ + private int indent; + + /** + * @param args Arguments. + */ + public static void main(String[] args) { + CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); + + try { + gen.generateAll(true); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Generates code for all classes. + * + * @param write Whether to write to file. + * @throws Exception In case of error. + */ + public void generateAll(boolean write) throws Exception { + Collection> classes = classes(); + + byte type = 0; + + for (Class cls : classes) { + boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); + + System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); + + if (write) + generateAndWrite(cls, isAbstract ? -1 : type++); + else + generate(cls); + } + +// type = 0; +// +// for (Class cls : classes) { +// if (Modifier.isAbstract(cls.getModifiers())) +// continue; +// +// System.out.println("case " + type++ + ":"); +// System.out.println(" return new " + cls.getSimpleName() + "();"); +// System.out.println(); +// } + } + + /** + * Generates code for provided class and writes it to source file. + * Note: this method must be called only from {@code generateAll(boolean)} + * and only with updating {@code CLASSES_ORDER_FILE} and other auto generated files. + * + * @param cls Class. + * @throws Exception In case of error. + */ + @SuppressWarnings("ConstantConditions") + private void generateAndWrite(Class cls, byte type) throws Exception { + assert cls != null; + + generate(cls); + + File file = new File(SRC_DIR, cls.getName().replace('.', File.separatorChar) + ".java"); + + if (!file.exists() || !file.isFile()) { + System.out.println(" Source file not found: " + file.getPath()); + + return; + } + + Collection src = new ArrayList<>(); + + BufferedReader rdr = null; + + try { + rdr = new BufferedReader(new FileReader(file)); + + String line; + boolean skip = false; + + boolean writeFound = false; + boolean readFound = false; + boolean cloneFound = false; + boolean clone0Found = false; + + while ((line = rdr.readLine()) != null) { + if (!skip) { + src.add(line); + + if (line.contains("public boolean writeTo(ByteBuffer buf)")) { + src.addAll(write); + + skip = true; + + writeFound = true; + } + else if (line.contains("public boolean readFrom(ByteBuffer buf)")) { + src.addAll(read); + + skip = true; + + readFound = true; + } +// else if (type >= 0 && line.contains("public byte directType()")) { +// src.add(TAB + TAB + "return " + type + ';'); +// +// skip = true; +// } + else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { + src.addAll(clone); + + skip = true; + + cloneFound = true; + } + else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { + src.addAll(clone0); + + skip = true; + + clone0Found = true; + } + } + else if (line.startsWith(TAB + "}")) { + src.add(line); + + skip = false; + } + } + + if (!writeFound) + System.out.println(" writeTo method doesn't exist."); + + if (!readFound) + System.out.println(" readFrom method doesn't exist."); + + if (!cloneFound) + System.out.println(" clone method doesn't exist."); + + if (!clone0Found) + System.out.println(" clone0 method doesn't exist."); + } + finally { + if (rdr != null) + rdr.close(); + } + + BufferedWriter wr = null; + + try { + wr = new BufferedWriter(new FileWriter(file)); + + for (String line : src) + wr.write(line + '\n'); + } + finally { + if (wr != null) + wr.close(); + } + } + + /** + * Generates code for provided class. + * + * @param cls Class. + * @throws Exception In case of error. + */ + public void generate(Class cls) throws Exception { + assert cls != null; + + write.clear(); + read.clear(); + clone.clear(); + clone0.clear(); + + fields = new ArrayList<>(); + + Field[] declaredFields = cls.getDeclaredFields(); + + for (Field field : declaredFields) { + int mod = field.getModifiers(); + + if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) + fields.add(field); + } + + Collections.sort(fields, FIELD_CMP); + + indent = 2; + + boolean hasSuper = cls.getSuperclass() != BASE_CLS; + + String clsName = cls.getSimpleName(); + + if (!Modifier.isAbstract(cls.getModifiers())) { + clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString()); + clone.add(EMPTY); + clone.add(builder().a("clone0(_clone);").toString()); + clone.add(EMPTY); + clone.add(builder().a("return _clone;").toString()); + } + + if (hasSuper) { + clone0.add(builder().a("super.clone0(_msg);").toString()); + clone0.add(EMPTY); + } + + Collection cloningFields = new ArrayList<>(declaredFields.length); + + for (Field field: declaredFields) + if (!isStatic(field.getModifiers())) + cloningFields.add(field); + + if (!cloningFields.isEmpty()) { + clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString()); + clone0.add(EMPTY); + + for (Field field : cloningFields) { + String name = field.getName(); + Class type = field.getType(); + + String res = name; + + if (BASE_CLS.isAssignableFrom(type)) + res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; + + clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); + } + } + + start(write, hasSuper ? "writeTo" : null, true); + start(read, hasSuper ? "readFrom" : null, false); + + indent++; + + int state = startState(cls); + + for (Field field : fields) + processField(field, state++); + + indent--; + + finish(write); + finish(read); + } + + /** + * @param cls Message class. + * @return Start state. + */ + private int startState(Class cls) { + assert cls != null; + + Class superCls = cls.getSuperclass(); + + Integer state = fieldCnt.get(superCls); + + if (state != null) + return state; + + state = 0; + + while (cls.getSuperclass() != BASE_CLS) { + cls = cls.getSuperclass(); + + for (Field field : cls.getDeclaredFields()) { + int mod = field.getModifiers(); + + if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) + state++; + } + } + + fieldCnt.put(superCls, state); + + return state; + } + + /** + * @param code Code lines. + * @param superMtd Super class method name. + * @param writeType Whether to write message type. + */ + private void start(Collection code, @Nullable String superMtd, boolean writeType) { + assert code != null; + + code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); + code.add(EMPTY); + + if (superMtd != null) { + returnFalseIfFailed(code, "super." + superMtd, BUF_VAR); + + code.add(EMPTY); + } + + if (writeType) { + code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); + + indent++; + + returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); + + code.add(EMPTY); + code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); + + indent--; + + code.add(builder().a("}").toString()); + code.add(EMPTY); + } + + if (!fields.isEmpty()) + code.add(builder().a("switch (").a(STATE_VAR).a(") {").toString()); + } + + /** + * @param code Code lines. + */ + private void finish(Collection code) { + assert code != null; + + if (!fields.isEmpty()) { + code.add(builder().a("}").toString()); + code.add(EMPTY); + } + + code.add(builder().a("return true;").toString()); + } + + /** + * @param field Field. + * @param opt Case option. + */ + private void processField(Field field, int opt) { + assert field != null; + assert opt >= 0; + + GridDirectCollection colAnn = field.getAnnotation(GridDirectCollection.class); + GridDirectMap mapAnn = field.getAnnotation(GridDirectMap.class); + + if (colAnn == null && Collection.class.isAssignableFrom(field.getType())) + throw new IllegalStateException("@GridDirectCollection annotation is not provided for field: " + + field.getName()); + + if (mapAnn == null && Map.class.isAssignableFrom(field.getType())) + throw new IllegalStateException("@GridDirectMap annotation is not provided for field: " + field.getName()); + + writeField(field, opt, colAnn, mapAnn); + readField(field, opt, colAnn, mapAnn); + } + + /** + * @param field Field. + * @param opt Case option. + * @param colAnn Collection annotation. + * @param mapAnn Map annotation. + */ + private void writeField(Field field, int opt, @Nullable GridDirectCollection colAnn, + @Nullable GridDirectMap mapAnn) { + assert field != null; + assert opt >= 0; + + write.add(builder().a("case ").a(opt).a(":").toString()); + + indent++; + + returnFalseIfWriteFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, + mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); + + write.add(EMPTY); + write.add(builder().a(STATE_VAR).a("++;").toString()); + write.add(EMPTY); + + indent--; + } + + /** + * @param field Field. + * @param opt Case option. + * @param colAnn Collection annotation. + * @param mapAnn Map annotation. + */ + private void readField(Field field, int opt, @Nullable GridDirectCollection colAnn, + @Nullable GridDirectMap mapAnn) { + assert field != null; + assert opt >= 0; + + read.add(builder().a("case ").a(opt).a(":").toString()); + + indent++; + + returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, + mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); + + read.add(EMPTY); + read.add(builder().a(STATE_VAR).a("++;").toString()); + read.add(EMPTY); + + indent--; + } + + /** + * @param type Field type. + * @param name Field name. + * @param colItemType Collection item type. + * @param mapKeyType Map key type. + * @param mapValType Map key value. + * @param raw Raw write flag. + */ + private void returnFalseIfWriteFailed(Class type, String name, @Nullable Class colItemType, + @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { + assert type != null; + assert name != null; + + String field = raw ? "null" : '"' + name + '"'; + + if (type == byte.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); + else if (type == short.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); + else if (type == int.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); + else if (type == long.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); + else if (type == float.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); + else if (type == double.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); + else if (type == char.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); + else if (type == boolean.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); + else if (type == byte[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); + else if (type == short[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); + else if (type == int[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); + else if (type == long[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); + else if (type == float[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); + else if (type == double[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); + else if (type == char[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); + else if (type == boolean[].class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); + else if (type == UUID.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); + else if (type == ByteBuffer.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); + else if (type == IgniteUuid.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); + else if (type == GridClockDeltaVersion.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); + else if (type == GridByteArrayList.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); + else if (type == GridLongList.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); + else if (type == GridCacheVersion.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); + else if (type == GridDhtPartitionExchangeId.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); + else if (type == GridCacheValueBytes.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); + //else if (type == GridDrInternalRequestEntry.class) + // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); + else if (type == String.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); + else if (type == BitSet.class) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); + else if (type.isEnum()) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); + else if (BASE_CLS.isAssignableFrom(type)) + returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); + else if (type.isArray() || Collection.class.isAssignableFrom(type)) { + boolean isArr = type.isArray(); + + if (isArr) + colItemType = type.getComponentType(); + + assert colItemType != null; + + write.add(builder().a("if (").a(name).a(" != null) {").toString()); + + indent++; + + write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); + + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). + a(";").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). + toString()); + + indent++; + + write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); + + indent++; + + write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); + + indent--; + + write.add(EMPTY); + + returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, + null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = null;").toString()); + + indent--; + + write.add(builder().a("} else {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); + + indent--; + + write.add(builder().a("}").toString()); + } + else if (Map.class.isAssignableFrom(type)) { + assert mapKeyType != null; + assert mapValType != null; + + write.add(builder().a("if (").a(name).a(" != null) {").toString()); + + indent++; + + write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); + + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). + toString()); + + indent++; + + write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); + + indent++; + + write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); + + indent--; + + String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + + U.box(mapValType).getSimpleName() + ">"; + + write.add(EMPTY); + write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); + write.add(EMPTY); + write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); + + indent++; + + returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + + returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); + + write.add(EMPTY); + write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); + write.add(EMPTY); + write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); + + indent--; + + write.add(builder().a("}").toString()); + write.add(EMPTY); + write.add(builder().a(IT_VAR).a(" = null;").toString()); + + indent--; + + write.add(builder().a("} else {").toString()); + + indent++; + + returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); + + indent--; + + write.add(builder().a("}").toString()); + } + else + throw new IllegalStateException("Unsupported type: " + type); + } + + /** + * @param type Field type. + * @param name Field name. + * @param colItemType Collection item type. + * @param mapKeyType Map key type. + * @param mapValType Map value type. + * @param raw Raw read flag. + */ + private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, + @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { + assert type != null; + + String field = raw ? "null" : '"' + name + '"'; + + String retType = type.getSimpleName(); + + if (type == byte.class) + returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); + else if (type == short.class) + returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); + else if (type == int.class) + returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); + else if (type == long.class) + returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); + else if (type == float.class) + returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); + else if (type == double.class) + returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); + else if (type == char.class) + returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); + else if (type == boolean.class) + returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); + else if (type == byte[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); + else if (type == short[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); + else if (type == int[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); + else if (type == long[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); + else if (type == float[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); + else if (type == double[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); + else if (type == char[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); + else if (type == boolean[].class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); + else if (type == UUID.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); + else if (type == ByteBuffer.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); + else if (type == IgniteUuid.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); + else if (type == GridClockDeltaVersion.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); + else if (type == GridLongList.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); + else if (type == GridByteArrayList.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); + else if (type == GridCacheVersion.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); + else if (type == GridDhtPartitionExchangeId.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); + else if (type == GridCacheValueBytes.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); + //else if (type == GridDrInternalRequestEntry.class) + // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); + else if (type == String.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); + else if (type == BitSet.class) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); + else if (type.isEnum()) { + assert name != null; + + returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); + + read.add(EMPTY); + read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); + } + else if (BASE_CLS.isAssignableFrom(type)) + returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); + else if (type.isArray() || Collection.class.isAssignableFrom(type)) { + assert name != null; + + boolean isArr = type.isArray(); + + if (isArr) + colItemType = type.getComponentType(); + + assert colItemType != null; + + Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; + + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); + + indent++; + + returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); + + indent++; + + read.add(builder().a("if (").a(name).a(" == null)").toString()); + + indent++; + + if (isArr) { + String val = colItemType.isArray() ? + colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : + colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; + + read.add(builder().a(name).a(" = new ").a(val).a(";"). + toString()); + } + else { + read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). + toString()); + } + + indent--; + + read.add(EMPTY); + read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). + toString()); + + indent++; + + String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(colItemType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). + a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); + read.add(EMPTY); + read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); + read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); + } + else if (Map.class.isAssignableFrom(type)) { + assert name != null; + assert mapKeyType != null; + assert mapValType != null; + + Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; + + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); + + indent++; + + returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); + + indent++; + + read.add(builder().a("if (").a(name).a(" == null)").toString()); + + indent++; + + read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). + toString()); + + indent--; + + read.add(EMPTY); + read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). + toString()); + + indent++; + + read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); + + indent++; + + String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); + read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + + var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; + + returnFalseIfReadFailed(mapValType, var, null, null, null, true); + + read.add(EMPTY); + read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). + a(", ").a(DFLT_LOC_VAR).a(");").toString()); + read.add(EMPTY); + read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); + read.add(EMPTY); + read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); + + indent--; + + read.add(builder().a("}").toString()); + + indent--; + + read.add(builder().a("}").toString()); + read.add(EMPTY); + read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); + read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); + read.add(builder().a(CUR_VAR).a(" = null;").toString()); + } + else + throw new IllegalStateException("Unsupported type: " + type); + } + + /** + * @param retType Return type. + * @param var Variable name. + * @param locVar Local variable name. + * @param mtd Method name. + * @param arg Method argument. + * @param cast Whether cast is needed. + */ + private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, + @Nullable String arg, boolean cast) { + assert retType != null; + assert mtd != null; + + if (var == null) + var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); + + read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). + a(arg != null ? "(" + arg + ");" : "();").toString()); + read.add(EMPTY); + + read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); + + indent++; + + read.add(builder().a("return false;").toString()); + + indent--; + } + + /** + * @param code Code lines. + * @param accessor Field or method name. + * @param args Method arguments. + */ + private void returnFalseIfFailed(Collection code, String accessor, @Nullable String... args) { + assert code != null; + assert accessor != null; + + String argsStr = ""; + + if (args != null && args.length > 0) { + for (String arg : args) + argsStr += arg + ", "; + + argsStr = argsStr.substring(0, argsStr.length() - 2); + } + + code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); + + indent++; + + code.add(builder().a("return false;").toString()); + + indent--; + } + + /** + * Creates new builder with correct indent. + * + * @return Builder. + */ + private SB builder() { + assert indent > 0; + + SB sb = new SB(); + + for (int i = 0; i < indent; i++) + sb.a(TAB); + + return sb; + } + + /** + * Gets all direct marshallable classes. + * First classes will be classes from {@code classesOrder} with same order + * as ordered values. Other classes will be at the end and ordered by name + * (with package prefix). + * That orders need for saving {@code directType} value. + * + * @return Classes. + * @throws Exception In case of error. + */ + private Collection> classes() throws Exception { + Collection> col = new TreeSet<>( + new Comparator>() { + @Override public int compare(Class c1, + Class c2) { + return c1.getName().compareTo(c2.getName()); + } + }); + + URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); + + for (URL url : ldr.getURLs()) { + File file = new File(url.toURI()); + + int prefixLen = file.getPath().length() + 1; + + processFile(file, ldr, prefixLen, col); + } + + return col; + } + + /** + * Recursively process provided file or directory. + * + * @param file File. + * @param ldr Class loader. + * @param prefixLen Path prefix length. + * @param col Classes. + * @throws Exception In case of error. + */ + private void processFile(File file, ClassLoader ldr, int prefixLen, + Collection> col) throws Exception { + assert file != null; + assert ldr != null; + assert prefixLen > 0; + assert col != null; + + if (!file.exists()) + throw new FileNotFoundException("File doesn't exist: " + file); + + if (file.isDirectory()) { + for (File f : file.listFiles()) + processFile(f, ldr, prefixLen, col); + } + else { + assert file.isFile(); + + String path = file.getPath(); + + if (path.endsWith(".class")) { + String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); + + Class cls = Class.forName(clsName, false, ldr); + + if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && + !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) + col.add((Class)cls); + } + } + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index d284749..20e4597 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -456,202 +456,202 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); - - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) - return false; - - commState.typeWritten = true; - } - - switch (commState.idx) { - case 0: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) - return false; - - commState.idx++; - - case 1: - if (!commState.putString("cpSpi", cpSpi)) - return false; - - commState.idx++; - - case 2: - if (!commState.putLong("createTime", createTime)) - return false; - - commState.idx++; - - case 3: - if (!commState.putEnum("depMode", depMode)) - return false; - - commState.idx++; - - case 4: - if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) - return false; - - commState.idx++; - - case 5: - if (!commState.putBoolean("forceLocDep", forceLocDep)) - return false; - - commState.idx++; - - case 6: - if (!commState.putBoolean("internal", internal)) - return false; - - commState.idx++; - - case 7: - if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) - return false; - - commState.idx++; - - case 8: - if (!commState.putByteArray("jobBytes", jobBytes)) - return false; - - commState.idx++; - - case 9: - if (!commState.putGridUuid("jobId", jobId)) - return false; - - commState.idx++; - - case 9: - if (ldrParticipants != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParticipants.size())) - return false; - - commState.it = ldrParticipants.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } - - commState.idx++; - - case 11: - if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) - return false; - - commState.idx++; - - case 12: - if (!commState.putBoolean(sesFullSup)) - return false; - - commState.idx++; - - case 13: - if (!commState.putGridUuid("sesId", sesId)) - return false; - - commState.idx++; - - case 14: - if (!commState.putByteArray("siblingsBytes", siblingsBytes)) - return false; - - commState.idx++; - - case 15: - if (!commState.putLong("startTaskTime", startTaskTime)) - return false; - - commState.idx++; - - case 16: - if (!commState.putUuid("subjId", subjId)) - return false; - - commState.idx++; - - case 17: - if (!commState.putString("taskClsName", taskClsName)) - return false; - - commState.idx++; - - case 18: - if (!commState.putString("taskName", taskName)) - return false; - - commState.idx++; - - case 19: - if (!commState.putLong("timeout", timeout)) - return false; - - commState.idx++; - - case 19: - if (top != null) { - if (commState.it == null) { - if (!commState.putInt(null, top.size())) - return false; - - commState.it = top.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putUuid(null, (UUID)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } - - commState.idx++; - - case 21: - if (!commState.putString("userVer", userVer)) - return false; - - commState.idx++; - - } +// commState.setBuffer(buf); +// +// if (!commState.typeWritten) { +// if (!commState.putByte(null, directType())) +// return false; +// +// commState.typeWritten = true; +// } +// +// switch (commState.idx) { +// case 0: +// if (!commState.putGridUuid("clsLdrId", clsLdrId)) +// return false; +// +// commState.idx++; +// +// case 1: +// if (!commState.putString("cpSpi", cpSpi)) +// return false; +// +// commState.idx++; +// +// case 2: +// if (!commState.putLong("createTime", createTime)) +// return false; +// +// commState.idx++; +// +// case 3: +// if (!commState.putEnum("depMode", depMode)) +// return false; +// +// commState.idx++; +// +// case 4: +// if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) +// return false; +// +// commState.idx++; +// +// case 5: +// if (!commState.putBoolean("forceLocDep", forceLocDep)) +// return false; +// +// commState.idx++; +// +// case 6: +// if (!commState.putBoolean("internal", internal)) +// return false; +// +// commState.idx++; +// +// case 7: +// if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) +// return false; +// +// commState.idx++; +// +// case 8: +// if (!commState.putByteArray("jobBytes", jobBytes)) +// return false; +// +// commState.idx++; +// +// case 9: +// if (!commState.putGridUuid("jobId", jobId)) +// return false; +// +// commState.idx++; +// +// case 9: +// if (ldrParticipants != null) { +// if (commState.it == null) { +// if (!commState.putInt(null, ldrParticipants.size())) +// return false; +// +// commState.it = ldrParticipants.entrySet().iterator(); +// } +// +// while (commState.it.hasNext() || commState.cur != NULL) { +// if (commState.cur == NULL) +// commState.cur = commState.it.next(); +// +// Map.Entry e = (Map.Entry)commState.cur; +// +// if (!commState.keyDone) { +// if (!commState.putUuid(null, e.getKey())) +// return false; +// +// commState.keyDone = true; +// } +// +// if (!commState.putGridUuid(null, e.getValue())) +// return false; +// +// commState.keyDone = false; +// +// commState.cur = NULL; +// } +// +// commState.it = null; +// } else { +// if (!commState.putInt(null, -1)) +// return false; +// } +// +// commState.idx++; +// +// case 11: +// if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) +// return false; +// +// commState.idx++; +// +// case 12: +// if (!commState.putBoolean(sesFullSup)) +// return false; +// +// commState.idx++; +// +// case 13: +// if (!commState.putGridUuid("sesId", sesId)) +// return false; +// +// commState.idx++; +// +// case 14: +// if (!commState.putByteArray("siblingsBytes", siblingsBytes)) +// return false; +// +// commState.idx++; +// +// case 15: +// if (!commState.putLong("startTaskTime", startTaskTime)) +// return false; +// +// commState.idx++; +// +// case 16: +// if (!commState.putUuid("subjId", subjId)) +// return false; +// +// commState.idx++; +// +// case 17: +// if (!commState.putString("taskClsName", taskClsName)) +// return false; +// +// commState.idx++; +// +// case 18: +// if (!commState.putString("taskName", taskName)) +// return false; +// +// commState.idx++; +// +// case 19: +// if (!commState.putLong("timeout", timeout)) +// return false; +// +// commState.idx++; +// +// case 19: +// if (top != null) { +// if (commState.it == null) { +// if (!commState.putInt(null, top.size())) +// return false; +// +// commState.it = top.iterator(); +// } +// +// while (commState.it.hasNext() || commState.cur != NULL) { +// if (commState.cur == NULL) +// commState.cur = commState.it.next(); +// +// if (!commState.putUuid(null, (UUID)commState.cur)) +// return false; +// +// commState.cur = NULL; +// } +// +// commState.it = null; +// } else { +// if (!commState.putInt(null, -1)) +// return false; +// } +// +// commState.idx++; +// +// case 21: +// if (!commState.putString("userVer", userVer)) +// return false; +// +// commState.idx++; +// +// } return true; } @@ -659,243 +659,243 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); - - switch (commState.idx) { - case 0: - clsLdrId = commState.getGridUuid("clsLdrId"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 1: - cpSpi = commState.getString("cpSpi"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 2: - createTime = commState.getLong("createTime"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 3: - byte depMode0 = commState.getByte("depMode"); - - if (!commState.lastRead()) - return false; - - depMode = IgniteDeploymentMode.fromOrdinal(depMode0); - - commState.idx++; - - case 4: - dynamicSiblings = commState.getBoolean("dynamicSiblings"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 5: - forceLocDep = commState.getBoolean("forceLocDep"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 6: - internal = commState.getBoolean("internal"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 7: - jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 8: - jobBytes = commState.getByteArray("jobBytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 9: - jobId = commState.getGridUuid("jobId"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 9: - if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); - - if (!commState.lastRead()) - return false; - } - - if (commState.readSize >= 0) { - if (ldrParticipants == null) - ldrParticipants = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParticipants.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; - - commState.idx++; - - case 11: - sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 12: - sesFullSup = commState.getBoolean("sesFullSup"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 13: - sesId = commState.getGridUuid("sesId"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 14: - siblingsBytes = commState.getByteArray("siblingsBytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 15: - startTaskTime = commState.getLong("startTaskTime"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 16: - subjId = commState.getUuid("subjId"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 17: - taskClsName = commState.getString("taskClsName"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 18: - taskName = commState.getString("taskName"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 19: - timeout = commState.getLong("timeout"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - case 19: - if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); - - if (!commState.lastRead()) - return false; - } - - if (commState.readSize >= 0) { - if (top == null) - top = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - top.add((UUID)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - - commState.idx++; - - case 21: - userVer = commState.getString("userVer"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - } +// commState.setBuffer(buf); +// +// switch (commState.idx) { +// case 0: +// clsLdrId = commState.getGridUuid("clsLdrId"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 1: +// cpSpi = commState.getString("cpSpi"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 2: +// createTime = commState.getLong("createTime"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 3: +// byte depMode0 = commState.getByte("depMode"); +// +// if (!commState.lastRead()) +// return false; +// +// depMode = IgniteDeploymentMode.fromOrdinal(depMode0); +// +// commState.idx++; +// +// case 4: +// dynamicSiblings = commState.getBoolean("dynamicSiblings"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 5: +// forceLocDep = commState.getBoolean("forceLocDep"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 6: +// internal = commState.getBoolean("internal"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 7: +// jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 8: +// jobBytes = commState.getByteArray("jobBytes"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 9: +// jobId = commState.getGridUuid("jobId"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 9: +// if (commState.readSize == -1) { +// commState.readSize = commState.getInt(null); +// +// if (!commState.lastRead()) +// return false; +// } +// +// if (commState.readSize >= 0) { +// if (ldrParticipants == null) +// ldrParticipants = new HashMap<>(commState.readSize, 1.0f); +// +// for (int i = commState.readItems; i < commState.readSize; i++) { +// if (!commState.keyDone) { +// UUID _val = commState.getUuid(null); +// +// if (!commState.lastRead()) +// return false; +// +// commState.cur = _val; +// commState.keyDone = true; +// } +// +// IgniteUuid _val = commState.getGridUuid(null); +// +// if (!commState.lastRead()) +// return false; +// +// ldrParticipants.put((UUID)commState.cur, _val); +// +// commState.keyDone = false; +// +// commState.readItems++; +// } +// } +// +// commState.readSize = -1; +// commState.readItems = 0; +// commState.cur = null; +// +// commState.idx++; +// +// case 11: +// sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 12: +// sesFullSup = commState.getBoolean("sesFullSup"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 13: +// sesId = commState.getGridUuid("sesId"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 14: +// siblingsBytes = commState.getByteArray("siblingsBytes"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 15: +// startTaskTime = commState.getLong("startTaskTime"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 16: +// subjId = commState.getUuid("subjId"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 17: +// taskClsName = commState.getString("taskClsName"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 18: +// taskName = commState.getString("taskName"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 19: +// timeout = commState.getLong("timeout"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// case 19: +// if (commState.readSize == -1) { +// commState.readSize = commState.getInt(null); +// +// if (!commState.lastRead()) +// return false; +// } +// +// if (commState.readSize >= 0) { +// if (top == null) +// top = new ArrayList<>(commState.readSize); +// +// for (int i = commState.readItems; i < commState.readSize; i++) { +// UUID _val = commState.getUuid(null); +// +// if (!commState.lastRead()) +// return false; +// +// top.add((UUID)_val); +// +// commState.readItems++; +// } +// } +// +// commState.readSize = -1; +// commState.readItems = 0; +// +// commState.idx++; +// +// case 21: +// userVer = commState.getString("userVer"); +// +// if (!commState.lastRead()) +// return false; +// +// commState.idx++; +// +// } return true; } diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml index 3a01471..deab202 100644 --- a/modules/tools/pom.xml +++ b/modules/tools/pom.xml @@ -41,12 +41,6 @@ - - - - - - org.jodd jodd-lagarto diff --git a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java deleted file mode 100644 index fdd9991..0000000 --- a/modules/tools/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ /dev/null @@ -1,1127 +0,0 @@ -///* @java.file.header */ -// -///* _________ _____ __________________ _____ -// * __ ____/___________(_)______ /__ ____/______ ____(_)_______ -// * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ -// * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / -// * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ -// */ -// -//package org.apache.ignite.codegen; -// -//import com.sun.istack.internal.*; -//import org.apache.ignite.internal.*; -//import org.apache.ignite.internal.processors.cache.*; -//import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -//import org.apache.ignite.internal.processors.cache.version.*; -//import org.apache.ignite.internal.processors.clock.*; -//import org.apache.ignite.internal.util.*; -//import org.apache.ignite.internal.util.direct.*; -//import org.apache.ignite.internal.util.typedef.internal.*; -//import org.apache.ignite.lang.*; -// -//import java.io.*; -//import java.lang.reflect.*; -//import java.net.*; -//import java.nio.*; -//import java.util.*; -// -//import static java.lang.reflect.Modifier.*; -// -///** -// * Direct marshallable code generator. -// */ -//public class CommunicationMessageCodeGenerator { -// /** */ -// private static final Comparator FIELD_CMP = new Comparator() { -// @Override public int compare(Field f1, Field f2) { -// int ver1 = 0; -// -// GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); -// -// if (verAnn1 != null) { -// ver1 = verAnn1.value(); -// -// assert ver1 > 0; -// } -// -// int ver2 = 0; -// -// GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); -// -// if (verAnn2 != null) { -// ver2 = verAnn2.value(); -// -// assert ver2 > 0; -// } -// -// return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); -// } -// }; -// -// /** */ -// private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; -// -// /** */ -// private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; -// -// /** */ -// private static final String EMPTY = ""; -// -// /** */ -// private static final String TAB = " "; -// -// /** */ -// private static final String COMM_STATE_VAR = "commState"; -// -// /** */ -// private static final String BUF_VAR = "buf"; -// -// /** */ -// private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; -// -// /** */ -// private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; -// -// /** */ -// private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; -// -// /** */ -// private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; -// -// /** */ -// private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; -// -// /** */ -// private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; -// -// /** */ -// private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; -// -// /** */ -// private static final String DFLT_LOC_VAR = "_val"; -// -// /** */ -// private final Collection write = new ArrayList<>(); -// -// /** */ -// private final Collection read = new ArrayList<>(); -// -// /** */ -// private final Collection clone = new ArrayList<>(); -// -// /** */ -// private final Collection clone0 = new ArrayList<>(); -// -// /** */ -// private final Map, Integer> fieldCnt = new HashMap<>(); -// -// /** */ -// private List fields; -// -// /** */ -// private int indent; -// -// /** -// * @param args Arguments. -// */ -// public static void main(String[] args) { -// CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); -// -// try { -// gen.generateAll(true); -// } -// catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -// /** -// * Generates code for all classes. -// * -// * @param write Whether to write to file. -// * @throws Exception In case of error. -// */ -// public void generateAll(boolean write) throws Exception { -// Collection> classes = classes(); -// -// byte type = 0; -// -// for (Class cls : classes) { -// boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); -// -// System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); -// -// if (write) -// generateAndWrite(cls, isAbstract ? -1 : type++); -// else -// generate(cls); -// } -// -//// type = 0; -//// -//// for (Class cls : classes) { -//// if (Modifier.isAbstract(cls.getModifiers())) -//// continue; -//// -//// System.out.println("case " + type++ + ":"); -//// System.out.println(" return new " + cls.getSimpleName() + "();"); -//// System.out.println(); -//// } -// } -// -// /** -// * Generates code for provided class and writes it to source file. -// * Note: this method must be called only from {@code generateAll(boolean)} -// * and only with updating {@code CLASSES_ORDER_FILE} and other auto generated files. -// * -// * @param cls Class. -// * @throws Exception In case of error. -// */ -// @SuppressWarnings("ConstantConditions") -// private void generateAndWrite(Class cls, byte type) throws Exception { -// assert cls != null; -// -// generate(cls); -// -// File file = new File(SRC_DIR, cls.getName().replace('.', File.separatorChar) + ".java"); -// -// if (!file.exists() || !file.isFile()) { -// System.out.println(" Source file not found: " + file.getPath()); -// -// return; -// } -// -// Collection src = new ArrayList<>(); -// -// BufferedReader rdr = null; -// -// try { -// rdr = new BufferedReader(new FileReader(file)); -// -// String line; -// boolean skip = false; -// -// boolean writeFound = false; -// boolean readFound = false; -// boolean cloneFound = false; -// boolean clone0Found = false; -// -// while ((line = rdr.readLine()) != null) { -// if (!skip) { -// src.add(line); -// -// if (line.contains("public boolean writeTo(ByteBuffer buf)")) { -// src.addAll(write); -// -// skip = true; -// -// writeFound = true; -// } -// else if (line.contains("public boolean readFrom(ByteBuffer buf)")) { -// src.addAll(read); -// -// skip = true; -// -// readFound = true; -// } -//// else if (type >= 0 && line.contains("public byte directType()")) { -//// src.add(TAB + TAB + "return " + type + ';'); -//// -//// skip = true; -//// } -// else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { -// src.addAll(clone); -// -// skip = true; -// -// cloneFound = true; -// } -// else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { -// src.addAll(clone0); -// -// skip = true; -// -// clone0Found = true; -// } -// } -// else if (line.startsWith(TAB + "}")) { -// src.add(line); -// -// skip = false; -// } -// } -// -// if (!writeFound) -// System.out.println(" writeTo method doesn't exist."); -// -// if (!readFound) -// System.out.println(" readFrom method doesn't exist."); -// -// if (!cloneFound) -// System.out.println(" clone method doesn't exist."); -// -// if (!clone0Found) -// System.out.println(" clone0 method doesn't exist."); -// } -// finally { -// if (rdr != null) -// rdr.close(); -// } -// -// BufferedWriter wr = null; -// -// try { -// wr = new BufferedWriter(new FileWriter(file)); -// -// for (String line : src) -// wr.write(line + '\n'); -// } -// finally { -// if (wr != null) -// wr.close(); -// } -// } -// -// /** -// * Generates code for provided class. -// * -// * @param cls Class. -// * @throws Exception In case of error. -// */ -// public void generate(Class cls) throws Exception { -// assert cls != null; -// -// write.clear(); -// read.clear(); -// clone.clear(); -// clone0.clear(); -// -// fields = new ArrayList<>(); -// -// Field[] declaredFields = cls.getDeclaredFields(); -// -// for (Field field : declaredFields) { -// int mod = field.getModifiers(); -// -// if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) -// fields.add(field); -// } -// -// Collections.sort(fields, FIELD_CMP); -// -// indent = 2; -// -// boolean hasSuper = cls.getSuperclass() != BASE_CLS; -// -// String clsName = cls.getSimpleName(); -// -// if (!Modifier.isAbstract(cls.getModifiers())) { -// clone.add(builder().a(clsName).a(" _clone = new ").a(clsName).a("();").toString()); -// clone.add(EMPTY); -// clone.add(builder().a("clone0(_clone);").toString()); -// clone.add(EMPTY); -// clone.add(builder().a("return _clone;").toString()); -// } -// -// if (hasSuper) { -// clone0.add(builder().a("super.clone0(_msg);").toString()); -// clone0.add(EMPTY); -// } -// -// Collection cloningFields = new ArrayList<>(declaredFields.length); -// -// for (Field field: declaredFields) -// if (!isStatic(field.getModifiers())) -// cloningFields.add(field); -// -// if (!cloningFields.isEmpty()) { -// clone0.add(builder().a(clsName).a(" _clone = (").a(clsName).a(")_msg;").toString()); -// clone0.add(EMPTY); -// -// for (Field field : cloningFields) { -// String name = field.getName(); -// Class type = field.getType(); -// -// String res = name; -// -// if (BASE_CLS.isAssignableFrom(type)) -// res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; -// -// clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); -// } -// } -// -// start(write, hasSuper ? "writeTo" : null, true); -// start(read, hasSuper ? "readFrom" : null, false); -// -// indent++; -// -// int state = startState(cls); -// -// for (Field field : fields) -// processField(field, state++); -// -// indent--; -// -// finish(write); -// finish(read); -// } -// -// /** -// * @param cls Message class. -// * @return Start state. -// */ -// private int startState(Class cls) { -// assert cls != null; -// -// Class superCls = cls.getSuperclass(); -// -// Integer state = fieldCnt.get(superCls); -// -// if (state != null) -// return state; -// -// state = 0; -// -// while (cls.getSuperclass() != BASE_CLS) { -// cls = cls.getSuperclass(); -// -// for (Field field : cls.getDeclaredFields()) { -// int mod = field.getModifiers(); -// -// if (!isStatic(mod) && !isTransient(mod) && !field.isAnnotationPresent(GridDirectTransient.class)) -// state++; -// } -// } -// -// fieldCnt.put(superCls, state); -// -// return state; -// } -// -// /** -// * @param code Code lines. -// * @param superMtd Super class method name. -// * @param writeType Whether to write message type. -// */ -// private void start(Collection code, @Nullable String superMtd, boolean writeType) { -// assert code != null; -// -// code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); -// code.add(EMPTY); -// -// if (superMtd != null) { -// returnFalseIfFailed(code, "super." + superMtd, BUF_VAR); -// -// code.add(EMPTY); -// } -// -// if (writeType) { -// code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); -// -// indent++; -// -// returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); -// -// code.add(EMPTY); -// code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); -// -// indent--; -// -// code.add(builder().a("}").toString()); -// code.add(EMPTY); -// } -// -// if (!fields.isEmpty()) -// code.add(builder().a("switch (").a(STATE_VAR).a(") {").toString()); -// } -// -// /** -// * @param code Code lines. -// */ -// private void finish(Collection code) { -// assert code != null; -// -// if (!fields.isEmpty()) { -// code.add(builder().a("}").toString()); -// code.add(EMPTY); -// } -// -// code.add(builder().a("return true;").toString()); -// } -// -// /** -// * @param field Field. -// * @param opt Case option. -// */ -// private void processField(Field field, int opt) { -// assert field != null; -// assert opt >= 0; -// -// GridDirectCollection colAnn = field.getAnnotation(GridDirectCollection.class); -// GridDirectMap mapAnn = field.getAnnotation(GridDirectMap.class); -// -// if (colAnn == null && Collection.class.isAssignableFrom(field.getType())) -// throw new IllegalStateException("@GridDirectCollection annotation is not provided for field: " + -// field.getName()); -// -// if (mapAnn == null && Map.class.isAssignableFrom(field.getType())) -// throw new IllegalStateException("@GridDirectMap annotation is not provided for field: " + field.getName()); -// -// writeField(field, opt, colAnn, mapAnn); -// readField(field, opt, colAnn, mapAnn); -// } -// -// /** -// * @param field Field. -// * @param opt Case option. -// * @param colAnn Collection annotation. -// * @param mapAnn Map annotation. -// */ -// private void writeField(Field field, int opt, @Nullable GridDirectCollection colAnn, -// @Nullable GridDirectMap mapAnn) { -// assert field != null; -// assert opt >= 0; -// -// write.add(builder().a("case ").a(opt).a(":").toString()); -// -// indent++; -// -// returnFalseIfWriteFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, -// mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); -// -// write.add(EMPTY); -// write.add(builder().a(STATE_VAR).a("++;").toString()); -// write.add(EMPTY); -// -// indent--; -// } -// -// /** -// * @param field Field. -// * @param opt Case option. -// * @param colAnn Collection annotation. -// * @param mapAnn Map annotation. -// */ -// private void readField(Field field, int opt, @Nullable GridDirectCollection colAnn, -// @Nullable GridDirectMap mapAnn) { -// assert field != null; -// assert opt >= 0; -// -// read.add(builder().a("case ").a(opt).a(":").toString()); -// -// indent++; -// -// returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, -// mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); -// -// read.add(EMPTY); -// read.add(builder().a(STATE_VAR).a("++;").toString()); -// read.add(EMPTY); -// -// indent--; -// } -// -// /** -// * @param type Field type. -// * @param name Field name. -// * @param colItemType Collection item type. -// * @param mapKeyType Map key type. -// * @param mapValType Map key value. -// * @param raw Raw write flag. -// */ -// private void returnFalseIfWriteFailed(Class type, String name, @Nullable Class colItemType, -// @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { -// assert type != null; -// assert name != null; -// -// String field = raw ? "null" : '"' + name + '"'; -// -// if (type == byte.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); -// else if (type == short.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); -// else if (type == int.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); -// else if (type == long.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); -// else if (type == float.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); -// else if (type == double.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); -// else if (type == char.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); -// else if (type == boolean.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); -// else if (type == byte[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); -// else if (type == short[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); -// else if (type == int[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); -// else if (type == long[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); -// else if (type == float[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); -// else if (type == double[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); -// else if (type == char[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); -// else if (type == boolean[].class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); -// else if (type == UUID.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); -// else if (type == ByteBuffer.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); -// else if (type == IgniteUuid.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); -// else if (type == GridClockDeltaVersion.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); -// else if (type == GridByteArrayList.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); -// else if (type == GridLongList.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); -// else if (type == GridCacheVersion.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); -// else if (type == GridDhtPartitionExchangeId.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); -// else if (type == GridCacheValueBytes.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); -// //else if (type == GridDrInternalRequestEntry.class) -// // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); -// else if (type == String.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); -// else if (type == BitSet.class) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); -// else if (type.isEnum()) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); -// else if (BASE_CLS.isAssignableFrom(type)) -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); -// else if (type.isArray() || Collection.class.isAssignableFrom(type)) { -// boolean isArr = type.isArray(); -// -// if (isArr) -// colItemType = type.getComponentType(); -// -// assert colItemType != null; -// -// write.add(builder().a("if (").a(name).a(" != null) {").toString()); -// -// indent++; -// -// write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); -// -// indent++; -// -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); -// -// write.add(EMPTY); -// write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). -// a(";").toString()); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// write.add(EMPTY); -// write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). -// toString()); -// -// indent++; -// -// write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); -// -// indent++; -// -// write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); -// -// indent--; -// -// write.add(EMPTY); -// -// returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, -// null, null, null, true); -// -// write.add(EMPTY); -// write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// write.add(EMPTY); -// write.add(builder().a(IT_VAR).a(" = null;").toString()); -// -// indent--; -// -// write.add(builder().a("} else {").toString()); -// -// indent++; -// -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// } -// else if (Map.class.isAssignableFrom(type)) { -// assert mapKeyType != null; -// assert mapValType != null; -// -// write.add(builder().a("if (").a(name).a(" != null) {").toString()); -// -// indent++; -// -// write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); -// -// indent++; -// -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); -// -// write.add(EMPTY); -// write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// write.add(EMPTY); -// write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). -// toString()); -// -// indent++; -// -// write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); -// -// indent++; -// -// write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); -// -// indent--; -// -// String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + -// U.box(mapValType).getSimpleName() + ">"; -// -// write.add(EMPTY); -// write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); -// write.add(EMPTY); -// write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); -// -// indent++; -// -// returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); -// -// write.add(EMPTY); -// write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// write.add(EMPTY); -// -// returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); -// -// write.add(EMPTY); -// write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); -// write.add(EMPTY); -// write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// write.add(EMPTY); -// write.add(builder().a(IT_VAR).a(" = null;").toString()); -// -// indent--; -// -// write.add(builder().a("} else {").toString()); -// -// indent++; -// -// returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); -// -// indent--; -// -// write.add(builder().a("}").toString()); -// } -// else -// throw new IllegalStateException("Unsupported type: " + type); -// } -// -// /** -// * @param type Field type. -// * @param name Field name. -// * @param colItemType Collection item type. -// * @param mapKeyType Map key type. -// * @param mapValType Map value type. -// * @param raw Raw read flag. -// */ -// private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, -// @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { -// assert type != null; -// -// String field = raw ? "null" : '"' + name + '"'; -// -// String retType = type.getSimpleName(); -// -// if (type == byte.class) -// returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); -// else if (type == short.class) -// returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); -// else if (type == int.class) -// returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); -// else if (type == long.class) -// returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); -// else if (type == float.class) -// returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); -// else if (type == double.class) -// returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); -// else if (type == char.class) -// returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); -// else if (type == boolean.class) -// returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); -// else if (type == byte[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); -// else if (type == short[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); -// else if (type == int[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); -// else if (type == long[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); -// else if (type == float[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); -// else if (type == double[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); -// else if (type == char[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); -// else if (type == boolean[].class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); -// else if (type == UUID.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); -// else if (type == ByteBuffer.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); -// else if (type == IgniteUuid.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); -// else if (type == GridClockDeltaVersion.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); -// else if (type == GridLongList.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); -// else if (type == GridByteArrayList.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); -// else if (type == GridCacheVersion.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); -// else if (type == GridDhtPartitionExchangeId.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); -// else if (type == GridCacheValueBytes.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); -// //else if (type == GridDrInternalRequestEntry.class) -// // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); -// else if (type == String.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); -// else if (type == BitSet.class) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); -// else if (type.isEnum()) { -// assert name != null; -// -// returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); -// -// read.add(EMPTY); -// read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); -// } -// else if (BASE_CLS.isAssignableFrom(type)) -// returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); -// else if (type.isArray() || Collection.class.isAssignableFrom(type)) { -// assert name != null; -// -// boolean isArr = type.isArray(); -// -// if (isArr) -// colItemType = type.getComponentType(); -// -// assert colItemType != null; -// -// Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; -// -// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); -// -// indent++; -// -// returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// read.add(EMPTY); -// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); -// -// indent++; -// -// read.add(builder().a("if (").a(name).a(" == null)").toString()); -// -// indent++; -// -// if (isArr) { -// String val = colItemType.isArray() ? -// colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : -// colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; -// -// read.add(builder().a(name).a(" = new ").a(val).a(";"). -// toString()); -// } -// else { -// read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). -// toString()); -// } -// -// indent--; -// -// read.add(EMPTY); -// read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). -// toString()); -// -// indent++; -// -// String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; -// -// returnFalseIfReadFailed(colItemType, var, null, null, null, true); -// -// read.add(EMPTY); -// read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). -// a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); -// read.add(EMPTY); -// read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// read.add(EMPTY); -// read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); -// read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); -// } -// else if (Map.class.isAssignableFrom(type)) { -// assert name != null; -// assert mapKeyType != null; -// assert mapValType != null; -// -// Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; -// -// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); -// -// indent++; -// -// returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// read.add(EMPTY); -// read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); -// -// indent++; -// -// read.add(builder().a("if (").a(name).a(" == null)").toString()); -// -// indent++; -// -// read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). -// toString()); -// -// indent--; -// -// read.add(EMPTY); -// read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). -// toString()); -// -// indent++; -// -// read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); -// -// indent++; -// -// String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; -// -// returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); -// -// read.add(EMPTY); -// read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); -// read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// read.add(EMPTY); -// -// var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; -// -// returnFalseIfReadFailed(mapValType, var, null, null, null, true); -// -// read.add(EMPTY); -// read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). -// a(", ").a(DFLT_LOC_VAR).a(");").toString()); -// read.add(EMPTY); -// read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); -// read.add(EMPTY); -// read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// -// indent--; -// -// read.add(builder().a("}").toString()); -// read.add(EMPTY); -// read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); -// read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); -// read.add(builder().a(CUR_VAR).a(" = null;").toString()); -// } -// else -// throw new IllegalStateException("Unsupported type: " + type); -// } -// -// /** -// * @param retType Return type. -// * @param var Variable name. -// * @param locVar Local variable name. -// * @param mtd Method name. -// * @param arg Method argument. -// * @param cast Whether cast is needed. -// */ -// private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, -// @Nullable String arg, boolean cast) { -// assert retType != null; -// assert mtd != null; -// -// if (var == null) -// var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); -// -// read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). -// a(arg != null ? "(" + arg + ");" : "();").toString()); -// read.add(EMPTY); -// -// read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); -// -// indent++; -// -// read.add(builder().a("return false;").toString()); -// -// indent--; -// } -// -// /** -// * @param code Code lines. -// * @param accessor Field or method name. -// * @param args Method arguments. -// */ -// private void returnFalseIfFailed(Collection code, String accessor, @Nullable String... args) { -// assert code != null; -// assert accessor != null; -// -// String argsStr = ""; -// -// if (args != null && args.length > 0) { -// for (String arg : args) -// argsStr += arg + ", "; -// -// argsStr = argsStr.substring(0, argsStr.length() - 2); -// } -// -// code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); -// -// indent++; -// -// code.add(builder().a("return false;").toString()); -// -// indent--; -// } -// -// /** -// * Creates new builder with correct indent. -// * -// * @return Builder. -// */ -// private SB builder() { -// assert indent > 0; -// -// SB sb = new SB(); -// -// for (int i = 0; i < indent; i++) -// sb.a(TAB); -// -// return sb; -// } -// -// /** -// * Gets all direct marshallable classes. -// * First classes will be classes from {@code classesOrder} with same order -// * as ordered values. Other classes will be at the end and ordered by name -// * (with package prefix). -// * That orders need for saving {@code directType} value. -// * -// * @return Classes. -// * @throws Exception In case of error. -// */ -// private Collection> classes() throws Exception { -// Collection> col = new TreeSet<>( -// new Comparator>() { -// @Override public int compare(Class c1, -// Class c2) { -// return c1.getName().compareTo(c2.getName()); -// } -// }); -// -// URLClassLoader ldr = (URLClassLoader)getClass().getClassLoader(); -// -// for (URL url : ldr.getURLs()) { -// File file = new File(url.toURI()); -// -// int prefixLen = file.getPath().length() + 1; -// -// processFile(file, ldr, prefixLen, col); -// } -// -// return col; -// } -// -// /** -// * Recursively process provided file or directory. -// * -// * @param file File. -// * @param ldr Class loader. -// * @param prefixLen Path prefix length. -// * @param col Classes. -// * @throws Exception In case of error. -// */ -// private void processFile(File file, ClassLoader ldr, int prefixLen, -// Collection> col) throws Exception { -// assert file != null; -// assert ldr != null; -// assert prefixLen > 0; -// assert col != null; -// -// if (!file.exists()) -// throw new FileNotFoundException("File doesn't exist: " + file); -// -// if (file.isDirectory()) { -// for (File f : file.listFiles()) -// processFile(f, ldr, prefixLen, col); -// } -// else { -// assert file.isFile(); -// -// String path = file.getPath(); -// -// if (path.endsWith(".class")) { -// String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); -// -// Class cls = Class.forName(clsName, false, ldr); -// -// if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && -// !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) -// col.add((Class)cls); -// } -// } -// } -//} diff --git a/pom.xml b/pom.xml index 3980367..25d64e8 100644 --- a/pom.xml +++ b/pom.xml @@ -116,6 +116,7 @@ modules/slf4j modules/jcl modules/schema-load + modules/codegen -- 1.9.3 (Apple Git-50) From a8522ac62ffcbb53034de5653ecff071f0ca7af7 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 11:42:03 -0800 Subject: [PATCH 22/71] IGNITE-61 - Fixed compilation --- .../org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 469b575..3649830 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -9,7 +9,6 @@ package org.apache.ignite.codegen; -import com.sun.istack.internal.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; @@ -19,6 +18,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; import java.io.*; import java.lang.reflect.*; -- 1.9.3 (Apple Git-50) From e9e180cbd1cb7b4125b4dcf846c080fa048d600f Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 11:45:42 -0800 Subject: [PATCH 23/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 10 +- .../ignite/internal/GridJobExecuteRequest.java | 852 ++++++++++----------- 2 files changed, 424 insertions(+), 438 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 3649830..c833c70 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -129,7 +129,9 @@ public class CommunicationMessageCodeGenerator { CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); try { - gen.generateAll(true); + gen.generateAndWrite(GridJobExecuteRequest.class); + + //gen.generateAll(true); } catch (Exception e) { e.printStackTrace(); @@ -145,15 +147,13 @@ public class CommunicationMessageCodeGenerator { public void generateAll(boolean write) throws Exception { Collection> classes = classes(); - byte type = 0; - for (Class cls : classes) { boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); if (write) - generateAndWrite(cls, isAbstract ? -1 : type++); + generateAndWrite(cls); else generate(cls); } @@ -179,7 +179,7 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ @SuppressWarnings("ConstantConditions") - private void generateAndWrite(Class cls, byte type) throws Exception { + private void generateAndWrite(Class cls) throws Exception { assert cls != null; generate(cls); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index 20e4597..aac47f9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -456,202 +456,196 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { -// commState.setBuffer(buf); -// -// if (!commState.typeWritten) { -// if (!commState.putByte(null, directType())) -// return false; -// -// commState.typeWritten = true; -// } -// -// switch (commState.idx) { -// case 0: -// if (!commState.putGridUuid("clsLdrId", clsLdrId)) -// return false; -// -// commState.idx++; -// -// case 1: -// if (!commState.putString("cpSpi", cpSpi)) -// return false; -// -// commState.idx++; -// -// case 2: -// if (!commState.putLong("createTime", createTime)) -// return false; -// -// commState.idx++; -// -// case 3: -// if (!commState.putEnum("depMode", depMode)) -// return false; -// -// commState.idx++; -// -// case 4: -// if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) -// return false; -// -// commState.idx++; -// -// case 5: -// if (!commState.putBoolean("forceLocDep", forceLocDep)) -// return false; -// -// commState.idx++; -// -// case 6: -// if (!commState.putBoolean("internal", internal)) -// return false; -// -// commState.idx++; -// -// case 7: -// if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) -// return false; -// -// commState.idx++; -// -// case 8: -// if (!commState.putByteArray("jobBytes", jobBytes)) -// return false; -// -// commState.idx++; -// -// case 9: -// if (!commState.putGridUuid("jobId", jobId)) -// return false; -// -// commState.idx++; -// -// case 9: -// if (ldrParticipants != null) { -// if (commState.it == null) { -// if (!commState.putInt(null, ldrParticipants.size())) -// return false; -// -// commState.it = ldrParticipants.entrySet().iterator(); -// } -// -// while (commState.it.hasNext() || commState.cur != NULL) { -// if (commState.cur == NULL) -// commState.cur = commState.it.next(); -// -// Map.Entry e = (Map.Entry)commState.cur; -// -// if (!commState.keyDone) { -// if (!commState.putUuid(null, e.getKey())) -// return false; -// -// commState.keyDone = true; -// } -// -// if (!commState.putGridUuid(null, e.getValue())) -// return false; -// -// commState.keyDone = false; -// -// commState.cur = NULL; -// } -// -// commState.it = null; -// } else { -// if (!commState.putInt(null, -1)) -// return false; -// } -// -// commState.idx++; -// -// case 11: -// if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) -// return false; -// -// commState.idx++; -// -// case 12: -// if (!commState.putBoolean(sesFullSup)) -// return false; -// -// commState.idx++; -// -// case 13: -// if (!commState.putGridUuid("sesId", sesId)) -// return false; -// -// commState.idx++; -// -// case 14: -// if (!commState.putByteArray("siblingsBytes", siblingsBytes)) -// return false; -// -// commState.idx++; -// -// case 15: -// if (!commState.putLong("startTaskTime", startTaskTime)) -// return false; -// -// commState.idx++; -// -// case 16: -// if (!commState.putUuid("subjId", subjId)) -// return false; -// -// commState.idx++; -// -// case 17: -// if (!commState.putString("taskClsName", taskClsName)) -// return false; -// -// commState.idx++; -// -// case 18: -// if (!commState.putString("taskName", taskName)) -// return false; -// -// commState.idx++; -// -// case 19: -// if (!commState.putLong("timeout", timeout)) -// return false; -// -// commState.idx++; -// -// case 19: -// if (top != null) { -// if (commState.it == null) { -// if (!commState.putInt(null, top.size())) -// return false; -// -// commState.it = top.iterator(); -// } -// -// while (commState.it.hasNext() || commState.cur != NULL) { -// if (commState.cur == NULL) -// commState.cur = commState.it.next(); -// -// if (!commState.putUuid(null, (UUID)commState.cur)) -// return false; -// -// commState.cur = NULL; -// } -// -// commState.it = null; -// } else { -// if (!commState.putInt(null, -1)) -// return false; -// } -// -// commState.idx++; -// -// case 21: -// if (!commState.putString("userVer", userVer)) -// return false; -// -// commState.idx++; -// -// } + commState.setBuffer(buf); + + if (!commState.typeWritten) { + if (!commState.putByte(null, directType())) + return false; + + commState.typeWritten = true; + } + + switch (commState.idx) { + case 0: + if (!commState.putGridUuid("clsLdrId", clsLdrId)) + return false; + + commState.idx++; + + case 1: + if (!commState.putString("cpSpi", cpSpi)) + return false; + + commState.idx++; + + case 2: + if (!commState.putEnum("depMode", depMode)) + return false; + + commState.idx++; + + case 3: + if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) + return false; + + commState.idx++; + + case 4: + if (!commState.putBoolean("forceLocDep", forceLocDep)) + return false; + + commState.idx++; + + case 5: + if (!commState.putBoolean("internal", internal)) + return false; + + commState.idx++; + + case 6: + if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) + return false; + + commState.idx++; + + case 7: + if (!commState.putByteArray("jobBytes", jobBytes)) + return false; + + commState.idx++; + + case 8: + if (!commState.putGridUuid("jobId", jobId)) + return false; + + commState.idx++; + + case 9: + if (ldrParticipants != null) { + if (commState.it == null) { + if (!commState.putInt(null, ldrParticipants.size())) + return false; + + commState.it = ldrParticipants.entrySet().iterator(); + } + + while (commState.it.hasNext() || commState.cur != NULL) { + if (commState.cur == NULL) + commState.cur = commState.it.next(); + + Map.Entry e = (Map.Entry)commState.cur; + + if (!commState.keyDone) { + if (!commState.putUuid(null, e.getKey())) + return false; + + commState.keyDone = true; + } + + if (!commState.putGridUuid(null, e.getValue())) + return false; + + commState.keyDone = false; + + commState.cur = NULL; + } + + commState.it = null; + } else { + if (!commState.putInt(null, -1)) + return false; + } + + commState.idx++; + + case 10: + if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) + return false; + + commState.idx++; + + case 11: + if (!commState.putBoolean("sesFullSup", sesFullSup)) + return false; + + commState.idx++; + + case 12: + if (!commState.putGridUuid("sesId", sesId)) + return false; + + commState.idx++; + + case 13: + if (!commState.putByteArray("siblingsBytes", siblingsBytes)) + return false; + + commState.idx++; + + case 14: + if (!commState.putLong("startTaskTime", startTaskTime)) + return false; + + commState.idx++; + + case 15: + if (!commState.putUuid("subjId", subjId)) + return false; + + commState.idx++; + + case 16: + if (!commState.putString("taskClsName", taskClsName)) + return false; + + commState.idx++; + + case 17: + if (!commState.putString("taskName", taskName)) + return false; + + commState.idx++; + + case 18: + if (!commState.putLong("timeout", timeout)) + return false; + + commState.idx++; + + case 19: + if (top != null) { + if (commState.it == null) { + if (!commState.putInt(null, top.size())) + return false; + + commState.it = top.iterator(); + } + + while (commState.it.hasNext() || commState.cur != NULL) { + if (commState.cur == NULL) + commState.cur = commState.it.next(); + + if (!commState.putUuid(null, (UUID)commState.cur)) + return false; + + commState.cur = NULL; + } + + commState.it = null; + } else { + if (!commState.putInt(null, -1)) + return false; + } + + commState.idx++; + + case 20: + if (!commState.putString("userVer", userVer)) + return false; + + commState.idx++; + + } return true; } @@ -659,243 +653,235 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { -// commState.setBuffer(buf); -// -// switch (commState.idx) { -// case 0: -// clsLdrId = commState.getGridUuid("clsLdrId"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 1: -// cpSpi = commState.getString("cpSpi"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 2: -// createTime = commState.getLong("createTime"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 3: -// byte depMode0 = commState.getByte("depMode"); -// -// if (!commState.lastRead()) -// return false; -// -// depMode = IgniteDeploymentMode.fromOrdinal(depMode0); -// -// commState.idx++; -// -// case 4: -// dynamicSiblings = commState.getBoolean("dynamicSiblings"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 5: -// forceLocDep = commState.getBoolean("forceLocDep"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 6: -// internal = commState.getBoolean("internal"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 7: -// jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 8: -// jobBytes = commState.getByteArray("jobBytes"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 9: -// jobId = commState.getGridUuid("jobId"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 9: -// if (commState.readSize == -1) { -// commState.readSize = commState.getInt(null); -// -// if (!commState.lastRead()) -// return false; -// } -// -// if (commState.readSize >= 0) { -// if (ldrParticipants == null) -// ldrParticipants = new HashMap<>(commState.readSize, 1.0f); -// -// for (int i = commState.readItems; i < commState.readSize; i++) { -// if (!commState.keyDone) { -// UUID _val = commState.getUuid(null); -// -// if (!commState.lastRead()) -// return false; -// -// commState.cur = _val; -// commState.keyDone = true; -// } -// -// IgniteUuid _val = commState.getGridUuid(null); -// -// if (!commState.lastRead()) -// return false; -// -// ldrParticipants.put((UUID)commState.cur, _val); -// -// commState.keyDone = false; -// -// commState.readItems++; -// } -// } -// -// commState.readSize = -1; -// commState.readItems = 0; -// commState.cur = null; -// -// commState.idx++; -// -// case 11: -// sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 12: -// sesFullSup = commState.getBoolean("sesFullSup"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 13: -// sesId = commState.getGridUuid("sesId"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 14: -// siblingsBytes = commState.getByteArray("siblingsBytes"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 15: -// startTaskTime = commState.getLong("startTaskTime"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 16: -// subjId = commState.getUuid("subjId"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 17: -// taskClsName = commState.getString("taskClsName"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 18: -// taskName = commState.getString("taskName"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 19: -// timeout = commState.getLong("timeout"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// case 19: -// if (commState.readSize == -1) { -// commState.readSize = commState.getInt(null); -// -// if (!commState.lastRead()) -// return false; -// } -// -// if (commState.readSize >= 0) { -// if (top == null) -// top = new ArrayList<>(commState.readSize); -// -// for (int i = commState.readItems; i < commState.readSize; i++) { -// UUID _val = commState.getUuid(null); -// -// if (!commState.lastRead()) -// return false; -// -// top.add((UUID)_val); -// -// commState.readItems++; -// } -// } -// -// commState.readSize = -1; -// commState.readItems = 0; -// -// commState.idx++; -// -// case 21: -// userVer = commState.getString("userVer"); -// -// if (!commState.lastRead()) -// return false; -// -// commState.idx++; -// -// } + commState.setBuffer(buf); + + switch (commState.idx) { + case 0: + clsLdrId = commState.getGridUuid("clsLdrId"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 1: + cpSpi = commState.getString("cpSpi"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 2: + byte depMode0 = commState.getByte("depMode"); + + if (!commState.lastRead()) + return false; + + depMode = IgniteDeploymentMode.fromOrdinal(depMode0); + + commState.idx++; + + case 3: + dynamicSiblings = commState.getBoolean("dynamicSiblings"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 4: + forceLocDep = commState.getBoolean("forceLocDep"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 5: + internal = commState.getBoolean("internal"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 6: + jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 7: + jobBytes = commState.getByteArray("jobBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 8: + jobId = commState.getGridUuid("jobId"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 9: + if (commState.readSize == -1) { + commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; + } + + if (commState.readSize >= 0) { + if (ldrParticipants == null) + ldrParticipants = new HashMap<>(commState.readSize, 1.0f); + + for (int i = commState.readItems; i < commState.readSize; i++) { + if (!commState.keyDone) { + UUID _val = commState.getUuid(null); + + if (!commState.lastRead()) + return false; + + commState.cur = _val; + commState.keyDone = true; + } + + IgniteUuid _val = commState.getGridUuid(null); + + if (!commState.lastRead()) + return false; + + ldrParticipants.put((UUID)commState.cur, _val); + + commState.keyDone = false; + + commState.readItems++; + } + } + + commState.readSize = -1; + commState.readItems = 0; + commState.cur = null; + + commState.idx++; + + case 10: + sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 11: + sesFullSup = commState.getBoolean("sesFullSup"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 12: + sesId = commState.getGridUuid("sesId"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 13: + siblingsBytes = commState.getByteArray("siblingsBytes"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 14: + startTaskTime = commState.getLong("startTaskTime"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 15: + subjId = commState.getUuid("subjId"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 16: + taskClsName = commState.getString("taskClsName"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 17: + taskName = commState.getString("taskName"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 18: + timeout = commState.getLong("timeout"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + case 19: + if (commState.readSize == -1) { + commState.readSize = commState.getInt(null); + + if (!commState.lastRead()) + return false; + } + + if (commState.readSize >= 0) { + if (top == null) + top = new ArrayList<>(commState.readSize); + + for (int i = commState.readItems; i < commState.readSize; i++) { + UUID _val = commState.getUuid(null); + + if (!commState.lastRead()) + return false; + + top.add((UUID)_val); + + commState.readItems++; + } + } + + commState.readSize = -1; + commState.readItems = 0; + + commState.idx++; + + case 20: + userVer = commState.getString("userVer"); + + if (!commState.lastRead()) + return false; + + commState.idx++; + + } return true; } -- 1.9.3 (Apple Git-50) From 5de977c64218fa076e7a4384391aced3dd9cf689 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 14:10:03 -0800 Subject: [PATCH 24/71] IGNITE-61 - Fixed collections processing --- .../codegen/CommunicationMessageCodeGenerator.java | 12 ++++++----- .../ignite/internal/GridJobExecuteRequest.java | 6 ++++-- .../managers/communication/GridIoUserMessage.java | 3 ++- .../deployment/GridDeploymentInfoBean.java | 3 ++- .../managers/deployment/GridDeploymentRequest.java | 3 ++- .../eventstorage/GridEventStorageMessage.java | 3 ++- .../cache/GridCacheEvictionResponse.java | 3 ++- .../distributed/GridCacheTtlUpdateRequest.java | 12 +++++++---- .../distributed/GridDistributedBaseMessage.java | 6 ++++-- .../distributed/GridDistributedLockRequest.java | 6 ++++-- .../distributed/GridDistributedLockResponse.java | 3 ++- .../GridDistributedTxFinishRequest.java | 6 ++++-- .../GridDistributedTxPrepareRequest.java | 6 ++++-- .../distributed/GridDistributedUnlockRequest.java | 3 ++- .../cache/distributed/dht/GridDhtLockRequest.java | 3 ++- .../cache/distributed/dht/GridDhtLockResponse.java | 9 +++++--- .../distributed/dht/GridDhtTxFinishRequest.java | 6 ++++-- .../distributed/dht/GridDhtTxPrepareRequest.java | 3 ++- .../distributed/dht/GridDhtTxPrepareResponse.java | 9 +++++--- .../distributed/dht/GridDhtUnlockRequest.java | 3 ++- .../GridDhtAtomicDeferredUpdateResponse.java | 3 ++- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 24 ++++++++++++++-------- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 3 ++- .../dht/atomic/GridNearAtomicUpdateRequest.java | 15 +++++++++----- .../dht/atomic/GridNearAtomicUpdateResponse.java | 9 +++++--- .../dht/preloader/GridDhtForceKeysRequest.java | 3 ++- .../dht/preloader/GridDhtForceKeysResponse.java | 3 ++- .../preloader/GridDhtPartitionDemandMessage.java | 3 ++- .../preloader/GridDhtPartitionSupplyMessage.java | 6 ++++-- .../cache/distributed/near/GridNearGetRequest.java | 6 ++++-- .../distributed/near/GridNearGetResponse.java | 3 ++- .../distributed/near/GridNearLockRequest.java | 6 ++++-- .../distributed/near/GridNearLockResponse.java | 9 +++++--- .../distributed/near/GridNearTxPrepareRequest.java | 3 ++- .../near/GridNearTxPrepareResponse.java | 9 +++++--- .../cache/query/GridCacheQueryResponse.java | 6 ++++-- .../clock/GridClockDeltaSnapshotMessage.java | 3 ++- .../processors/dataload/GridDataLoadRequest.java | 3 ++- .../processors/fs/GridGgfsBlocksMessage.java | 3 ++- .../processors/fs/GridGgfsFragmentizerRequest.java | 3 ++- .../streamer/GridStreamerExecutionRequest.java | 3 ++- 41 files changed, 155 insertions(+), 79 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index c833c70..decac32 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -129,9 +129,7 @@ public class CommunicationMessageCodeGenerator { CommunicationMessageCodeGenerator gen = new CommunicationMessageCodeGenerator(); try { - gen.generateAndWrite(GridJobExecuteRequest.class); - - //gen.generateAll(true); + gen.generateAll(true); } catch (Exception e) { e.printStackTrace(); @@ -844,7 +842,9 @@ public class CommunicationMessageCodeGenerator { indent++; - returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + returnFalseIfReadFailed(int.class, null, null, null, null, true); + + read.add(builder().a(READ_SIZE_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); indent--; @@ -911,7 +911,9 @@ public class CommunicationMessageCodeGenerator { indent++; - returnFalseIfReadFailed(int.class, READ_SIZE_VAR, null, null, null, true); + returnFalseIfReadFailed(int.class, null, null, null, null, true); + + read.add(builder().a(READ_SIZE_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); indent--; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index aac47f9..968c3b5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -732,10 +732,11 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im case 9: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -846,10 +847,11 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im case 19: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java index 81ceddf..0889d6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java @@ -362,10 +362,11 @@ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter { case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java index 325d0b1..23e92d8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java @@ -272,10 +272,11 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i case 3: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java index 62bbcf3..2a8b6dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java @@ -270,10 +270,11 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { case 2: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java index 904a5fa..c8c1dad 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java @@ -450,10 +450,11 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java index 1ff9225..8bf52d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java @@ -237,10 +237,11 @@ public class GridCacheEvictionResponse extends GridCacheMessage { case 5: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java index 5c60c0c..d860411 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java @@ -343,10 +343,11 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { switch (commState.idx) { case 3: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -372,10 +373,11 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -401,10 +403,11 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 5: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -446,10 +449,11 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { case 8: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java index 5597a4a..812ed18 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -375,10 +375,11 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< case 5: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -404,10 +405,11 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index 2f1297a..c4081c9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -634,10 +634,11 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage switch (commState.idx) { case 8: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -713,10 +714,11 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage case 15: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java index 26510a4..1c77615 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java @@ -387,10 +387,11 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag case 10: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java index dd4d890..15d61a3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -578,10 +578,11 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes case 14: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -647,10 +648,11 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes case 20: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 39dcf00..4282497 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 @@ -657,10 +657,11 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe case 15: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -726,10 +727,11 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe case 21: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java index 45b44cc..fc5cce2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -194,10 +194,11 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa switch (commState.idx) { case 8: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java index 72e8c3c..7b404f5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java @@ -503,10 +503,11 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { case 27: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index 4bbd9b3..4894af0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -342,10 +342,11 @@ public class GridDhtLockResponse extends GridDistributedLockResponse switch (commState.idx) { case 11: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -379,10 +380,11 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 13: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -408,10 +410,11 @@ public class GridDhtLockResponse extends GridDistributedLockResponse case 14: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 1ac4fc9..25ad224 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -567,10 +567,11 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 25: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -604,10 +605,11 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest case 27: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 396bd60..7e7ef66 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 @@ -511,10 +511,11 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque case 27: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index e25ff6c..7ce598a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -363,10 +363,11 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 11: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -400,10 +401,11 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 13: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -429,10 +431,11 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp case 14: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 91df862..189cfaf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -182,10 +182,11 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java index 69daf3b..92efaab 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java @@ -150,10 +150,11 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< switch (commState.idx) { case 3: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index f55a8de..709b681 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -1060,10 +1060,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1097,10 +1098,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1126,10 +1128,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 7: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1205,10 +1208,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 14: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1242,10 +1246,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 16: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1271,10 +1276,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 17: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1300,10 +1306,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 18: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1337,10 +1344,11 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp case 20: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 5fc3ef7..1747f2f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -304,10 +304,11 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 431744f..050cb35 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -854,10 +854,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 5: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -899,10 +900,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 8: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -944,10 +946,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 11: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -973,10 +976,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 12: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -1046,10 +1050,11 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im case 18: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 2d8f00b..2280943 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -673,10 +673,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 10: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -702,10 +703,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 11: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -731,10 +733,11 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i case 12: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 6582b17..176086e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -269,10 +269,11 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index 9dc4f25..dfe30f7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -289,10 +289,11 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index 6931543..130aca9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -303,10 +303,11 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage switch (commState.idx) { case 3: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 d7e785f..aa48d89 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 @@ -425,10 +425,11 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage case 5: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -454,10 +455,11 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 d47af02..54315c0 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 @@ -439,10 +439,11 @@ public class GridNearGetRequest extends GridCacheMessage implements case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -476,10 +477,11 @@ public class GridNearGetRequest extends GridCacheMessage implements case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 1079611..d712db7 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 @@ -345,10 +345,11 @@ public class GridNearGetResponse extends GridCacheMessage implements case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 6436cc9..8d20405 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 @@ -518,10 +518,11 @@ public class GridNearLockRequest extends GridDistributedLockRequest case 25: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -547,10 +548,11 @@ public class GridNearLockRequest extends GridDistributedLockRequest case 26: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 a321087..2343255 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 @@ -328,10 +328,11 @@ public class GridNearLockResponse extends GridDistributedLockResponse= 0) { @@ -365,10 +366,11 @@ public class GridNearLockResponse extends GridDistributedLockResponse= 0) { @@ -402,10 +404,11 @@ public class GridNearLockResponse extends GridDistributedLockResponse= 0) { 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 5026ea5..9c6135a 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 @@ -360,10 +360,11 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ case 24: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 7d90557..9a5d0fb 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 @@ -395,10 +395,11 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 12: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -432,10 +433,11 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 14: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -461,10 +463,11 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes case 15: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 9738d60..96d0258 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 @@ -338,10 +338,11 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme switch (commState.idx) { case 3: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { @@ -391,10 +392,11 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme case 7: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { 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 7874a4c..a779c23 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 @@ -159,10 +159,11 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd switch (commState.idx) { case 0: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java index 6cd775d..bc02118 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java @@ -406,10 +406,11 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { case 6: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java index 85ec73d..92dcad1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java @@ -186,10 +186,11 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { switch (commState.idx) { case 0: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java index 55b6b74..ec89347 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java @@ -171,10 +171,11 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { case 1: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java index 203c5be..1495000 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java @@ -306,10 +306,11 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda case 4: if (commState.readSize == -1) { - commState.readSize = commState.getInt(null); + int _val = commState.getInt(null); if (!commState.lastRead()) return false; + commState.readSize = _val; } if (commState.readSize >= 0) { -- 1.9.3 (Apple Git-50) From 1e868face9af143d87283793a78a29ff6e054bf6 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 16:51:50 -0800 Subject: [PATCH 25/71] # IGNITE-61 - Direct marshalling --- .../GridClientConnectionManagerAdapter.java | 6 +- .../message/GridClientHandshakeRequestWrapper.java | 2 +- .../GridClientHandshakeResponseWrapper.java | 22 +----- .../client/message/GridClientMessageWrapper.java | 25 +++--- .../message/GridClientPingPacketWrapper.java | 17 +--- .../protocols/tcp/GridMemcachedMessageWrapper.java | 17 +--- .../protocols/tcp/GridTcpRestDirectParser.java | 9 +++ .../direct/GridTcpCommunicationMessageAdapter.java | 91 ---------------------- .../direct/GridTcpCommunicationMessageState.java | 2 - .../ignite/spi/communication/GridTestMessage.java | 4 +- 10 files changed, 34 insertions(+), 161 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java index c09be9a..e87d7e2 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.nio.ssl.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import javax.net.ssl.*; @@ -670,8 +671,11 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio if (msg == null && buf.hasRemaining()) { byte type = buf.get(); - if (type == GridClientMessageWrapper.REQ_HEADER) + if (type == GridClientMessageWrapper.REQ_HEADER) { msg = new GridClientMessageWrapper(); + + msg.setReader(new GridTcpCommunicationMessageReader(null)); + } else throw new IOException("Invalid message type: " + type); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index e0dd381..1c0366a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -100,7 +100,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa /** {@inheritDoc} */ @Override public byte directType() { - return 72; + return HANDSHAKE_HEADER; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index 00ebc5f..8bb10a3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -57,15 +57,6 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess commState.typeWritten = true; } - switch (commState.idx) { - case 0: - if (!commState.putByte("code", code)) - return false; - - commState.idx++; - - } - return true; } @@ -73,23 +64,12 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess @Override public boolean readFrom(ByteBuffer buf) { commState.setBuffer(buf); - switch (commState.idx) { - case 0: - code = commState.getByte("code"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - } - return true; } /** {@inheritDoc} */ @Override public byte directType() { - return 73; + return code; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java index 04edfc7..4ba6a4f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java @@ -141,31 +141,31 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - if (!commState.putUuid("clientId", clientId)) + if (!commState.putInt("msgSize", msgSize)) return false; commState.idx++; case 1: - if (!commState.putUuid("destId", destId)) + if (!commState.putLong("reqId", reqId)) return false; commState.idx++; case 2: - if (!commState.putByteBuffer("msg", msg)) + if (!commState.putUuid("clientId", clientId)) return false; commState.idx++; case 3: - if (!commState.putInt("msgSize", msgSize)) + if (!commState.putUuid("destId", destId)) return false; commState.idx++; case 4: - if (!commState.putLong("reqId", reqId)) + if (!commState.putByteBuffer("msg", msg)) return false; commState.idx++; @@ -181,7 +181,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter switch (commState.idx) { case 0: - clientId = commState.getUuid("clientId"); + msgSize = commState.getInt("msgSize"); if (!commState.lastRead()) return false; @@ -189,7 +189,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 1: - destId = commState.getUuid("destId"); + reqId = commState.getLong("reqId"); if (!commState.lastRead()) return false; @@ -197,7 +197,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 2: - msg = commState.getByteBuffer("msg"); + clientId = commState.getUuid("clientId"); if (!commState.lastRead()) return false; @@ -205,7 +205,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 3: - msgSize = commState.getInt("msgSize"); + destId = commState.getUuid("destId"); if (!commState.lastRead()) return false; @@ -213,13 +213,12 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter commState.idx++; case 4: - reqId = commState.getLong("reqId"); + msg = commState.getByteBuffer("msg"); if (!commState.lastRead()) return false; commState.idx++; - } return true; @@ -227,7 +226,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @Override public byte directType() { - return 74; + return REQ_HEADER; } /** {@inheritDoc} */ @@ -244,8 +243,8 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { GridClientMessageWrapper _clone = (GridClientMessageWrapper)_msg; - _clone.msgSize = msgSize; _clone.reqId = reqId; + _clone.msgSize = msgSize; _clone.clientId = clientId; _clone.destId = destId; _clone.msg = msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java index 9e42be0..6591bd1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -57,25 +57,12 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); - - switch (commState.idx) { - case 0: - size = commState.getInt("size"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - } - - return true; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @Override public byte directType() { - return 75; + return GridClientMessageWrapper.REQ_HEADER; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 6223e5e..e258375 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -86,25 +86,12 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); - - switch (commState.idx) { - case 0: - bytes = commState.getByteArray("bytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - } - - return true; + throw new UnsupportedOperationException(); } /** {@inheritDoc} */ @Override public byte directType() { - return 78; + return MEMCACHE_RES_FLAG; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java index 7a95fb2..1fc7a0d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java @@ -23,6 +23,8 @@ import org.apache.ignite.internal.processors.rest.client.message.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; +import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import java.io.*; @@ -43,6 +45,9 @@ public class GridTcpRestDirectParser implements GridNioParser { /** Message metadata key. */ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); + /** Message reader. */ + private final MessageReader rdr = new GridTcpCommunicationMessageReader(null); + /** Protocol handler. */ private final GridTcpRestProtocol proto; @@ -78,11 +83,15 @@ public class GridTcpRestDirectParser implements GridNioParser { buf.get(); msg = new GridClientMessageWrapper(); + + msg.setReader(rdr); } else if (type == GridClientHandshakeRequestWrapper.HANDSHAKE_HEADER) { buf.get(); msg = new GridClientHandshakeRequestWrapper(); + + msg.setReader(rdr); } else if (type == MEMCACHE_REQ_FLAG) { state = new ParserState(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java index 3580cb7..e414f55 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java @@ -17,20 +17,12 @@ package org.apache.ignite.internal.util.direct; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; import java.util.*; -import static org.apache.ignite.events.IgniteEventType.*; - /** * Communication message adapter. */ @@ -39,89 +31,6 @@ public abstract class GridTcpCommunicationMessageAdapter implements Serializable private static final long serialVersionUID = 0L; /** */ - public static final byte[] BYTE_ARR_NOT_READ = new byte[0]; - - /** */ - public static final short[] SHORT_ARR_NOT_READ = new short[0]; - - /** */ - public static final int[] INT_ARR_NOT_READ = new int[0]; - - /** */ - public static final long[] LONG_ARR_NOT_READ = new long[0]; - - /** */ - public static final float[] FLOAT_ARR_NOT_READ = new float[0]; - - /** */ - public static final double[] DOUBLE_ARR_NOT_READ = new double[0]; - - /** */ - public static final char[] CHAR_ARR_NOT_READ = new char[0]; - - /** */ - public static final boolean[] BOOLEAN_ARR_NOT_READ = new boolean[0]; - - /** */ - public static final UUID UUID_NOT_READ = new UUID(0, 0); - - /** */ - public static final ByteBuffer BYTE_BUF_NOT_READ = ByteBuffer.allocate(0); - - /** */ - public static final IgniteUuid GRID_UUID_NOT_READ = new IgniteUuid(new UUID(0, 0), 0); - - /** */ - public static final GridClockDeltaVersion CLOCK_DELTA_VER_NOT_READ = new GridClockDeltaVersion(0, 0); - - /** */ - public static final GridByteArrayList BYTE_ARR_LIST_NOT_READ = new GridByteArrayList(new byte[0]); - - /** */ - public static final GridLongList LONG_LIST_NOT_READ = new GridLongList(0); - - /** */ - public static final GridCacheVersion CACHE_VER_NOT_READ = new GridCacheVersion(0, 0, 0, 0); - - /** */ - public static final GridDhtPartitionExchangeId DHT_PART_EXCHANGE_ID_NOT_READ = - new GridDhtPartitionExchangeId(new UUID(0, 0), EVT_NODE_LEFT, 1); - - /** */ - public static final GridCacheValueBytes VAL_BYTES_NOT_READ = new GridCacheValueBytes(); - - /** */ - @SuppressWarnings("RedundantStringConstructorCall") - public static final String STR_NOT_READ = new String(); - - /** */ - public static final BitSet BIT_SET_NOT_READ = new BitSet(); - - /** */ - public static final GridTcpCommunicationMessageAdapter MSG_NOT_READ = new GridTcpCommunicationMessageAdapter() { - @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { - throw new UnsupportedOperationException(); - } - - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { - throw new UnsupportedOperationException(); - } - - @Override public boolean writeTo(ByteBuffer buf) { - throw new UnsupportedOperationException(); - } - - @Override public boolean readFrom(ByteBuffer buf) { - throw new UnsupportedOperationException(); - } - - @Override public byte directType() { - throw new UnsupportedOperationException(); - } - }; - - /** */ protected static final Object NULL = new Object(); /** */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java index f0ac50e..66a8394 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java @@ -381,8 +381,6 @@ public class GridTcpCommunicationMessageState { if (buf != null) { ByteBuffer buf0 = buf.duplicate(); - buf0.flip(); - arr = new byte[buf0.remaining()]; buf0.get(arr); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index 945cb13..f36fa58 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -163,7 +163,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { case 0: srcNodeId = commState.getUuid(null); - if (srcNodeId == UUID_NOT_READ) + if (!commState.lastRead()) return false; commState.idx++; @@ -187,7 +187,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { case 3: payload = commState.getByteArray(null); - if (payload == BYTE_ARR_NOT_READ) + if (!commState.lastRead()) return false; commState.idx++; -- 1.9.3 (Apple Git-50) From 888e8ed2a380ed8d5dbc71d7b28c0bba866c5be3 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 17:10:37 -0800 Subject: [PATCH 26/71] # IGNITE-61 - Direct marshalling --- .../java/org/apache/ignite/testframework/GridSpiTestContext.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index 69cd4e0..fadd59e 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -29,6 +29,7 @@ import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.swapspace.*; +import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import java.io.*; @@ -519,7 +520,11 @@ public class GridSpiTestContext implements IgniteSpiContext { @Override public GridTcpMessageFactory messageFactory() { return new GridTcpMessageFactory() { @Override public GridTcpCommunicationMessageAdapter create(byte type) { - return GridTcpCommunicationMessageFactory.create(type); + GridTcpCommunicationMessageAdapter msg = GridTcpCommunicationMessageFactory.create(type); + + msg.setReader(new GridTcpCommunicationMessageReader(null)); + + return msg; } }; } -- 1.9.3 (Apple Git-50) From 9c0255beac1a2fe1787c0c3ba8ab38e6af471b3b Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 19:25:09 -0800 Subject: [PATCH 27/71] IGNITE-61 - Direct marshalling --- .../grid/util/direct/GridTcpCommunicationByteBufferStream.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index 379cc46..0ffefb4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -205,7 +205,7 @@ public class GridTcpCommunicationByteBufferStream { private long baseOff; /** */ - private int arrOff; + private int arrOff = -1; /** */ private Object tmpArr; @@ -572,11 +572,13 @@ public class GridTcpCommunicationByteBufferStream { assert bytes >= 0; assert bytes >= arrOff; - if (arrOff == 0) { + if (arrOff == -1) { if (remaining() < 4) return false; writeInt(len); + + arrOff = 0; } int toWrite = bytes - arrOff; @@ -590,7 +592,7 @@ public class GridTcpCommunicationByteBufferStream { buf.position(pos); - arrOff = 0; + arrOff = -1; return true; } @@ -623,7 +625,7 @@ public class GridTcpCommunicationByteBufferStream { return null; } - int len = readInt(); + int len = readInt(); switch (len) { case -1: -- 1.9.3 (Apple Git-50) From 52b140b5659ec315e3a4d485fa77468daf5108be Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 20:06:28 -0800 Subject: [PATCH 28/71] IGNITE-61 - Direct marshalling --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 25d64e8..7b22616 100644 --- a/pom.xml +++ b/pom.xml @@ -826,7 +826,7 @@ http://hadoop.apache.org/docs/current/api/ assembly/docfiles/javadoc.css - com.*:org.jetbrains.*:org.pcollections:*.jdk8:*.tests:*.tools:*.typedef:*.examples:*.client:*.kernal:*.internal:*.util:*.dr:*.compute.gridify.aop:*.spi.authentication:*.spi.securesession:*.spi.discovery.tcp.messages:*.spi.discovery.tcp.internal:*.spi.deployment.uri.scanners:*.spi.deployment.uri.tasks:*.spi.indexing.h2.opt:org.apache.ignite.portables:org.apache.ignite.yardstick:org.apache.ignite.schema.* + com.*:org.jetbrains.*:org.pcollections:*.jdk8:*.tests:*.tools:*.typedef:*.examples:*.client:*.kernal:*.internal:*.util:*.dr:*.compute.gridify.aop:*.spi.authentication:*.spi.securesession:*.spi.discovery.tcp.messages:*.spi.discovery.tcp.internal:*.spi.deployment.uri.scanners:*.spi.deployment.uri.tasks:*.spi.indexing.h2.opt:org.apache.ignite.portables:org.apache.ignite.yardstick:org.apache.ignite.schema.*:org.apache.ignite.codegen Common Grid APIs -- 1.9.3 (Apple Git-50) From f125cfb404be35175acd06ba91a87d8a386051d1 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Thu, 5 Feb 2015 22:18:57 -0800 Subject: [PATCH 29/71] # IGNITE-61 - Direct marshalling --- .../protocols/tcp/GridMemcachedMessageWrapper.java | 21 ++++++++-------- .../GridTcpCommunicationByteBufferStream.java | 29 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index e258375..906efa2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -22,6 +22,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.marshaller.*; +import org.gridgain.grid.util.direct.*; import java.io.*; import java.nio.*; @@ -40,6 +41,9 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** UTF-8 charset. */ private static final Charset UTF_8 = Charset.forName("UTF-8"); + /** Stream. */ + private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + /** * Memcached message bytes. */ @@ -63,25 +67,20 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + stream.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!buf.hasRemaining()) return false; + stream.writeByte(directType()); + commState.typeWritten = true; } - switch (commState.idx) { - case 0: - if (!commState.putByteArray("bytes", bytes)) - return false; - - commState.idx++; - - } + stream.writeByteArrayNoLength(bytes); - return true; + return stream.lastFinished(); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index 0ffefb4..ea4a36f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -273,6 +273,15 @@ public class GridTcpCommunicationByteBufferStream { lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length); } + /** + * @param val Array. + */ + public void writeByteArrayNoLength(byte[] val) { + assert val != null; + + lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length, true); + } + /** {@inheritDoc} */ public void writeBoolean(boolean val) { int pos = buf.position(); @@ -565,6 +574,18 @@ public class GridTcpCommunicationByteBufferStream { * @return Whether array was fully written */ private boolean writeArray(Object arr, long off, int len, int bytes) { + return writeArray(arr, off, len, bytes, false); + } + + /** + * @param arr Array. + * @param off Offset. + * @param len Length. + * @param bytes Length in bytes. + * @param skipLen {@code true} if length should not be written. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int len, int bytes, boolean skipLen) { assert arr != null; assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); assert off > 0; @@ -573,10 +594,12 @@ public class GridTcpCommunicationByteBufferStream { assert bytes >= arrOff; if (arrOff == -1) { - if (remaining() < 4) - return false; + if (!skipLen) { + if (remaining() < 4) + return false; - writeInt(len); + writeInt(len); + } arrOff = 0; } -- 1.9.3 (Apple Git-50) From b8e35888876125c8ffeda7428ffe2da09fa3c8bd Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 6 Feb 2015 14:11:54 -0800 Subject: [PATCH 30/71] IGNITE-61 - Client fixes --- .../codegen/CommunicationMessageCodeGenerator.java | 2 +- .../message/GridClientHandshakeRequestWrapper.java | 36 +++++------- .../GridClientHandshakeResponseWrapper.java | 2 - .../client/message/GridClientMessageWrapper.java | 64 ++++++++++++++-------- .../protocols/tcp/GridMemcachedMessageWrapper.java | 2 +- .../ignite/internal/util/GridClientByteUtils.java | 3 +- .../GridTcpCommunicationByteBufferStream.java | 35 +++++++++--- 7 files changed, 85 insertions(+), 59 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index decac32..b861806 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -60,7 +60,7 @@ public class CommunicationMessageCodeGenerator { }; /** */ - private static final String SRC_DIR = U.getGridGainHome() + "/modules/core/src/main/java"; + private static final String SRC_DIR = U.getIgniteHome() + "/modules/core/src/main/java"; /** */ private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index 1c0366a..b7b986f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.rest.client.message; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.gridgain.grid.util.direct.*; import java.nio.*; @@ -32,6 +33,9 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa /** Signal char. */ public static final byte HANDSHAKE_HEADER = (byte)0x91; + /** Stream. */ + private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + /** Handshake bytes. */ private byte[] bytes; @@ -59,43 +63,29 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + stream.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!buf.hasRemaining()) return false; + stream.writeByte(directType()); + commState.typeWritten = true; } - switch (commState.idx) { - case 0: - if (!commState.putByteArray("bytes", bytes)) - return false; - - commState.idx++; - - } + stream.writeByteArray(bytes, 0, bytes.length); - return true; + return stream.lastFinished(); } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + stream.setBuffer(buf); - switch (commState.idx) { - case 0: - bytes = commState.getByteArray("bytes"); - - if (!commState.lastRead()) - return false; - - commState.idx++; - - } + bytes = stream.readByteArray(GridClientHandshakeRequest.PACKET_SIZE); - return true; + return stream.lastFinished(); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index 8bb10a3..7ce67b4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -62,8 +62,6 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); - return true; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java index 4ba6a4f..fe32468 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.rest.client.message; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.gridgain.grid.util.direct.*; import java.nio.*; import java.util.*; @@ -33,6 +34,9 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** Client request header. */ public static final byte REQ_HEADER = (byte)0x90; + /** Stream. */ + private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + /** */ private int msgSize; @@ -130,43 +134,52 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + stream.setBuffer(buf); if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (stream.remaining() < 1) return false; + stream.writeByte(directType()); + commState.typeWritten = true; } switch (commState.idx) { case 0: - if (!commState.putInt("msgSize", msgSize)) + if (stream.remaining() < 4) return false; + stream.writeInt(msgSize); + commState.idx++; case 1: - if (!commState.putLong("reqId", reqId)) + if (stream.remaining() < 8) return false; + stream.writeLong(reqId); + commState.idx++; case 2: - if (!commState.putUuid("clientId", clientId)) + if (stream.remaining() < 16) return false; + stream.writeByteArray(U.uuidToBytes(clientId), 0, 16); + commState.idx++; case 3: - if (!commState.putUuid("destId", destId)) + if (stream.remaining() < 16) return false; + stream.writeByteArray(U.uuidToBytes(destId), 0, 16); + commState.idx++; case 4: - if (!commState.putByteBuffer("msg", msg)) - return false; + stream.writeByteArray(msg.array(), msg.position(), msg.remaining()); commState.idx++; @@ -177,47 +190,52 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + stream.setBuffer(buf); switch (commState.idx) { case 0: - msgSize = commState.getInt("msgSize"); - - if (!commState.lastRead()) + if (stream.remaining() < 4) return false; + msgSize = stream.readInt(); + + if (msgSize == 0) // Ping message. + return true; + commState.idx++; case 1: - reqId = commState.getLong("reqId"); - - if (!commState.lastRead()) + if (stream.remaining() < 8) return false; + reqId = stream.readLong(); + commState.idx++; case 2: - clientId = commState.getUuid("clientId"); - - if (!commState.lastRead()) + if (stream.remaining() < 16) return false; + clientId = U.bytesToUuid(stream.readByteArray(16), 0); + commState.idx++; case 3: - destId = commState.getUuid("destId"); - - if (!commState.lastRead()) + if (stream.remaining() < 16) return false; + destId = U.bytesToUuid(stream.readByteArray(16), 0); + commState.idx++; case 4: - msg = commState.getByteBuffer("msg"); + byte[] msg0 = stream.readByteArray(msgSize); - if (!commState.lastRead()) + if (!stream.lastFinished()) return false; + msg = ByteBuffer.wrap(msg0); + commState.idx++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 906efa2..7d93503 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -78,7 +78,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap commState.typeWritten = true; } - stream.writeByteArrayNoLength(bytes); + stream.writeByteArray(bytes, 0, bytes.length); return stream.lastFinished(); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridClientByteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridClientByteUtils.java index f15e13b..1c7cbd9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridClientByteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridClientByteUtils.java @@ -106,7 +106,7 @@ public abstract class GridClientByteUtils { * @return Encoded into byte array {@link UUID}. */ public static byte[] uuidToBytes(UUID uuid) { - byte[] bytes = new byte[(Long.SIZE >> 3)* 2]; + byte[] bytes = new byte[(Long.SIZE >> 3) * 2]; uuidToBytes(uuid, bytes, 0); @@ -122,7 +122,6 @@ public abstract class GridClientByteUtils { * @return Number of bytes overwritten in {@code bytes} array. */ public static int uuidToBytes(UUID uuid, byte[] bytes, int off) { - ByteBuffer buf = ByteBuffer.wrap(bytes, off, 16); buf.order(ByteOrder.BIG_ENDIAN); diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java index ea4a36f..76b6eb7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java @@ -276,10 +276,10 @@ public class GridTcpCommunicationByteBufferStream { /** * @param val Array. */ - public void writeByteArrayNoLength(byte[] val) { + public void writeByteArray(byte[] val, int off, int len) { assert val != null; - lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length, true); + lastFinished = writeArray(val, BYTE_ARR_OFF + off, len, len, true); } /** {@inheritDoc} */ @@ -419,6 +419,14 @@ public class GridTcpCommunicationByteBufferStream { return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF); } + /** + * @param len Length. + * @return Array. + */ + public byte[] readByteArray(int len) { + return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF, len); + } + /** {@inheritDoc} */ public boolean readBoolean() { assert buf.hasRemaining(); @@ -639,16 +647,29 @@ public class GridTcpCommunicationByteBufferStream { * @return Array or special value if it was not fully read. */ private T readArray(ArrayCreator creator, int lenShift, long off) { + return readArray(creator, lenShift, off, -1); + } + + /** + * @param creator Array creator. + * @param lenShift Array length shift size. + * @param off Base offset. + * @param len Length. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int lenShift, long off, int len) { assert creator != null; if (tmpArr == null) { - if (remaining() < 4) { - lastFinished = false; + if (len == -1) { + if (remaining() < 4) { + lastFinished = false; - return null; - } + return null; + } - int len = readInt(); + len = readInt(); + } switch (len) { case -1: -- 1.9.3 (Apple Git-50) From 08643445b3859e679be51e792cc3bac78747e6c9 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 6 Feb 2015 14:48:28 -0800 Subject: [PATCH 31/71] IGNITE-61 - Client fixes --- .../org/apache/ignite/internal/processors/rest/TestBinaryClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java index 0103622..21e5f8c 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java @@ -274,6 +274,8 @@ final class TestBinaryClient { ByteBuffer slice = res.slice(); + slice.order(ByteOrder.LITTLE_ENDIAN); + slice.put((byte)0x90); slice.putInt(res.remaining() - 5); slice.putLong(msg.requestId()); -- 1.9.3 (Apple Git-50) From 415902ea2cdfd76623b2e345e545a217e4eca352 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Fri, 6 Feb 2015 22:12:44 -0800 Subject: [PATCH 32/71] IGNITE-61 - Direct marshalling --- .../ClientAbstractMultiNodeSelfTest.java | 4 +- .../codegen/CommunicationMessageCodeGenerator.java | 32 +- .../GridClientConnectionManagerAdapter.java | 8 +- .../ignite/internal/GridJobCancelRequest.java | 8 +- .../ignite/internal/GridJobExecuteRequest.java | 8 +- .../ignite/internal/GridJobExecuteResponse.java | 8 +- .../ignite/internal/GridJobSiblingsRequest.java | 8 +- .../ignite/internal/GridJobSiblingsResponse.java | 8 +- .../apache/ignite/internal/GridPluginContext.java | 2 +- .../ignite/internal/GridTaskCancelRequest.java | 8 +- .../ignite/internal/GridTaskSessionRequest.java | 8 +- .../internal/direct/DirectByteBufferStream.java | 1009 ++++++++++++++++++++ .../internal/direct/DirectMessageReader.java | 223 +++++ .../internal/direct/DirectMessageWriter.java | 173 ++++ .../apache/ignite/internal/direct/DirectUtils.java | 346 +++++++ .../direct/GridTcpCommunicationMessageFactory.java | 376 ++++++++ .../GridTcpCommunicationMessageProducer.java | 33 + .../direct/GridTcpCommunicationMessageState.java | 726 ++++++++++++++ .../internal/direct/GridTcpMessageFactory.java | 31 + .../internal/managers/GridManagerAdapter.java | 7 +- .../managers/checkpoint/GridCheckpointRequest.java | 8 +- .../managers/communication/GridIoManager.java | 37 +- .../managers/communication/GridIoMessage.java | 16 +- .../managers/communication/GridIoUserMessage.java | 8 +- .../deployment/GridDeploymentCommunication.java | 6 +- .../deployment/GridDeploymentInfoBean.java | 8 +- .../managers/deployment/GridDeploymentRequest.java | 8 +- .../deployment/GridDeploymentResponse.java | 8 +- .../eventstorage/GridEventStorageMessage.java | 8 +- .../processors/cache/GridCacheEvictionRequest.java | 6 +- .../cache/GridCacheEvictionResponse.java | 6 +- .../processors/cache/GridCacheMessage.java | 6 +- .../processors/cache/GridCacheValueBytes.java | 30 +- .../GridCacheOptimisticCheckPreparedTxRequest.java | 6 +- ...GridCacheOptimisticCheckPreparedTxResponse.java | 6 +- ...ridCachePessimisticCheckCommittedTxRequest.java | 6 +- ...idCachePessimisticCheckCommittedTxResponse.java | 6 +- .../distributed/GridCacheTtlUpdateRequest.java | 6 +- .../distributed/GridDistributedBaseMessage.java | 4 +- .../distributed/GridDistributedLockRequest.java | 6 +- .../distributed/GridDistributedLockResponse.java | 6 +- .../GridDistributedTxFinishRequest.java | 6 +- .../GridDistributedTxFinishResponse.java | 6 +- .../GridDistributedTxPrepareRequest.java | 6 +- .../GridDistributedTxPrepareResponse.java | 6 +- .../distributed/GridDistributedUnlockRequest.java | 6 +- .../dht/GridDhtAffinityAssignmentRequest.java | 6 +- .../dht/GridDhtAffinityAssignmentResponse.java | 6 +- .../cache/distributed/dht/GridDhtLockRequest.java | 6 +- .../cache/distributed/dht/GridDhtLockResponse.java | 6 +- .../distributed/dht/GridDhtTxFinishRequest.java | 6 +- .../distributed/dht/GridDhtTxFinishResponse.java | 6 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 6 +- .../distributed/dht/GridDhtTxPrepareResponse.java | 6 +- .../distributed/dht/GridDhtUnlockRequest.java | 6 +- .../GridDhtAtomicDeferredUpdateResponse.java | 6 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 6 +- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 6 +- .../dht/atomic/GridNearAtomicUpdateRequest.java | 6 +- .../dht/atomic/GridNearAtomicUpdateResponse.java | 6 +- .../dht/preloader/GridDhtForceKeysRequest.java | 6 +- .../dht/preloader/GridDhtForceKeysResponse.java | 6 +- .../preloader/GridDhtPartitionDemandMessage.java | 6 +- .../dht/preloader/GridDhtPartitionExchangeId.java | 30 +- .../preloader/GridDhtPartitionSupplyMessage.java | 6 +- .../GridDhtPartitionsAbstractMessage.java | 4 +- .../preloader/GridDhtPartitionsFullMessage.java | 6 +- .../preloader/GridDhtPartitionsSingleMessage.java | 6 +- .../preloader/GridDhtPartitionsSingleRequest.java | 6 +- .../cache/distributed/near/GridNearGetRequest.java | 6 +- .../distributed/near/GridNearGetResponse.java | 6 +- .../distributed/near/GridNearLockRequest.java | 6 +- .../distributed/near/GridNearLockResponse.java | 6 +- .../distributed/near/GridNearTxFinishRequest.java | 6 +- .../distributed/near/GridNearTxFinishResponse.java | 6 +- .../distributed/near/GridNearTxPrepareRequest.java | 6 +- .../near/GridNearTxPrepareResponse.java | 6 +- .../distributed/near/GridNearUnlockRequest.java | 6 +- .../cache/query/GridCacheQueryRequest.java | 6 +- .../cache/query/GridCacheQueryResponse.java | 6 +- .../processors/cache/version/GridCacheVersion.java | 30 +- .../clock/GridClockDeltaSnapshotMessage.java | 8 +- .../processors/clock/GridClockDeltaVersion.java | 29 +- .../continuous/GridContinuousMessage.java | 8 +- .../processors/dataload/GridDataLoadRequest.java | 8 +- .../processors/dataload/GridDataLoadResponse.java | 8 +- .../internal/processors/fs/GridGgfsAckMessage.java | 6 +- .../internal/processors/fs/GridGgfsBlockKey.java | 8 +- .../processors/fs/GridGgfsBlocksMessage.java | 6 +- .../fs/GridGgfsCommunicationMessage.java | 6 +- .../processors/fs/GridGgfsDeleteMessage.java | 6 +- .../processors/fs/GridGgfsFileAffinityRange.java | 8 +- .../processors/fs/GridGgfsFragmentizerRequest.java | 6 +- .../fs/GridGgfsFragmentizerResponse.java | 6 +- .../processors/fs/GridGgfsSyncMessage.java | 6 +- .../internal/processors/fs/IgniteFsProcessor.java | 5 +- .../message/GridClientHandshakeRequestWrapper.java | 12 +- .../GridClientHandshakeResponseWrapper.java | 8 +- .../client/message/GridClientMessageWrapper.java | 12 +- .../message/GridClientPingPacketWrapper.java | 8 +- .../rest/handlers/task/GridTaskResultRequest.java | 8 +- .../rest/handlers/task/GridTaskResultResponse.java | 8 +- .../protocols/tcp/GridMemcachedMessageWrapper.java | 12 +- .../protocols/tcp/GridTcpRestDirectParser.java | 7 +- .../streamer/GridStreamerCancelRequest.java | 8 +- .../streamer/GridStreamerExecutionRequest.java | 8 +- .../processors/streamer/GridStreamerResponse.java | 8 +- .../processors/streamer/IgniteStreamerImpl.java | 6 +- .../processors/version/GridVersionConverter.java | 2 +- .../apache/ignite/internal/util/IgniteUtils.java | 12 +- .../direct/GridTcpCommunicationMessageAdapter.java | 116 --- .../direct/GridTcpCommunicationMessageFactory.java | 375 -------- .../GridTcpCommunicationMessageProducer.java | 31 - .../direct/GridTcpCommunicationMessageState.java | 774 --------------- .../util/direct/GridTcpMessageFactory.java | 29 - .../ignite/internal/util/ipc/IpcToNioAdapter.java | 6 +- .../internal/util/nio/GridCommunicationClient.java | 4 +- .../ignite/internal/util/nio/GridDirectParser.java | 5 +- .../internal/util/nio/GridNioMessageReader.java | 5 +- .../internal/util/nio/GridNioMessageWriter.java | 6 +- .../ignite/internal/util/nio/GridNioServer.java | 20 +- .../util/nio/GridShmemCommunicationClient.java | 4 +- .../util/nio/GridTcpCommunicationClient.java | 4 +- .../util/nio/GridTcpNioCommunicationClient.java | 4 +- .../org/apache/ignite/plugin/PluginContext.java | 2 +- .../extensions/communication/MessageAdapter.java | 130 +++ .../extensions/communication/MessageReader.java | 12 +- .../communication/MessageReaderFactory.java | 4 +- .../extensions/communication/MessageWriter.java | 12 +- .../communication/MessageWriterFactory.java | 4 +- .../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 2 +- .../collision/jobstealing/JobStealingRequest.java | 8 +- .../spi/communication/tcp/TcpCommunicationSpi.java | 60 +- .../GridTcpCommunicationByteBufferStream.java | 733 -------------- .../direct/GridTcpCommunicationMessageReader.java | 237 ----- .../direct/GridTcpCommunicationMessageWriter.java | 262 ----- .../internal/GridJobMasterLeaveAwareSelfTest.java | 6 +- .../GridCommunicationSendMessageSelfTest.java | 11 +- .../communication/GridIoManagerSelfTest.java | 10 +- .../GridDeploymentMessageCountSelfTest.java | 4 +- .../cache/GridCacheAtomicMessageCountSelfTest.java | 4 +- .../GridCacheReplicatedSynchronousCommitTest.java | 4 +- .../cache/IgniteTxReentryAbstractSelfTest.java | 4 +- .../GridCacheAtomicTimeoutSelfTest.java | 4 +- ...teTxOriginatingNodeFailureAbstractSelfTest.java | 4 +- ...sticOriginatingNodeFailureAbstractSelfTest.java | 4 +- .../dht/GridCacheDhtPreloadMessageCountTest.java | 4 +- ...acheAtomicInvalidPartitionHandlingSelfTest.java | 4 +- .../GridCacheReplicatedInvalidateSelfTest.java | 4 +- .../communication/GridIoManagerBenchmark0.java | 8 +- .../loadtests/communication/GridTestMessage.java | 8 +- .../GridAbstractCommunicationSelfTest.java | 23 +- .../ignite/spi/communication/GridTestMessage.java | 8 +- .../tcp/GridCacheDhtLockBackupSelfTest.java | 6 +- ...pCommunicationSpiConcurrentConnectSelfTest.java | 17 +- .../tcp/GridTcpCommunicationSpiLanTest.java | 6 +- ...idTcpCommunicationSpiMultithreadedSelfTest.java | 23 +- ...GridTcpCommunicationSpiRecoveryAckSelfTest.java | 11 +- .../GridTcpCommunicationSpiRecoverySelfTest.java | 11 +- .../ignite/testframework/GridSpiTestContext.java | 10 +- .../tcp/GridOrderedMessageCancelSelfTest.java | 4 +- 162 files changed, 3706 insertions(+), 3103 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageProducer.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpMessageFactory.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageProducer.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpMessageFactory.java create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java delete mode 100644 modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java diff --git a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractMultiNodeSelfTest.java index cfa0cc6..caa9d56 100644 --- a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractMultiNodeSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractMultiNodeSelfTest.java @@ -31,9 +31,9 @@ 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.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; @@ -761,7 +761,7 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract @SuppressWarnings("unchecked") private static class TestCommunicationSpi extends TcpCommunicationSpi { /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { checkSyncFlags((GridIoMessage)msg); diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index b861806..b43434f 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -15,9 +15,9 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; @@ -63,7 +63,7 @@ public class CommunicationMessageCodeGenerator { private static final String SRC_DIR = U.getIgniteHome() + "/modules/core/src/main/java"; /** */ - private static final Class BASE_CLS = GridTcpCommunicationMessageAdapter.class; + private static final Class BASE_CLS = MessageAdapter.class; /** */ private static final String EMPTY = ""; @@ -143,9 +143,9 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ public void generateAll(boolean write) throws Exception { - Collection> classes = classes(); + Collection> classes = classes(); - for (Class cls : classes) { + for (Class cls : classes) { boolean isAbstract = Modifier.isAbstract(cls.getModifiers()); System.out.println("Processing class: " + cls.getName() + (isAbstract ? " (abstract)" : "")); @@ -158,7 +158,7 @@ public class CommunicationMessageCodeGenerator { // type = 0; // -// for (Class cls : classes) { +// for (Class cls : classes) { // if (Modifier.isAbstract(cls.getModifiers())) // continue; // @@ -177,7 +177,7 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ @SuppressWarnings("ConstantConditions") - private void generateAndWrite(Class cls) throws Exception { + private void generateAndWrite(Class cls) throws Exception { assert cls != null; generate(cls); @@ -228,14 +228,14 @@ public class CommunicationMessageCodeGenerator { // // skip = true; // } - else if (line.contains("public GridTcpCommunicationMessageAdapter clone()")) { + else if (line.contains("public MessageAdapter clone()")) { src.addAll(clone); skip = true; cloneFound = true; } - else if (line.contains("protected void clone0(GridTcpCommunicationMessageAdapter _msg)")) { + else if (line.contains("protected void clone0(MessageAdapter _msg)")) { src.addAll(clone0); skip = true; @@ -287,7 +287,7 @@ public class CommunicationMessageCodeGenerator { * @param cls Class. * @throws Exception In case of error. */ - public void generate(Class cls) throws Exception { + public void generate(Class cls) throws Exception { assert cls != null; write.clear(); @@ -1065,11 +1065,11 @@ public class CommunicationMessageCodeGenerator { * @return Classes. * @throws Exception In case of error. */ - private Collection> classes() throws Exception { - Collection> col = new TreeSet<>( - new Comparator>() { - @Override public int compare(Class c1, - Class c2) { + private Collection> classes() throws Exception { + Collection> col = new TreeSet<>( + new Comparator>() { + @Override public int compare(Class c1, + Class c2) { return c1.getName().compareTo(c2.getName()); } }); @@ -1097,7 +1097,7 @@ public class CommunicationMessageCodeGenerator { * @throws Exception In case of error. */ private void processFile(File file, ClassLoader ldr, int prefixLen, - Collection> col) throws Exception { + Collection> col) throws Exception { assert file != null; assert ldr != null; assert prefixLen > 0; @@ -1122,7 +1122,7 @@ public class CommunicationMessageCodeGenerator { if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && !BASE_CLS.equals(cls) && BASE_CLS.isAssignableFrom(cls)) - col.add((Class)cls); + col.add((Class)cls); } } } diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java index 9a47c30..476d9c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -18,18 +18,18 @@ package org.apache.ignite.client.impl.connection; import org.apache.ignite.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.logger.java.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.client.*; import org.apache.ignite.client.impl.*; import org.apache.ignite.client.util.*; import org.apache.ignite.internal.processors.rest.client.message.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.nio.ssl.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import javax.net.ssl.*; @@ -666,7 +666,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio return new GridClientHandshakeResponse(code); } - GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY); + MessageAdapter msg = ses.removeMeta(MSG_META_KEY); if (msg == null && buf.hasRemaining()) { byte type = buf.get(); @@ -674,7 +674,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio if (type == GridClientMessageWrapper.REQ_HEADER) { msg = new GridClientMessageWrapper(); - msg.setReader(new GridTcpCommunicationMessageReader(null)); + msg.setReader(new DirectMessageReader(null)); } else throw new IOException("Invalid message type: " + type); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java index d5a27ab..d55e205 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; @@ -28,7 +28,7 @@ import java.nio.*; /** * Job cancellation request. */ -public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { +public class GridJobCancelRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -111,7 +111,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridJobCancelRequest _clone = new GridJobCancelRequest(); clone0(_clone); @@ -120,7 +120,7 @@ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridJobCancelRequest _clone = (GridJobCancelRequest)_msg; _clone.sesId = sesId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index c97ed55..cdc6dfa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -19,10 +19,10 @@ package org.apache.ignite.internal; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.io.*; @@ -32,7 +32,7 @@ import java.util.*; /** * Job execution request. */ -public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter implements GridTaskMessage { +public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMessage { /** */ private static final long serialVersionUID = 0L; @@ -413,7 +413,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridJobExecuteRequest _clone = new GridJobExecuteRequest(); clone0(_clone); @@ -422,7 +422,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridJobExecuteRequest _clone = (GridJobExecuteRequest)_msg; _clone.subjId = subjId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java index db03158..5d936c8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.io.*; @@ -31,7 +31,7 @@ import java.util.*; /** * Job execution response. */ -public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter implements GridTaskMessage { +public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMessage { /** */ private static final long serialVersionUID = 0L; @@ -206,7 +206,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridJobExecuteResponse _clone = new GridJobExecuteResponse(); clone0(_clone); @@ -215,7 +215,7 @@ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter i } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridJobExecuteResponse _clone = (GridJobExecuteResponse)_msg; _clone.nodeId = nodeId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java index 6b39365..db27003 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * Job siblings request. */ -public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { +public class GridJobSiblingsRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -85,7 +85,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridJobSiblingsRequest _clone = new GridJobSiblingsRequest(); clone0(_clone); @@ -94,7 +94,7 @@ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridJobSiblingsRequest _clone = (GridJobSiblingsRequest)_msg; _clone.sesId = sesId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java index 671a149..0dad8d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal; import org.apache.ignite.*; import org.apache.ignite.compute.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -31,7 +31,7 @@ import java.util.*; /** * Job siblings response. */ -public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter { +public class GridJobSiblingsResponse extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -78,7 +78,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridJobSiblingsResponse _clone = new GridJobSiblingsResponse(); clone0(_clone); @@ -87,7 +87,7 @@ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridJobSiblingsResponse _clone = (GridJobSiblingsResponse)_msg; _clone.siblings = siblings; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java index 6d7c882..24e080e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java @@ -20,7 +20,7 @@ package org.apache.ignite.internal; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.plugin.*; import org.apache.ignite.spi.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java index 321799b..21153af 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * Request for cancelling tasks. */ -public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { +public class GridTaskCancelRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -62,7 +62,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridTaskCancelRequest _clone = new GridTaskCancelRequest(); clone0(_clone); @@ -71,7 +71,7 @@ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridTaskCancelRequest _clone = (GridTaskCancelRequest)_msg; _clone.sesId = sesId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java index a43b13b..f33e97a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -28,7 +28,7 @@ import java.util.*; /** * Task session request. */ -public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter implements GridTaskMessage { +public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMessage { /** */ private static final long serialVersionUID = 0L; @@ -99,7 +99,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridTaskSessionRequest _clone = new GridTaskSessionRequest(); clone0(_clone); @@ -108,7 +108,7 @@ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter i } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridTaskSessionRequest _clone = (GridTaskSessionRequest)_msg; _clone.sesId = sesId; 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 new file mode 100644 index 0000000..0f6a6f9 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java @@ -0,0 +1,1009 @@ +/* + * 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.direct; + +import org.apache.ignite.internal.util.*; +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 sun.misc.*; +import sun.nio.ch.*; + +import java.nio.*; +import java.util.*; + +/** + * Portable stream based on {@link ByteBuffer}. + */ +public class DirectByteBufferStream { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** */ + private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); + + /** */ + private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); + + /** */ + private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); + + /** */ + private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); + + /** */ + private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); + + /** */ + private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); + + /** */ + private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); + + /** */ + private static final byte[] BYTE_ARR_EMPTY = new byte[0]; + + /** */ + private static final short[] SHORT_ARR_EMPTY = new short[0]; + + /** */ + private static final int[] INT_ARR_EMPTY = new int[0]; + + /** */ + private static final long[] LONG_ARR_EMPTY = new long[0]; + + /** */ + private static final float[] FLOAT_ARR_EMPTY = new float[0]; + + /** */ + private static final double[] DOUBLE_ARR_EMPTY = new double[0]; + + /** */ + private static final char[] CHAR_ARR_EMPTY = new char[0]; + + /** */ + private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; + + /** */ + private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { + @Override public byte[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return BYTE_ARR_EMPTY; + + default: + return new byte[len]; + } + } + }; + + /** */ + private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { + @Override public short[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return SHORT_ARR_EMPTY; + + default: + return new short[len]; + } + } + }; + + /** */ + private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { + @Override public int[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return INT_ARR_EMPTY; + + default: + return new int[len]; + } + } + }; + + /** */ + private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { + @Override public long[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return LONG_ARR_EMPTY; + + default: + return new long[len]; + } + } + }; + + /** */ + private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { + @Override public float[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return FLOAT_ARR_EMPTY; + + default: + return new float[len]; + } + } + }; + + /** */ + private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { + @Override public double[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return DOUBLE_ARR_EMPTY; + + default: + return new double[len]; + } + } + }; + + /** */ + private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { + @Override public char[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return CHAR_ARR_EMPTY; + + default: + return new char[len]; + } + } + }; + + /** */ + private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { + @Override public boolean[] create(int len) { + assert len >= 0; + + switch (len) { + case 0: + return BOOLEAN_ARR_EMPTY; + + default: + return new boolean[len]; + } + } + }; + + /** */ + private static final Object NULL = new Object(); + + /** */ + private static final Map, IgniteInClosure> WRITERS = U.newHashMap(8); + + /** */ + private static final Map, IgniteOutClosure> READERS = U.newHashMap(8); + + static { + WRITERS.put(byte.class, new CI1() { + @Override public void apply(Object o) { + + } + }); + } + + /** */ + private final GridTcpMessageFactory msgFactory; + + /** */ + private ByteBuffer buf; + + /** */ + private byte[] heapArr; + + /** */ + private long baseOff; + + /** */ + private int arrOff = -1; + + /** */ + private Object tmpArr; + + /** */ + private int tmpArrOff; + + /** */ + private int tmpArrBytes; + + /** */ + private boolean msgTypeDone; + + /** */ + private MessageAdapter msg; + + /** */ + private Iterator it; + + /** */ + private Object cur = NULL; + + /** */ + private boolean keyDone; + + /** */ + private int readSize = -1; + + /** */ + private int readItems; + + /** */ + private Collection col; + + /** */ + private Map map; + + /** */ + private boolean lastFinished; + + /** + * @param msgFactory Message factory. + */ + public DirectByteBufferStream(@Nullable GridTcpMessageFactory msgFactory) { + this.msgFactory = msgFactory; + } + + /** + * @param buf Buffer. + */ + public void setBuffer(ByteBuffer buf) { + assert buf != null; + + if (this.buf != buf) { + this.buf = buf; + + heapArr = buf.isDirect() ? null : buf.array(); + baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; + } + } + + public int remaining() { + return buf.remaining(); + } + + /** + * @return Whether last object was fully written or read. + */ + public boolean lastFinished() { + return lastFinished; + } + + /** {@inheritDoc} */ + public void writeByte(byte val) { + lastFinished = buf.remaining() >= 1; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putByte(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + } + + /** {@inheritDoc} */ + public void writeShort(short val) { + lastFinished = buf.remaining() >= 2; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putShort(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + } + + /** {@inheritDoc} */ + public void writeInt(int val) { + lastFinished = buf.remaining() >= 4; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putInt(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + } + + /** {@inheritDoc} */ + public void writeLong(long val) { + lastFinished = buf.remaining() >= 8; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putLong(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + } + + /** {@inheritDoc} */ + public void writeFloat(float val) { + lastFinished = buf.remaining() >= 4; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putFloat(heapArr, baseOff + pos, val); + + buf.position(pos + 4); + } + } + + /** {@inheritDoc} */ + public void writeDouble(double val) { + lastFinished = buf.remaining() >= 8; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putDouble(heapArr, baseOff + pos, val); + + buf.position(pos + 8); + } + } + + /** {@inheritDoc} */ + public void writeChar(char val) { + lastFinished = buf.remaining() >= 2; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putChar(heapArr, baseOff + pos, val); + + buf.position(pos + 2); + } + } + + /** {@inheritDoc} */ + public void writeBoolean(boolean val) { + lastFinished = buf.remaining() >= 1; + + if (lastFinished) { + int pos = buf.position(); + + UNSAFE.putBoolean(heapArr, baseOff + pos, val); + + buf.position(pos + 1); + } + } + + /** {@inheritDoc} */ + public void writeByteArray(byte[] val) { + if (val != null) + lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length); + else + writeInt(-1); + } + + /** + * @param val Array. + */ + public void writeByteArray(byte[] val, int off, int len) { + if (val != null) + lastFinished = writeArray(val, BYTE_ARR_OFF + off, len, len, true); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeShortArray(short[] val) { + if (val != null) + lastFinished = writeArray(val, SHORT_ARR_OFF, val.length, val.length << 1); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeIntArray(int[] val) { + if (val != null) + lastFinished = writeArray(val, INT_ARR_OFF, val.length, val.length << 2); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeLongArray(long[] val) { + if (val != null) + lastFinished = writeArray(val, LONG_ARR_OFF, val.length, val.length << 3); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeFloatArray(float[] val) { + if (val != null) + lastFinished = writeArray(val, FLOAT_ARR_OFF, val.length, val.length << 2); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeDoubleArray(double[] val) { + if (val != null) + lastFinished = writeArray(val, DOUBLE_ARR_OFF, val.length, val.length << 3); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeCharArray(char[] val) { + if (val != null) + lastFinished = writeArray(val, CHAR_ARR_OFF, val.length, val.length << 1); + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public void writeBooleanArray(boolean[] val) { + if (val != null) + lastFinished = writeArray(val, BOOLEAN_ARR_OFF, val.length, val.length); + else + writeInt(-1); + } + + /** + * @param msg Message. + */ + public void writeMessage(MessageAdapter msg) { + if (msg != null) + lastFinished = buf.hasRemaining() && msg.writeTo(buf); + else + writeByte(Byte.MIN_VALUE); + } + + public void writeCollection(Collection col, Class itemCls) { + if (col != null) { + if (it == null) { + writeInt(col.size()); + + if (!lastFinished) + return; + + it = col.iterator(); + } + + IgniteInClosure itemWriter = WRITERS.get(itemCls); + + while (it.hasNext() || cur != NULL) { + if (cur == NULL) + cur = it.next(); + + itemWriter.apply(cur); + + if (!lastFinished) + return; + + cur = NULL; + } + + it = null; + } + else + writeInt(-1); + } + + public void writeMap(Map map, Class keyCls, Class valCls) { + if (map != null) { + if (it == null) { + writeInt(map.size()); + + if (!lastFinished) + return; + + it = map.entrySet().iterator(); + } + + IgniteInClosure keyWriter = WRITERS.get(keyCls); + IgniteInClosure valWriter = WRITERS.get(valCls); + + while (it.hasNext() || cur != NULL) { + if (cur == NULL) + cur = it.next(); + + Map.Entry e = (Map.Entry)cur; + + if (!keyDone) { + keyWriter.apply(e.getKey()); + + if (!lastFinished) + return; + + keyDone = true; + } + + valWriter.apply(e.getValue()); + + if (!lastFinished) + return; + + cur = NULL; + keyDone = false; + } + + it = null; + } + else + writeInt(-1); + } + + /** {@inheritDoc} */ + public byte readByte() { + lastFinished = buf.remaining() >= 1; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getByte(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public short readShort() { + lastFinished = buf.remaining() >= 2; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getShort(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public int readInt() { + lastFinished = buf.remaining() >= 4; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getInt(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public long readLong() { + lastFinished = buf.remaining() >= 8; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getLong(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public float readFloat() { + lastFinished = buf.remaining() >= 4; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 4); + + return UNSAFE.getFloat(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public double readDouble() { + lastFinished = buf.remaining() >= 8; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 8); + + return UNSAFE.getDouble(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public char readChar() { + lastFinished = buf.remaining() >= 2; + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 2); + + return UNSAFE.getChar(heapArr, baseOff + pos); + } + else + return 0; + } + + /** {@inheritDoc} */ + public boolean readBoolean() { + lastFinished = buf.hasRemaining(); + + if (lastFinished) { + int pos = buf.position(); + + buf.position(pos + 1); + + return UNSAFE.getBoolean(heapArr, baseOff + pos); + } + else + return false; + } + + /** {@inheritDoc} */ + public byte[] readByteArray() { + return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF); + } + + /** + * @param len Length. + * @return Array. + */ + public byte[] readByteArray(int len) { + return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF, len); + } + + /** {@inheritDoc} */ + public short[] readShortArray() { + return readArray(SHORT_ARR_CREATOR, 1, SHORT_ARR_OFF); + } + + /** {@inheritDoc} */ + public int[] readIntArray() { + return readArray(INT_ARR_CREATOR, 2, INT_ARR_OFF); + } + + /** {@inheritDoc} */ + public long[] readLongArray() { + return readArray(LONG_ARR_CREATOR, 3, LONG_ARR_OFF); + } + + /** {@inheritDoc} */ + public float[] readFloatArray() { + return readArray(FLOAT_ARR_CREATOR, 2, FLOAT_ARR_OFF); + } + + /** {@inheritDoc} */ + public double[] readDoubleArray() { + return readArray(DOUBLE_ARR_CREATOR, 3, DOUBLE_ARR_OFF); + } + + /** {@inheritDoc} */ + public char[] readCharArray() { + return readArray(CHAR_ARR_CREATOR, 1, CHAR_ARR_OFF); + } + + /** {@inheritDoc} */ + public boolean[] readBooleanArray() { + return readArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF); + } + + /** + * @return Message. + */ + public MessageAdapter readMessage() { + if (!msgTypeDone) { + if (!buf.hasRemaining()) { + lastFinished = false; + + return null; + } + + byte type = readByte(); + + msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type); + + msgTypeDone = true; + } + + lastFinished = msg == null || msg.readFrom(buf); + + if (lastFinished) { + MessageAdapter msg0 = msg; + + msgTypeDone = false; + msg = null; + + return msg0; + } + else + return null; + } + + public Collection readCollection(Class itemCls) { + if (readSize == -1) { + int size = readInt(); + + if (!lastFinished) + return null; + + readSize = size; + } + + if (readSize >= 0) { + if (col == null) + col = new ArrayList<>(readSize); + + IgniteOutClosure itemReader = READERS.get(itemCls); + + for (int i = readItems; i < readSize; i++) { + Object item = itemReader.apply(); + + if (!lastFinished) + return null; + + col.add(item); + + readItems++; + } + } + + readSize = -1; + readItems = 0; + + return (Collection)col; + } + + public Map readMap(Class keyCls, Class valCls) { + if (readSize == -1) { + int size = readInt(); + + if (!lastFinished) + return null; + + readSize = size; + } + + if (readSize >= 0) { + if (map == null) + map = U.newHashMap(readSize); + + IgniteOutClosure keyReader = READERS.get(keyCls); + IgniteOutClosure valReader = READERS.get(valCls); + + for (int i = readItems; i < readSize; i++) { + if (!keyDone) { + Object key = keyReader.apply(); + + if (!lastFinished) + return null; + + cur = key; + keyDone = true; + } + + Object val = valReader.apply(); + + if (!lastFinished) + return null; + + map.put(cur, val); + + keyDone = false; + + readItems++; + } + } + + readSize = -1; + readItems = 0; + cur = null; + + return (Map)map; + } + + /** + * @param arr Array. + * @param off Offset. + * @param len Length. + * @param bytes Length in bytes. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int len, int bytes) { + return writeArray(arr, off, len, bytes, false); + } + + /** + * @param arr Array. + * @param off Offset. + * @param len Length. + * @param bytes Length in bytes. + * @param skipLen {@code true} if length should not be written. + * @return Whether array was fully written + */ + private boolean writeArray(Object arr, long off, int len, int bytes, boolean skipLen) { + assert arr != null; + assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); + assert off > 0; + assert len >= 0; + assert bytes >= 0; + assert bytes >= arrOff; + + if (arrOff == -1) { + if (!skipLen) { + if (buf.remaining() < 4) + return false; + + writeInt(len); + } + + arrOff = 0; + } + + int toWrite = bytes - arrOff; + int pos = buf.position(); + int remaining = buf.remaining(); + + if (toWrite <= remaining) { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); + + pos += toWrite; + + buf.position(pos); + + arrOff = -1; + + return true; + } + else { + UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); + + pos += remaining; + + buf.position(pos); + + arrOff += remaining; + + return false; + } + } + + /** + * @param creator Array creator. + * @param lenShift Array length shift size. + * @param off Base offset. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int lenShift, long off) { + return readArray(creator, lenShift, off, -1); + } + + /** + * @param creator Array creator. + * @param lenShift Array length shift size. + * @param off Base offset. + * @param len Length. + * @return Array or special value if it was not fully read. + */ + private T readArray(ArrayCreator creator, int lenShift, long off, int len) { + assert creator != null; + + if (tmpArr == null) { + if (len == -1) { + if (buf.remaining() < 4) { + lastFinished = false; + + return null; + } + + len = readInt(); + } + + switch (len) { + case -1: + lastFinished = true; + + return null; + + case 0: + lastFinished = true; + + return creator.create(0); + + default: + tmpArr = creator.create(len); + tmpArrBytes = len << lenShift; + } + } + + int toRead = tmpArrBytes - tmpArrOff; + int remaining = buf.remaining(); + int pos = buf.position(); + + lastFinished = toRead <= remaining; + + if (lastFinished) { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); + + buf.position(pos + toRead); + + T arr = (T)tmpArr; + + tmpArr = null; + tmpArrBytes = 0; + tmpArrOff = 0; + + return arr; + } + else { + UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); + + buf.position(pos + remaining); + + tmpArrOff += remaining; + + return null; + } + } + + /** + * Array creator. + */ + private static interface ArrayCreator { + /** + * @param len Array length or {@code -1} if array was not fully read. + * @return New array. + */ + public T create(int len); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java new file mode 100644 index 0000000..60c04d2 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java @@ -0,0 +1,223 @@ +/* + * 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.direct; + +import org.apache.ignite.plugin.extensions.communication.*; +import org.jetbrains.annotations.*; + +import java.nio.*; +import java.util.*; + +/** + * Portable reader implementation. + */ +public class DirectMessageReader implements MessageReader { + /** Stream. */ + private final DirectByteBufferStream stream; + + /** Whether last field was fully read. */ + private boolean lastRead; + + /** + * @param msgFactory Message factory. + */ + public DirectMessageReader(GridTcpMessageFactory msgFactory) { + this.stream = new DirectByteBufferStream(msgFactory); + } + + /** {@inheritDoc} */ + @Override public void setBuffer(ByteBuffer buf) { + stream.setBuffer(buf); + } + + /** {@inheritDoc} */ + @Override public byte readByte(String name) { + byte val = stream.readByte(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public short readShort(String name) { + short val = stream.readShort(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public int readInt(String name) { + int val = stream.readInt(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public long readLong(String name) { + long val = stream.readLong(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public float readFloat(String name) { + float val = stream.readFloat(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public double readDouble(String name) { + double val = stream.readDouble(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public char readChar(String name) { + char val = stream.readChar(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public boolean readBoolean(String name) { + boolean val = stream.readBoolean(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Nullable @Override public byte[] readByteArray(String name) { + byte[] arr = stream.readByteArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public short[] readShortArray(String name) { + short[] arr = stream.readShortArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public int[] readIntArray(String name) { + int[] arr = stream.readIntArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public long[] readLongArray(String name) { + long[] arr = stream.readLongArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public float[] readFloatArray(String name) { + float[] arr = stream.readFloatArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public double[] readDoubleArray(String name) { + double[] arr = stream.readDoubleArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public char[] readCharArray(String name) { + char[] arr = stream.readCharArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public boolean[] readBooleanArray(String name) { + boolean[] arr = stream.readBooleanArray(); + + lastRead = stream.lastFinished(); + + return arr; + } + + /** {@inheritDoc} */ + @Nullable @Override public MessageAdapter readMessage(String name) { + MessageAdapter msg = stream.readMessage(); + + lastRead = stream.lastFinished(); + + return msg; + } + + /** {@inheritDoc} */ + @Override public Collection readCollection(String name, Class itemCls) { + Collection col = stream.readCollection(itemCls); + + lastRead = stream.lastFinished(); + + return col; + } + + /** {@inheritDoc} */ + @Override public Map readMap(String name, Class keyCls, Class valCls) { + Map map = stream.readMap(keyCls, valCls); + + lastRead = stream.lastFinished(); + + return map; + } + + /** {@inheritDoc} */ + @Override public boolean isLastRead() { + return lastRead; + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java new file mode 100644 index 0000000..120b148 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java @@ -0,0 +1,173 @@ +/* + * 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.direct; + +import org.apache.ignite.plugin.extensions.communication.*; +import org.jetbrains.annotations.*; + +import java.nio.*; +import java.util.*; + +/** + * Portable writer implementation. + */ +public class DirectMessageWriter implements MessageWriter { + /** Stream. */ + private final DirectByteBufferStream stream = new DirectByteBufferStream(null); + + /** {@inheritDoc} */ + @Override public void setBuffer(ByteBuffer buf) { + stream.setBuffer(buf); + } + + /** {@inheritDoc} */ + @Override public boolean writeByte(String name, byte val) { + stream.writeByte(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeShort(String name, short val) { + stream.writeShort(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeInt(String name, int val) { + stream.writeInt(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeLong(String name, long val) { + stream.writeLong(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeFloat(String name, float val) { + stream.writeFloat(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeDouble(String name, double val) { + stream.writeDouble(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeChar(String name, char val) { + stream.writeChar(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeBoolean(String name, boolean val) { + stream.writeBoolean(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeByteArray(String name, @Nullable byte[] val) { + stream.writeByteArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeShortArray(String name, @Nullable short[] val) { + stream.writeShortArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeIntArray(String name, @Nullable int[] val) { + stream.writeIntArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeLongArray(String name, @Nullable long[] val) { + stream.writeLongArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeFloatArray(String name, @Nullable float[] val) { + stream.writeFloatArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeDoubleArray(String name, @Nullable double[] val) { + stream.writeDoubleArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeCharArray(String name, @Nullable char[] val) { + stream.writeCharArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeBooleanArray(String name, @Nullable boolean[] val) { + stream.writeBooleanArray(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeMessage(String name, @Nullable MessageAdapter msg) { + if (msg != null) + msg.setWriter(this); + + stream.writeMessage(msg); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeCollection(String name, Collection col, Class itemCls) { + stream.writeCollection(col, itemCls); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeMap(String name, Map map, Class keyCls, Class valCls) { + stream.writeMap(map, keyCls, valCls); + + return stream.lastFinished(); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java new file mode 100644 index 0000000..d0d966f --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java @@ -0,0 +1,346 @@ +/* + * 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.direct; + +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; +import sun.misc.*; + +import java.util.*; + +/** + * Direct marshalling utility methods. + */ +public class DirectUtils { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** + * Do not instantiate. + */ + private DirectUtils() { + // No-op. + } + + /** + * @param uuid {@link UUID}. + * @return Array. + */ + public static byte[] uuidToArray(UUID uuid) { + byte[] arr = null; + + if (uuid != null) { + arr = new byte[16]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link UUID}. + */ + public static UUID arrayToUuid(byte[] arr) { + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + + return new UUID(most, least); + } + } + + /** + * @param uuid {@link IgniteUuid}. + * @return Array. + */ + public static byte[] gridUuidToArray(IgniteUuid uuid) { + byte[] arr = null; + + if (uuid != null) { + arr = new byte[24]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link IgniteUuid}. + */ + public static IgniteUuid arrayToIgniteUuid(byte[] arr) { + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); + + return new IgniteUuid(new UUID(most, least), loc); + } + } + + /** + * @param ver {@link GridClockDeltaVersion}. + * @return Array. + */ + public static byte[] clockDeltaVersionToArray(GridClockDeltaVersion ver) { + byte[] arr = null; + + if (ver != null) { + arr = new byte[16]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link GridClockDeltaVersion}. + */ + public static GridClockDeltaVersion arrayToClockDeltaVersion(byte[] arr) { + if (arr == null) + return null; + else { + long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + + return new GridClockDeltaVersion(ver, topVer); + } + } + + /** + * @param list {@link GridByteArrayList}. + * @return Array. + */ + public static byte[] byteArrayListToArray(GridByteArrayList list) { + return list != null ? list.array() : null; + } + + /** + * @param arr Array. + * @return {@link GridByteArrayList}. + */ + public static GridByteArrayList arrayToByteArrayList(byte[] arr) { + return arr != null ? new GridByteArrayList(arr) : null; + } + + /** + * @param list {@link GridLongList}. + * @return Array. + */ + public static long[] longListToArray(GridLongList list) { + return list != null ? list.array() : null; + } + + /** + * @param arr Array. + * @return {@link GridLongList}. + */ + public static GridLongList arrayToLongList(long[] arr) { + return arr != null ? new GridLongList(arr) : null; + } + + /** + * @param ver {@link GridCacheVersion}. + * @return Array. + */ + public static byte[] cacheVersionToArray(GridCacheVersion ver) { + byte[] arr = null; + + if (ver != null) { + arr = new byte[24]; + + UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion()); + UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link GridCacheVersion}. + */ + public static GridCacheVersion arrayToCacheVersion(byte[] arr) { + if (arr == null) + return null; + else { + int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); + int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4); + long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); + + return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order); + } + } + + /** + * @param id {@link GridDhtPartitionExchangeId}. + * @return Array. + */ + public static byte[] dhtPartitionExchangeIdToArray(GridDhtPartitionExchangeId id) { + byte[] arr = null; + + if (id != null) { + arr = new byte[28]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits()); + UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link GridDhtPartitionExchangeId}. + */ + public static GridDhtPartitionExchangeId arrayToDhtPartitionExchangeId(byte[] arr) { + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16); + long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20); + + return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer); + } + } + + /** + * @param bytes {@link GridCacheValueBytes}. + * @return Array. + */ + public static byte[] valueBytesToArray(GridCacheValueBytes bytes) { + byte[] arr = null; + + if (bytes != null) { + byte[] bytes0 = bytes.get(); + + if (bytes0 != null) { + int len = bytes0.length; + + arr = new byte[len + 2]; + + UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); + UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); + UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); + } + else { + arr = new byte[1]; + + UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false); + } + } + + return arr; + } + + /** + * @param arr Array. + * @return {@link GridCacheValueBytes}. + */ + public static GridCacheValueBytes arrayToValueBytes(byte[] arr) { + if (arr == null) + return null; + else { + boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); + + if (notNull) { + int len = arr.length - 2; + + assert len >= 0 : len; + + byte[] bytesArr = new byte[len]; + + UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len); + + boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len); + + return new GridCacheValueBytes(bytesArr, isPlain); + } + else + return new GridCacheValueBytes(); + } + } + + /** + * @param str {@link String}. + * @return Array. + */ + public static byte[] stringToArray(String str) { + return str != null ? str.getBytes() : null; + } + + /** + * @param arr Array. + * @return {@link String}. + */ + public static String arrayToString(byte[] arr) { + return arr != null ? new String(arr) : null; + } + + /** + * @param bits {@link BitSet}. + * @return Array. + */ + public static long[] bitSetToArray(BitSet bits) { + return bits != null ? bits.toLongArray() : null; + } + + /** + * @param arr Array. + * @return {@link BitSet}. + */ + public static BitSet arrayToBitSet(long[] arr) { + return arr != null ? BitSet.valueOf(arr) : null; + } + +// /** +// * @param name Field name. +// * @param e Enum. +// * @return Whether value was fully written. +// */ +// protected boolean putEnum(String name, @Nullable Enum e) { +// return writer.writeByte(name, e != null ? (byte)e.ordinal() : -1); +// } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java new file mode 100644 index 0000000..d3091e6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java @@ -0,0 +1,376 @@ +/* + * 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.direct; + +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.managers.checkpoint.*; +import org.apache.ignite.internal.managers.communication.*; +import org.apache.ignite.internal.managers.deployment.*; +import org.apache.ignite.internal.managers.eventstorage.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +import org.apache.ignite.internal.processors.cache.distributed.near.*; +import org.apache.ignite.internal.processors.cache.query.*; +import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.internal.processors.continuous.*; +import org.apache.ignite.internal.processors.dataload.*; +import org.apache.ignite.internal.processors.rest.client.message.*; +import org.apache.ignite.internal.processors.rest.handlers.task.*; +import org.apache.ignite.internal.processors.rest.protocols.tcp.*; +import org.apache.ignite.internal.processors.streamer.*; +import org.apache.ignite.plugin.extensions.communication.*; +import org.apache.ignite.spi.collision.jobstealing.*; +import org.apache.ignite.spi.communication.tcp.*; +import org.jdk8.backport.*; + +import java.util.*; + +/** + * Communication message factory. + */ +public class GridTcpCommunicationMessageFactory { + /** Common message producers. */ + private static final GridTcpCommunicationMessageProducer[] COMMON = new GridTcpCommunicationMessageProducer[83]; + + /** + * Custom messages registry. Used for test purposes. + */ + private static final Map CUSTOM = new ConcurrentHashMap8<>(); + + /** */ + public static final int MAX_COMMON_TYPE = 82; + + static { + registerCommon(new GridTcpCommunicationMessageProducer() { + @Override public MessageAdapter create(byte type) { + switch (type) { + case 0: + return new GridJobCancelRequest(); + + case 1: + return new GridJobExecuteRequest(); + + case 2: + return new GridJobExecuteResponse(); + + case 3: + return new GridJobSiblingsRequest(); + + case 4: + return new GridJobSiblingsResponse(); + + case 5: + return new GridTaskCancelRequest(); + + case 6: + return new GridTaskSessionRequest(); + + case 7: + return new GridCheckpointRequest(); + + case 8: + return new GridIoMessage(); + + case 9: + return new GridIoUserMessage(); + + case 10: + return new GridDeploymentInfoBean(); + + case 11: + return new GridDeploymentRequest(); + + case 12: + return new GridDeploymentResponse(); + + case 13: + return new GridEventStorageMessage(); + + case 14: + return new GridCacheEvictionRequest(); + + case 15: + return new GridCacheEvictionResponse(); + + case 16: + return new GridCacheOptimisticCheckPreparedTxRequest(); + + case 17: + return new GridCacheOptimisticCheckPreparedTxResponse(); + + case 18: + return new GridCachePessimisticCheckCommittedTxRequest(); + + case 19: + return new GridCachePessimisticCheckCommittedTxResponse(); + + case 20: + return new GridCacheTtlUpdateRequest(); + + case 21: + return new GridDistributedLockRequest(); + + case 22: + return new GridDistributedLockResponse(); + + case 23: + return new GridDistributedTxFinishRequest(); + + case 24: + return new GridDistributedTxFinishResponse(); + + case 25: + return new GridDistributedTxPrepareRequest(); + + case 26: + return new GridDistributedTxPrepareResponse(); + + case 27: + return new GridDistributedUnlockRequest(); + + case 28: + return new GridDhtAffinityAssignmentRequest(); + + case 29: + return new GridDhtAffinityAssignmentResponse(); + + case 30: + return new GridDhtLockRequest(); + + case 31: + return new GridDhtLockResponse(); + + case 32: + return new GridDhtTxFinishRequest(); + + case 33: + return new GridDhtTxFinishResponse(); + + case 34: + return new GridDhtTxPrepareRequest(); + + case 35: + return new GridDhtTxPrepareResponse(); + + case 36: + return new GridDhtUnlockRequest(); + + case 37: + return new GridDhtAtomicDeferredUpdateResponse(); + + case 38: + return new GridDhtAtomicUpdateRequest(); + + case 39: + return new GridDhtAtomicUpdateResponse(); + + case 40: + return new GridNearAtomicUpdateRequest(); + + case 41: + return new GridNearAtomicUpdateResponse(); + + case 42: + return new GridDhtForceKeysRequest(); + + case 43: + return new GridDhtForceKeysResponse(); + + case 44: + return new GridDhtPartitionDemandMessage(); + + case 45: + return new GridDhtPartitionSupplyMessage(); + + case 46: + return new GridDhtPartitionsFullMessage(); + + case 47: + return new GridDhtPartitionsSingleMessage(); + + case 48: + return new GridDhtPartitionsSingleRequest(); + + case 49: + return new GridNearGetRequest(); + + case 50: + return new GridNearGetResponse(); + + case 51: + return new GridNearLockRequest(); + + case 52: + return new GridNearLockResponse(); + + case 53: + return new GridNearTxFinishRequest(); + + case 54: + return new GridNearTxFinishResponse(); + + case 55: + return new GridNearTxPrepareRequest(); + + case 56: + return new GridNearTxPrepareResponse(); + + case 57: + return new GridNearUnlockRequest(); + + case 58: + return new GridCacheQueryRequest(); + + case 59: + return new GridCacheQueryResponse(); + + case 60: + return new GridClockDeltaSnapshotMessage(); + + case 61: + return new GridContinuousMessage(); + + case 62: + return new GridDataLoadRequest(); + + case 63: + return new GridDataLoadResponse(); + + // 64-71: IgniteFS messages. + + case 72: + return new GridClientHandshakeRequestWrapper(); + + case 73: + return new GridClientHandshakeResponseWrapper(); + + case 74: + return new GridClientMessageWrapper(); + + case 75: + return new GridClientPingPacketWrapper(); + + case 76: + return new GridTaskResultRequest(); + + case 77: + return new GridTaskResultResponse(); + + case 78: + return new GridMemcachedMessageWrapper(); + + case 79: + return new GridStreamerCancelRequest(); + + case 80: + return new GridStreamerExecutionRequest(); + + case 81: + return new GridStreamerResponse(); + + case 82: + return new JobStealingRequest(); + + default: + assert false : "Invalid message type."; + + return null; + } + } + }, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, /* 64-71: IgniteFS messages. */ 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82); + } + + /** + * @param type Message type. + * @return New message. + */ + public static MessageAdapter create(byte type) { + if (type == TcpCommunicationSpi.NODE_ID_MSG_TYPE) + return new TcpCommunicationSpi.NodeIdMessage(); + else if (type == TcpCommunicationSpi.RECOVERY_LAST_ID_MSG_TYPE) + return new TcpCommunicationSpi.RecoveryLastReceivedMessage(); + else if (type == TcpCommunicationSpi.HANDSHAKE_MSG_TYPE) + return new TcpCommunicationSpi.HandshakeMessage(); + else + return create0(type); + } + + /** + * @param type Message type. + * @return New message. + */ + private static MessageAdapter create0(byte type) { + if (type >= 0 && type < COMMON.length) { + GridTcpCommunicationMessageProducer producer = COMMON[type]; + + if (producer != null) + return producer.create(type); + else + throw new IllegalStateException("Common message type producer is not registered: " + type); + } + else { + GridTcpCommunicationMessageProducer c = CUSTOM.get(type); + + if (c != null) + return c.create(type); + else + throw new IllegalStateException("Custom message type producer is not registered: " + type); + } + } + + /** + * Register message producer for common message type. + * + * @param producer Producer. + * @param types Types applicable for this producer. + */ + public static void registerCommon(GridTcpCommunicationMessageProducer producer, int... types) { + for (int type : types) { + assert type >= 0 && type < COMMON.length : "Common type being registered is out of common messages " + + "array length: " + type; + + COMMON[type] = producer; + } + } + + /** + * Registers factory for custom message. Used for test purposes. + * + * @param producer Message producer. + * @param type Message type. + */ + public static void registerCustom(GridTcpCommunicationMessageProducer producer, byte type) { + assert producer != null; + + CUSTOM.put(type, producer); + } + + /** + * @return Common message producers. + */ + public static GridTcpCommunicationMessageProducer[] commonProducers() { + return COMMON; + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageProducer.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageProducer.java new file mode 100644 index 0000000..2932002 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageProducer.java @@ -0,0 +1,33 @@ +/* + * 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.direct; + +import org.apache.ignite.plugin.extensions.communication.*; + +/** + * Message producer. Each component have to register it's own message producer. + */ +public interface GridTcpCommunicationMessageProducer { + /** + * Create message. + * + * @param type Message type. + * @return Communication message. + */ + public MessageAdapter create(byte type); +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java new file mode 100644 index 0000000..ad9542a --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java @@ -0,0 +1,726 @@ +/* + * 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.direct; + +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; +import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.clock.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; +import org.jetbrains.annotations.*; +import sun.misc.*; + +import java.nio.*; +import java.util.*; + +import static org.apache.ignite.plugin.extensions.communication.MessageAdapter.*; + +/** + * Communication message state. + */ +@SuppressWarnings("PublicField") +public class GridTcpCommunicationMessageState { + /** */ + private static final Unsafe UNSAFE = GridUnsafe.unsafe(); + + /** */ + private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); + + /** */ + private final MessageWriter writer = new DirectMessageWriter(); + + /** */ + private MessageReader reader; + + /** */ + public int idx; + + /** */ + public boolean typeWritten; + + /** */ + public Iterator it; + + /** */ + public Object cur; + + /** */ + public boolean keyDone; + + /** */ + public int readSize = -1; + + /** */ + public int readItems; + + /** + * @param writer Writer. + */ + public final void setWriter(MessageWriter writer) { +// if (this.writer == null) +// this.writer = writer; + } + + /** + * @param reader Reader. + */ + public final void setReader(MessageReader reader) { + if (this.reader == null) + this.reader = reader; + } + + /** + * @param buf Buffer. + */ + public final void setBuffer(ByteBuffer buf) { + if (writer != null) + writer.setBuffer(buf); + + if (reader != null) + reader.setBuffer(buf); + } + + /** + * @param name Field name. + * @param b Byte value. + * @return Whether value was written. + */ + public final boolean putByte(String name, byte b) { + return writer.writeByte(name, b); + } + + /** + * @param name Field name. + * @return Byte value. + */ + public final byte getByte(String name) { + return reader.readByte(name); + } + + /** + * @param name Field name. + * @param s Short value. + * @return Whether value was written. + */ + public final boolean putShort(String name, short s) { + return writer.writeShort(name, s); + } + + /** + * @param name Field name. + * @return Short value. + */ + public final short getShort(String name) { + return reader.readShort(name); + } + + /** + * @param name Field name. + * @param i Integer value. + * @return Whether value was written. + */ + public final boolean putInt(String name, int i) { + return writer.writeInt(name, i); + } + + /** + * @param name Field name. + * @return Integer value. + */ + public final int getInt(String name) { + return reader.readInt(name); + } + + /** + * @param name Field name. + * @param l Long value. + * @return Whether value was written. + */ + public final boolean putLong(String name, long l) { + return writer.writeLong(name, l); + } + + /** + * @param name Field name. + * @return Long value. + */ + public final long getLong(String name) { + return reader.readLong(name); + } + + /** + * @param name Field name. + * @param f Float value. + * @return Whether value was written. + */ + public final boolean putFloat(String name, float f) { + return writer.writeFloat(name, f); + } + + /** + * @param name Field name. + * @return Float value. + */ + public final float getFloat(String name) { + return reader.readFloat(name); + } + + /** + * @param name Field name. + * @param d Double value. + * @return Whether value was written. + */ + public final boolean putDouble(String name, double d) { + return writer.writeDouble(name, d); + } + + /** + * @param name Field name. + * @return Double value. + */ + public final double getDouble(String name) { + return reader.readDouble(name); + } + + /** + * @param name Field name. + * @param c Char value. + * @return Whether value was written. + */ + public final boolean putChar(String name, char c) { + return writer.writeChar(name, c); + } + + /** + * @param name Field name. + * @return Char value. + */ + public final char getChar(String name) { + return reader.readChar(name); + } + + /** + * @param name Field name. + * @param b Boolean value. + * @return Whether value was written. + */ + public final boolean putBoolean(String name, boolean b) { + return writer.writeBoolean(name, b); + } + + /** + * @param name Field name. + * @return Boolean value. + */ + public final boolean getBoolean(String name) { + return reader.readBoolean(name); + } + + /** + * @param name Field name. + * @param arr Byte array. + * @return Whether array was fully written. + */ + public final boolean putByteArray(String name, @Nullable byte[] arr) { + return writer.writeByteArray(name, arr); + } + + /** + * @param name Field name. + * @return Byte array. + */ + public final byte[] getByteArray(String name) { + return reader.readByteArray(name); + } + + /** + * @param name Field name. + * @param arr Short array. + * @return Whether array was fully written. + */ + public final boolean putShortArray(String name, short[] arr) { + return writer.writeShortArray(name, arr); + } + + /** + * @param name Field name. + * @return Short array. + */ + public final short[] getShortArray(String name) { + return reader.readShortArray(name); + } + + /** + * @param name Field name. + * @param arr Integer array. + * @return Whether array was fully written. + */ + public final boolean putIntArray(String name, int[] arr) { + return writer.writeIntArray(name, arr); + } + + /** + * @param name Field name. + * @return Integer array. + */ + public final int[] getIntArray(String name) { + return reader.readIntArray(name); + } + + /** + * @param name Field name. + * @param arr Long array. + * @return Whether array was fully written. + */ + public final boolean putLongArray(String name, long[] arr) { + return writer.writeLongArray(name, arr); + } + + /** + * @param name Field name. + * @return Long array. + */ + public final long[] getLongArray(String name) { + return reader.readLongArray(name); + } + + /** + * @param name Field name. + * @param arr Float array. + * @return Whether array was fully written. + */ + public final boolean putFloatArray(String name, float[] arr) { + return writer.writeFloatArray(name, arr); + } + + /** + * @param name Field name. + * @return Float array. + */ + public final float[] getFloatArray(String name) { + return reader.readFloatArray(name); + } + + /** + * @param name Field name. + * @param arr Double array. + * @return Whether array was fully written. + */ + public final boolean putDoubleArray(String name, double[] arr) { + return writer.writeDoubleArray(name, arr); + } + + /** + * @param name Field name. + * @return Double array. + */ + public final double[] getDoubleArray(String name) { + return reader.readDoubleArray(name); + } + + /** + * @param name Field name. + * @param arr Char array. + * @return Whether array was fully written. + */ + public final boolean putCharArray(String name, char[] arr) { + return writer.writeCharArray(name, arr); + } + + /** + * @param name Field name. + * @return Char array. + */ + public final char[] getCharArray(String name) { + return reader.readCharArray(name); + } + + /** + * @param name Field name. + * @param arr Boolean array. + * @return Whether array was fully written. + */ + public final boolean putBooleanArray(String name, boolean[] arr) { + return writer.writeBooleanArray(name, arr); + } + + /** + * @param name Field name. + * @return Boolean array. + */ + public final boolean[] getBooleanArray(String name) { + return reader.readBooleanArray(name); + } + + + /** + * @param name Field name. + * @param uuid {@link UUID}. + * @return Whether value was fully written. + */ + public final boolean putUuid(String name, @Nullable UUID uuid) { + byte[] arr = null; + + if (uuid != null) { + arr = new byte[16]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link UUID}. + */ + public final UUID getUuid(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + + return new UUID(most, least); + } + } + + /** + * @param name Field name. + * @param uuid {@link IgniteUuid}. + * @return Whether value was fully written. + */ + public final boolean putGridUuid(String name, @Nullable IgniteUuid uuid) { + byte[] arr = null; + + if (uuid != null) { + arr = new byte[24]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link IgniteUuid}. + */ + public final IgniteUuid getGridUuid(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); + + return new IgniteUuid(new UUID(most, least), loc); + } + } + + /** + * @param name Field name. + * @param ver {@link GridClockDeltaVersion}. + * @return Whether value was fully written. + */ + public final boolean putClockDeltaVersion(String name, @Nullable GridClockDeltaVersion ver) { + byte[] arr = null; + + if (ver != null) { + arr = new byte[16]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link GridClockDeltaVersion}. + */ + public final GridClockDeltaVersion getClockDeltaVersion(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + + return new GridClockDeltaVersion(ver, topVer); + } + } + + /** + * @param name Field name. + * @param list {@link GridByteArrayList}. + * @return Whether value was fully written. + */ + public final boolean putByteArrayList(String name, @Nullable GridByteArrayList list) { + return putByteArray(name, list != null ? list.array() : null); + } + + /** + * @param name Field name. + * @return {@link GridByteArrayList}. + */ + public final GridByteArrayList getByteArrayList(String name) { + byte[] arr = getByteArray(name); + + return arr != null ? new GridByteArrayList(arr) : null; + } + + /** + * @param name Field name. + * @param list {@link GridLongList}. + * @return Whether value was fully written. + */ + public final boolean putLongList(String name, @Nullable GridLongList list) { + return putLongArray(name, list != null ? list.array() : null); + } + + /** + * @param name Field name. + * @return {@link GridLongList}. + */ + public final GridLongList getLongList(String name) { + long[] arr = getLongArray(name); + + return arr != null ? new GridLongList(arr) : null; + } + + /** + * @param name Field name. + * @param ver {@link org.apache.ignite.internal.processors.cache.version.GridCacheVersion}. + * @return Whether value was fully written. + */ + public final boolean putCacheVersion(String name, @Nullable GridCacheVersion ver) { + byte[] arr = null; + + if (ver != null) { + arr = new byte[24]; + + UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion()); + UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link GridCacheVersion}. + */ + public final GridCacheVersion getCacheVersion(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); + int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4); + long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); + + return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order); + } + } + + /** + * @param name Field name. + * @param id {@link GridDhtPartitionExchangeId}. + * @return Whether value was fully written. + */ + public final boolean putDhtPartitionExchangeId(String name, @Nullable GridDhtPartitionExchangeId id) { + byte[] arr = null; + + if (id != null) { + arr = new byte[28]; + + UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits()); + UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event()); + UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link GridDhtPartitionExchangeId}. + */ + public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); + long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); + int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16); + long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20); + + return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer); + } + } + + /** + * @param name Field name. + * @param bytes {@link GridCacheValueBytes}. + * @return Whether value was fully written. + */ + public final boolean putValueBytes(String name, @Nullable GridCacheValueBytes bytes) { + byte[] arr = null; + + if (bytes != null) { + byte[] bytes0 = bytes.get(); + + if (bytes0 != null) { + int len = bytes0.length; + + arr = new byte[len + 2]; + + UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); + UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); + UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); + } + else { + arr = new byte[1]; + + UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false); + } + } + + return putByteArray(name, arr); + } + + /** + * @param name Field name. + * @return {@link GridCacheValueBytes}. + */ + public final GridCacheValueBytes getValueBytes(String name) { + byte[] arr = getByteArray(name); + + if (arr == null) + return null; + else { + boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); + + if (notNull) { + int len = arr.length - 2; + + assert len >= 0 : len; + + byte[] bytesArr = new byte[len]; + + UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len); + + boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len); + + return new GridCacheValueBytes(bytesArr, isPlain); + } + else + return new GridCacheValueBytes(); + } + } + + /** + * @param name Field name. + * @param str {@link String}. + * @return Whether value was fully written. + */ + public final boolean putString(String name, @Nullable String str) { + return putByteArray(name, str != null ? str.getBytes() : null); + } + + /** + * @param name Field name. + * @return {@link String}. + */ + public final String getString(String name) { + byte[] arr = getByteArray(name); + + return arr != null ? new String(arr) : null; + } + + /** + * @param name Field name. + * @param bits {@link BitSet}. + * @return Whether value was fully written. + */ + public final boolean putBitSet(String name, @Nullable BitSet bits) { + return putLongArray(name, bits != null ? bits.toLongArray() : null); + } + + /** + * @param name Field name. + * @return {@link BitSet}. + */ + public final BitSet getBitSet(String name) { + long[] arr = getLongArray(name); + + return arr != null ? BitSet.valueOf(arr) : null; + } + + /** + * @param name Field name. + * @param e Enum. + * @return Whether value was fully written. + */ + public final boolean putEnum(String name, @Nullable Enum e) { + return putByte(name, e != null ? (byte)e.ordinal() : -1); + } + + /** + * @param name Field name. + * @param msg {@link MessageAdapter}. + * @return Whether value was fully written. + */ + public final boolean putMessage(String name, @Nullable MessageAdapter msg) { + if (msg != null) + msg.setWriter(writer); + + return writer.writeMessage(name, msg); + } + + /** + * @param name Field name. + * @return {@link MessageAdapter}. + */ + public final MessageAdapter getMessage(String name) { + return reader.readMessage(name); + } + + public final boolean lastRead() { + return reader.isLastRead(); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpMessageFactory.java new file mode 100644 index 0000000..5c66a04 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpMessageFactory.java @@ -0,0 +1,31 @@ +/* + * 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.direct; + +import org.apache.ignite.plugin.extensions.communication.*; + +/** + * + */ +public interface GridTcpMessageFactory { + /** + * @param type Message type. + * @return Message instance. + */ + public MessageAdapter create(byte type); +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java index 7143cfe..58b84b2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java @@ -22,6 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; @@ -29,9 +30,7 @@ import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; -import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.spi.swapspace.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -319,8 +318,8 @@ public abstract class GridManagerAdapter implements GridMan A.notNull(topic, "topic"); try { - if (msg instanceof GridTcpCommunicationMessageAdapter) - ctx.io().send(node, topic, (GridTcpCommunicationMessageAdapter)msg, SYSTEM_POOL); + if (msg instanceof MessageAdapter) + ctx.io().send(node, topic, (MessageAdapter)msg, SYSTEM_POOL); else ctx.io().sendUserMessage(asList(node), msg, topic, false, 0); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java index 9bcd89b..fda129a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal.managers.checkpoint; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * This class defines checkpoint request. */ -public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { +public class GridCheckpointRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -85,7 +85,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCheckpointRequest _clone = new GridCheckpointRequest(); clone0(_clone); @@ -94,7 +94,7 @@ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridCheckpointRequest _clone = (GridCheckpointRequest)_msg; _clone.sesId = sesId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 70ab41d..6902617 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -21,12 +21,12 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.managers.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.timeout.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -36,7 +36,6 @@ import org.apache.ignite.marshaller.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.*; -import org.gridgain.grid.util.direct.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -202,8 +201,8 @@ public class GridIoManager extends GridManagerAdapter= producers.length) msg = GridTcpCommunicationMessageFactory.create(type); @@ -275,7 +274,7 @@ public class GridIoManager extends GridManagerAdapter nodes, Object topic, - GridTcpCommunicationMessageAdapter msg, + MessageAdapter msg, GridIoPolicy plc, long timeout, boolean skipOnTimeout @@ -1135,7 +1134,7 @@ public class GridIoManager extends GridManagerAdapter nodes, Object topic, - GridTcpCommunicationMessageAdapter msg, + MessageAdapter msg, GridIoPolicy plc ) throws IgniteCheckedException { send(nodes, topic, -1, msg, plc, false, 0, false); @@ -1151,7 +1150,7 @@ public class GridIoManager extends GridManagerAdapter nodes, GridTopic topic, - GridTcpCommunicationMessageAdapter msg, + MessageAdapter msg, GridIoPolicy plc ) throws IgniteCheckedException { send(nodes, topic, topic.ordinal(), msg, plc, false, 0, false); @@ -1211,7 +1210,7 @@ public class GridIoManager extends GridManagerAdapter nodes, Object topic, int topicOrd, - GridTcpCommunicationMessageAdapter msg, + MessageAdapter msg, GridIoPolicy plc, boolean ordered, long timeout, @@ -1306,7 +1305,7 @@ public class GridIoManager extends GridManagerAdapter rmtNodes) throws IgniteCheckedException { assert !rmtNodes.contains(ctx.discovery().localNode()); - GridTcpCommunicationMessageAdapter req = new GridDeploymentRequest(null, null, rsrcName, true); + MessageAdapter req = new GridDeploymentRequest(null, null, rsrcName, true); if (!rmtNodes.isEmpty()) { ctx.io().send( diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java index 5d9a104..c0698d0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java @@ -19,10 +19,10 @@ package org.apache.ignite.internal.managers.deployment; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -31,7 +31,7 @@ import java.util.*; /** * Deployment info bean. */ -public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter implements GridDeploymentInfo, +public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploymentInfo, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -139,7 +139,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDeploymentInfoBean _clone = new GridDeploymentInfoBean(); clone0(_clone); @@ -148,7 +148,7 @@ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter i } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridDeploymentInfoBean _clone = (GridDeploymentInfoBean)_msg; _clone.clsLdrId = clsLdrId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java index 2a8b6dd..86019b9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.managers.deployment; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -30,7 +30,7 @@ import java.util.*; /** * Deployment request. */ -public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { +public class GridDeploymentRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -157,7 +157,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDeploymentRequest _clone = new GridDeploymentRequest(); clone0(_clone); @@ -166,7 +166,7 @@ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridDeploymentRequest _clone = (GridDeploymentRequest)_msg; _clone.resTopic = resTopic; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java index d281a4f..de50cc9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.managers.deployment; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * Grid deployment response containing requested resource bytes. */ -public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { +public class GridDeploymentResponse extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -107,7 +107,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDeploymentResponse _clone = new GridDeploymentResponse(); clone0(_clone); @@ -116,7 +116,7 @@ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridDeploymentResponse _clone = (GridDeploymentResponse)_msg; _clone.success = success; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java index 5b0c62f..1658b88 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java @@ -20,10 +20,10 @@ package org.apache.ignite.internal.managers.eventstorage; import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.nio.*; @@ -32,7 +32,7 @@ import java.util.*; /** * Event storage message. */ -public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter { +public class GridEventStorageMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -262,7 +262,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridEventStorageMessage _clone = new GridEventStorageMessage(); clone0(_clone); @@ -271,7 +271,7 @@ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridEventStorageMessage _clone = (GridEventStorageMessage)_msg; _clone.resTopic = resTopic; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java index 9059d75..bb63b86 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java @@ -20,11 +20,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; 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.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -141,7 +141,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheEvictionRequest _clone = new GridCacheEvictionRequest(); clone0(_clone); @@ -150,7 +150,7 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheEvictionRequest _clone = (GridCacheEvictionRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java index 8bf52d7..8199020 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -130,7 +130,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheEvictionResponse _clone = new GridCacheEvictionResponse(); clone0(_clone); @@ -139,7 +139,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheEvictionResponse _clone = (GridCacheEvictionResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java index eb29297..78028b0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java @@ -22,11 +22,11 @@ import org.apache.ignite.cache.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.nio.*; @@ -36,7 +36,7 @@ import java.util.concurrent.atomic.*; /** * Parent of all cache messages. */ -public abstract class GridCacheMessage extends GridTcpCommunicationMessageAdapter { +public abstract class GridCacheMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -644,7 +644,7 @@ public abstract class GridCacheMessage extends GridTcpCommunicationMessage } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridCacheMessage _clone = (GridCacheMessage)_msg; _clone.msgId = msgId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java index 4fc23a4..aba1c18 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java @@ -18,12 +18,15 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; +import java.nio.*; + /** * Wrapped value bytes of cache entry. */ -public class GridCacheValueBytes { +public class GridCacheValueBytes extends MessageAdapter { /** Null instance. */ private static final GridCacheValueBytes NULL = new GridCacheValueBytes(); @@ -114,6 +117,31 @@ public class GridCacheValueBytes { } /** {@inheritDoc} */ + @Override public boolean writeTo(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 0; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public MessageAdapter clone() { + return null; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override protected void clone0(MessageAdapter _msg) { + // TODO: implement. + } + + /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCacheValueBytes.class, this, "len", bytes != null ? bytes.length : -1); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index 5d2de37..e021408 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -19,9 +19,9 @@ package 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.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -98,7 +98,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheOptimisticCheckPreparedTxRequest _clone = new GridCacheOptimisticCheckPreparedTxRequest(); clone0(_clone); @@ -107,7 +107,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheOptimisticCheckPreparedTxRequest _clone = (GridCacheOptimisticCheckPreparedTxRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index d3ae3f7..bba1efb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.processors.cache.distributed; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -86,7 +86,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheOptimisticCheckPreparedTxResponse _clone = new GridCacheOptimisticCheckPreparedTxResponse(); clone0(_clone); @@ -95,7 +95,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheOptimisticCheckPreparedTxResponse _clone = (GridCacheOptimisticCheckPreparedTxResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index 9fe4cfb..4eb5624 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -20,9 +20,9 @@ package org.apache.ignite.internal.processors.cache.distributed; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -131,7 +131,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCachePessimisticCheckCommittedTxRequest _clone = new GridCachePessimisticCheckCommittedTxRequest(); clone0(_clone); @@ -140,7 +140,7 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCachePessimisticCheckCommittedTxRequest _clone = (GridCachePessimisticCheckCommittedTxRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 41e28ca..68495f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -21,9 +21,9 @@ 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.direct.*; 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 java.io.*; @@ -117,7 +117,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCachePessimisticCheckCommittedTxResponse _clone = new GridCachePessimisticCheckCommittedTxResponse(); clone0(_clone); @@ -126,7 +126,7 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCachePessimisticCheckCommittedTxResponse _clone = (GridCachePessimisticCheckCommittedTxResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java index d860411..f8f9870 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java @@ -21,9 +21,9 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; import java.util.*; @@ -185,7 +185,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheTtlUpdateRequest _clone = new GridCacheTtlUpdateRequest(); clone0(_clone); @@ -483,7 +483,7 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheTtlUpdateRequest _clone = (GridCacheTtlUpdateRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java index 812ed18..55e5250 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -21,9 +21,9 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -240,7 +240,7 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedBaseMessage _clone = (GridDistributedBaseMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index c4081c9..3c94d51 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -22,10 +22,10 @@ import org.apache.ignite.internal.*; 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; @@ -428,7 +428,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage /** {@inheritDoc} */ @SuppressWarnings({"CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction", "CloneDoesntCallSuperClone"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedLockRequest _clone = new GridDistributedLockRequest(); clone0(_clone); @@ -437,7 +437,7 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedLockRequest _clone = (GridDistributedLockRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java index 1c77615..32c73e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java @@ -21,11 +21,11 @@ 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.direct.*; 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 java.io.*; @@ -279,7 +279,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedLockResponse _clone = new GridDistributedLockResponse(); clone0(_clone); @@ -288,7 +288,7 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedLockResponse _clone = (GridDistributedLockResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java index 15d61a3..9a93a5e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -22,11 +22,11 @@ import org.apache.ignite.internal.*; 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.direct.*; 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 java.io.*; @@ -346,7 +346,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedTxFinishRequest _clone = new GridDistributedTxFinishRequest(); clone0(_clone); @@ -355,7 +355,7 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedTxFinishRequest _clone = (GridDistributedTxFinishRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java index 557ed88..b94daa6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal.processors.cache.distributed; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -76,7 +76,7 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridCacheMessage extends GridDistributedBaseMe /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedTxPrepareRequest _clone = new GridDistributedTxPrepareRequest(); clone0(_clone); @@ -413,7 +413,7 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedTxPrepareRequest _clone = (GridDistributedTxPrepareRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index d7d2ce8..057916c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -21,9 +21,9 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -151,7 +151,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedTxPrepareResponse _clone = new GridDistributedTxPrepareResponse(); clone0(_clone); @@ -160,7 +160,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedTxPrepareResponse _clone = (GridDistributedTxPrepareResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java index fc5cce2..d865208 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -20,9 +20,9 @@ package org.apache.ignite.internal.processors.cache.distributed; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -117,7 +117,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDistributedUnlockRequest _clone = new GridDistributedUnlockRequest(); clone0(_clone); @@ -126,7 +126,7 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDistributedUnlockRequest _clone = (GridDistributedUnlockRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index 0e101c2..1ba3753 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; @@ -68,7 +68,7 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtLockRequest _clone = new GridDhtLockRequest(); clone0(_clone); @@ -354,7 +354,7 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtLockRequest _clone = (GridDhtLockRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index 4894af0..eea4b85 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -24,10 +24,10 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -201,7 +201,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtLockResponse _clone = new GridDhtLockResponse(); clone0(_clone); @@ -210,7 +210,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtLockResponse _clone = (GridDhtLockResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 25ad224..1a53250 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -24,10 +24,10 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; @@ -351,7 +351,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtTxFinishRequest _clone = new GridDhtTxFinishRequest(); clone0(_clone); @@ -360,7 +360,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtTxFinishRequest _clone = (GridDhtTxFinishRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index 88bc14a..590f06a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal.processors.cache.distributed.dht; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -70,7 +70,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtTxFinishResponse _clone = new GridDhtTxFinishResponse(); clone0(_clone); @@ -79,7 +79,7 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtTxFinishResponse _clone = (GridDhtTxFinishResponse)_msg; 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 7e7ef66..47c2a48 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 @@ -24,10 +24,10 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.io.*; @@ -316,7 +316,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtTxPrepareRequest _clone = new GridDhtTxPrepareRequest(); clone0(_clone); @@ -325,7 +325,7 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtTxPrepareRequest _clone = (GridDhtTxPrepareRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index 7ce598a..51d179f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -23,10 +23,10 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -207,7 +207,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtTxPrepareResponse _clone = new GridDhtTxPrepareResponse(); clone0(_clone); @@ -216,7 +216,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtTxPrepareResponse _clone = (GridDhtTxPrepareResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 189cfaf..19a9dce 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -21,8 +21,8 @@ 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.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -105,7 +105,7 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage< /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtAtomicDeferredUpdateResponse _clone = new GridDhtAtomicDeferredUpdateResponse(); clone0(_clone); @@ -83,7 +83,7 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtAtomicDeferredUpdateResponse _clone = (GridDhtAtomicDeferredUpdateResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 709b681..8d4d36e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -23,9 +23,9 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import javax.cache.processor.*; @@ -689,7 +689,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtAtomicUpdateRequest _clone = new GridDhtAtomicUpdateRequest(); clone0(_clone); @@ -698,7 +698,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtAtomicUpdateRequest _clone = (GridDhtAtomicUpdateRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 1747f2f..41a48a1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -21,9 +21,9 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -180,7 +180,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtAtomicUpdateResponse _clone = new GridDhtAtomicUpdateResponse(); clone0(_clone); @@ -189,7 +189,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtAtomicUpdateResponse _clone = (GridDhtAtomicUpdateResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 050cb35..2726a6d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -24,10 +24,10 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; 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.expiry.*; @@ -546,7 +546,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearAtomicUpdateRequest _clone = new GridNearAtomicUpdateRequest(); clone0(_clone); @@ -555,7 +555,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearAtomicUpdateRequest _clone = (GridNearAtomicUpdateRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 2280943..fdfde26 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -22,9 +22,9 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -423,7 +423,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearAtomicUpdateResponse _clone = new GridNearAtomicUpdateResponse(); clone0(_clone); @@ -432,7 +432,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearAtomicUpdateResponse _clone = (GridNearAtomicUpdateResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 176086e..66a6ad1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -20,11 +20,11 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; import java.nio.*; @@ -163,7 +163,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtForceKeysRequest _clone = new GridDhtForceKeysRequest(); clone0(_clone); @@ -172,7 +172,7 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtForceKeysRequest _clone = (GridDhtForceKeysRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index dfe30f7..626cb1f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -20,10 +20,10 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -166,7 +166,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtForceKeysResponse _clone = new GridDhtForceKeysResponse(); clone0(_clone); @@ -175,7 +175,7 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtForceKeysResponse _clone = (GridDhtForceKeysResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index 130aca9..59eb2bd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -20,9 +20,9 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -191,7 +191,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtPartitionDemandMessage _clone = new GridDhtPartitionDemandMessage(); clone0(_clone); @@ -200,7 +200,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtPartitionDemandMessage _clone = (GridDhtPartitionDemandMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java index d64a686..dc9d26c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java @@ -19,8 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; +import java.nio.*; import java.util.*; import static org.apache.ignite.events.EventType.*; @@ -28,7 +30,8 @@ import static org.apache.ignite.events.EventType.*; /** * Exchange ID. */ -public class GridDhtPartitionExchangeId implements Comparable, Externalizable { +public class GridDhtPartitionExchangeId extends MessageAdapter implements Comparable, + Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -143,6 +146,31 @@ public class GridDhtPartitionExchangeId implements Comparable extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtPartitionSupplyMessage _clone = new GridDhtPartitionSupplyMessage(); clone0(_clone); @@ -283,7 +283,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtPartitionSupplyMessage _clone = (GridDhtPartitionSupplyMessage)_msg; 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 1eb069e..b8905f9c 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 @@ -19,8 +19,8 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -75,7 +75,7 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtPartitionsFullMessage _clone = new GridDhtPartitionsFullMessage(); clone0(_clone); @@ -153,7 +153,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtPartitionsFullMessage _clone = (GridDhtPartitionsFullMessage)_msg; 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 57888bc..94efd43 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 @@ -21,9 +21,9 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -96,7 +96,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtPartitionsSingleMessage _clone = new GridDhtPartitionsSingleMessage(); clone0(_clone); @@ -105,7 +105,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridDhtPartitionsSingleMessage _clone = (GridDhtPartitionsSingleMessage)_msg; 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 9cbd7d4..d7a091b 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 @@ -17,8 +17,8 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -46,7 +46,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDhtPartitionsSingleRequest _clone = new GridDhtPartitionsSingleRequest(); clone0(_clone); @@ -55,7 +55,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); } 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 54315c0..c99a65e 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 @@ -22,11 +22,11 @@ import org.apache.ignite.cache.*; 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.direct.*; 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 java.io.*; import java.nio.*; @@ -251,7 +251,7 @@ public class GridNearGetRequest extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearGetRequest _clone = new GridNearGetRequest(); clone0(_clone); @@ -260,7 +260,7 @@ public class GridNearGetRequest extends GridCacheMessage implements } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearGetRequest _clone = (GridNearGetRequest)_msg; 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 d712db7..cc2a48a 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 @@ -22,10 +22,10 @@ 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.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -201,7 +201,7 @@ public class GridNearGetResponse extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearGetResponse _clone = new GridNearGetResponse(); clone0(_clone); @@ -210,7 +210,7 @@ public class GridNearGetResponse extends GridCacheMessage implements } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearGetResponse _clone = (GridNearGetResponse)_msg; 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 8d20405..d6455dd 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 @@ -24,10 +24,10 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; @@ -335,7 +335,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearLockRequest _clone = new GridNearLockRequest(); clone0(_clone); @@ -344,7 +344,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearLockRequest _clone = (GridNearLockRequest)_msg; 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 2343255..9a62b02 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 @@ -22,10 +22,10 @@ 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.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.io.*; @@ -182,7 +182,7 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse extends GridDistributedTxFinishReques /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearTxFinishRequest _clone = new GridNearTxFinishRequest(); clone0(_clone); @@ -171,7 +171,7 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearTxFinishRequest _clone = (GridNearTxFinishRequest)_msg; 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 d855665..5532b88 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 @@ -22,9 +22,9 @@ 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.direct.*; 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 java.io.*; @@ -115,7 +115,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearTxFinishResponse _clone = new GridNearTxFinishResponse(); clone0(_clone); @@ -124,7 +124,7 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearTxFinishResponse _clone = (GridNearTxFinishResponse)_msg; 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 9c6135a..f0ffa4e 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 @@ -21,10 +21,10 @@ 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.transactions.*; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; @@ -219,7 +219,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearTxPrepareRequest _clone = new GridNearTxPrepareRequest(); clone0(_clone); @@ -228,7 +228,7 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearTxPrepareRequest _clone = (GridNearTxPrepareRequest)_msg; 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 9a5d0fb..f6e6975 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,12 +23,12 @@ 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.direct.*; 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 java.io.*; import java.nio.*; @@ -225,7 +225,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridNearTxPrepareResponse _clone = new GridNearTxPrepareResponse(); clone0(_clone); @@ -234,7 +234,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridNearTxPrepareResponse _clone = (GridNearTxPrepareResponse)_msg; 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 8df4302..86f839b 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 @@ -18,8 +18,8 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import org.apache.ignite.internal.processors.cache.distributed.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -48,7 +48,7 @@ public class GridNearUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage implemen /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheQueryRequest _clone = new GridCacheQueryRequest(); clone0(_clone); @@ -454,7 +454,7 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheQueryRequest _clone = (GridCacheQueryRequest)_msg; 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 96d0258..fe18c8c 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 @@ -21,10 +21,10 @@ import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.query.*; -import org.apache.ignite.internal.util.direct.*; 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.jetbrains.annotations.*; import java.io.*; @@ -203,7 +203,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridCacheQueryResponse _clone = new GridCacheQueryResponse(); clone0(_clone); @@ -212,7 +212,7 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridCacheQueryResponse _clone = (GridCacheQueryResponse)_msg; 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 891af09..15e84ac 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 @@ -20,15 +20,18 @@ package org.apache.ignite.internal.processors.cache.version; 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 java.io.*; +import java.nio.*; import java.util.*; /** * Grid unique version. */ -public class GridCacheVersion implements Comparable, Externalizable, OptimizedMarshallable { +public class GridCacheVersion extends MessageAdapter implements Comparable, Externalizable, + OptimizedMarshallable { /** */ private static final long serialVersionUID = 0L; @@ -250,6 +253,31 @@ public class GridCacheVersion implements Comparable, Externali } /** {@inheritDoc} */ + @Override public boolean writeTo(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 0; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public MessageAdapter clone() { + return null; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override protected void clone0(MessageAdapter _msg) { + // TODO: implement. + } + + /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCacheVersion.class, this); } 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 a779c23..dd576e3 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 @@ -18,9 +18,9 @@ package org.apache.ignite.internal.processors.clock; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -29,7 +29,7 @@ import java.util.*; /** * Message containing time delta map for all nodes. */ -public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAdapter { +public class GridClockDeltaSnapshotMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -73,7 +73,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridClockDeltaSnapshotMessage _clone = new GridClockDeltaSnapshotMessage(); clone0(_clone); @@ -82,7 +82,7 @@ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAd } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridClockDeltaSnapshotMessage _clone = (GridClockDeltaSnapshotMessage)_msg; _clone.snapVer = snapVer; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java index aa03c88..852f9f0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java @@ -18,13 +18,15 @@ package org.apache.ignite.internal.processors.clock; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; +import java.nio.*; /** * Version for time delta snapshot. */ -public class GridClockDeltaVersion implements Comparable, Externalizable { +public class GridClockDeltaVersion extends MessageAdapter implements Comparable, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -111,6 +113,31 @@ public class GridClockDeltaVersion implements Comparable, } /** {@inheritDoc} */ + @Override public boolean writeTo(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 0; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public MessageAdapter clone() { + return null; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override protected void clone0(MessageAdapter _msg) { + // TODO: implement. + } + + /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridClockDeltaVersion.class, this); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java index 3c39742..a6a62d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.processors.continuous; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.io.*; @@ -33,7 +33,7 @@ import static org.apache.ignite.internal.processors.continuous.GridContinuousMes /** * Continuous processor message. */ -public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { +public class GridContinuousMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -132,7 +132,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridContinuousMessage _clone = new GridContinuousMessage(); clone0(_clone); @@ -141,7 +141,7 @@ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridContinuousMessage _clone = (GridContinuousMessage)_msg; _clone.type = type; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java index 2b89fea..4690f82 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java @@ -19,10 +19,10 @@ package org.apache.ignite.internal.processors.dataload; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.nio.*; @@ -31,7 +31,7 @@ import java.util.*; /** * */ -public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { +public class GridDataLoadRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -506,7 +506,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDataLoadRequest _clone = new GridDataLoadRequest(); clone0(_clone); @@ -515,7 +515,7 @@ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridDataLoadRequest _clone = (GridDataLoadRequest)_msg; _clone.reqId = reqId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java index faff1d7..2b8c0ee 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java @@ -17,15 +17,15 @@ package org.apache.ignite.internal.processors.dataload; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; /** * */ -public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { +public class GridDataLoadResponse extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -84,7 +84,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridDataLoadResponse _clone = new GridDataLoadResponse(); clone0(_clone); @@ -93,7 +93,7 @@ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridDataLoadResponse _clone = (GridDataLoadResponse)_msg; _clone.reqId = reqId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java index e5c91de..496a114 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -104,7 +104,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsAckMessage _clone = new GridGgfsAckMessage(); clone0(_clone); @@ -113,7 +113,7 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsAckMessage _clone = (GridGgfsAckMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java index 5530db0..bbcbf42 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.internal.processors.task.*; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; @@ -31,7 +31,7 @@ import java.nio.*; * File's binary data block key. */ @GridInternal -public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter +public final class GridGgfsBlockKey extends MessageAdapter implements Externalizable, Comparable { /** */ private static final long serialVersionUID = 0L; @@ -160,7 +160,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsBlockKey _clone = new GridGgfsBlockKey(); clone0(_clone); @@ -169,7 +169,7 @@ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridGgfsBlockKey _clone = (GridGgfsBlockKey)_msg; _clone.fileId = fileId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java index 92dcad1..6321042 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -85,7 +85,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsBlocksMessage _clone = new GridGgfsBlocksMessage(); clone0(_clone); @@ -94,7 +94,7 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsBlocksMessage _clone = (GridGgfsBlocksMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java index d60a3a1..b08d64a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.nio.*; @@ -27,12 +27,12 @@ import java.nio.*; /** * Base class for all GGFS communication messages sent between nodes. */ -public abstract class GridGgfsCommunicationMessage extends GridTcpCommunicationMessageAdapter { +public abstract class GridGgfsCommunicationMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java index e6e2c60..6be821a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java @@ -19,10 +19,10 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -108,7 +108,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsDeleteMessage _clone = new GridGgfsDeleteMessage(); clone0(_clone); @@ -117,7 +117,7 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsDeleteMessage _clone = (GridGgfsDeleteMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java index a522e6f..04c822e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java @@ -17,10 +17,10 @@ package org.apache.ignite.internal.processors.fs; -import org.apache.ignite.internal.util.direct.*; 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 java.io.*; @@ -30,7 +30,7 @@ import java.util.*; /** * Affinity range. */ -public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapter implements Externalizable { +public class GridGgfsFileAffinityRange extends MessageAdapter implements Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -264,7 +264,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsFileAffinityRange _clone = new GridGgfsFileAffinityRange(); clone0(_clone); @@ -273,7 +273,7 @@ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapte } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridGgfsFileAffinityRange _clone = (GridGgfsFileAffinityRange)_msg; _clone.affKey = affKey; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java index ec89347..3ecac2f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -80,7 +80,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsFragmentizerRequest _clone = new GridGgfsFragmentizerRequest(); clone0(_clone); @@ -89,7 +89,7 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsFragmentizerRequest _clone = (GridGgfsFragmentizerRequest)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java index af5a27c..a842e9c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java @@ -17,8 +17,8 @@ package org.apache.ignite.internal.processors.fs; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -56,7 +56,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsFragmentizerResponse _clone = new GridGgfsFragmentizerResponse(); clone0(_clone); @@ -65,7 +65,7 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsFragmentizerResponse _clone = (GridGgfsFragmentizerResponse)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java index 8251242..a632e02 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java @@ -17,8 +17,8 @@ package org.apache.ignite.internal.processors.fs; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -73,7 +73,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridGgfsSyncMessage _clone = new GridGgfsSyncMessage(); clone0(_clone); @@ -82,7 +82,7 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { super.clone0(_msg); GridGgfsSyncMessage _clone = (GridGgfsSyncMessage)_msg; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java index 7265a04..9920d99 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/IgniteFsProcessor.java @@ -26,13 +26,14 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.ignitefs.*; import org.apache.ignite.ignitefs.mapreduce.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.license.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.ipc.*; 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.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -83,7 +84,7 @@ public class IgniteFsProcessor extends IgniteFsProcessorAdapter { // Register GGFS messages. GridTcpCommunicationMessageFactory.registerCommon(new GridTcpCommunicationMessageProducer() { @Override - public GridTcpCommunicationMessageAdapter create(byte type) { + public MessageAdapter create(byte type) { switch (type) { case 64: return new GridGgfsAckMessage(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index b7b986f..6223639 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -17,16 +17,16 @@ package org.apache.ignite.internal.processors.rest.client.message; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.grid.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; /** * Client handshake wrapper for direct marshalling. */ -public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessageAdapter { +public class GridClientHandshakeRequestWrapper extends MessageAdapter { /** */ private static final long serialVersionUID = -5705048094821942662L; @@ -34,7 +34,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa public static final byte HANDSHAKE_HEADER = (byte)0x91; /** Stream. */ - private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + private final DirectByteBufferStream stream = new DirectByteBufferStream(null); /** Handshake bytes. */ private byte[] bytes; @@ -95,7 +95,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridClientHandshakeRequestWrapper _clone = new GridClientHandshakeRequestWrapper(); clone0(_clone); @@ -104,7 +104,7 @@ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessa } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridClientHandshakeRequestWrapper _clone = (GridClientHandshakeRequestWrapper)_msg; _clone.bytes = bytes; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index 7ce67b4..57f2bd1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -17,15 +17,15 @@ package org.apache.ignite.internal.processors.rest.client.message; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; /** * Client handshake wrapper for direct marshalling. */ -public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMessageAdapter { +public class GridClientHandshakeResponseWrapper extends MessageAdapter { /** */ private static final long serialVersionUID = -1529807975073967381L; @@ -72,7 +72,7 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridClientHandshakeResponseWrapper _clone = new GridClientHandshakeResponseWrapper(); clone0(_clone); @@ -81,7 +81,7 @@ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMess } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridClientHandshakeResponseWrapper _clone = (GridClientHandshakeResponseWrapper)_msg; _clone.code = code; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java index fe32468..4d40c3e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal.processors.rest.client.message; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.gridgain.grid.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; import java.util.*; @@ -27,7 +27,7 @@ import java.util.*; /** * Client message wrapper for direct marshalling. */ -public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter { +public class GridClientMessageWrapper extends MessageAdapter { /** */ private static final long serialVersionUID = 5284375300887454697L; @@ -35,7 +35,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter public static final byte REQ_HEADER = (byte)0x90; /** Stream. */ - private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + private final DirectByteBufferStream stream = new DirectByteBufferStream(null); /** */ private int msgSize; @@ -249,7 +249,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridClientMessageWrapper _clone = new GridClientMessageWrapper(); clone0(_clone); @@ -258,7 +258,7 @@ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridClientMessageWrapper _clone = (GridClientMessageWrapper)_msg; _clone.reqId = reqId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java index 6591bd1..be95367 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -17,15 +17,15 @@ package org.apache.ignite.internal.processors.rest.client.message; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; /** * Ping packet wrapper for direct marshalling. */ -public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdapter { +public class GridClientPingPacketWrapper extends MessageAdapter { /** */ private static final long serialVersionUID = -3956036611004055629L; @@ -67,7 +67,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridClientPingPacketWrapper _clone = new GridClientPingPacketWrapper(); clone0(_clone); @@ -76,7 +76,7 @@ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdap } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridClientPingPacketWrapper _clone = (GridClientPingPacketWrapper)_msg; _clone.size = size; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java index e78c5fe..8df3008 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.processors.rest.handlers.task; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * Task result request. */ -public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { +public class GridTaskResultRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -100,7 +100,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridTaskResultRequest _clone = new GridTaskResultRequest(); clone0(_clone); @@ -109,7 +109,7 @@ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridTaskResultRequest _clone = (GridTaskResultRequest)_msg; _clone.taskId = taskId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java index caa42dd..6808f1a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.processors.rest.handlers.task; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.nio.*; @@ -26,7 +26,7 @@ import java.nio.*; /** * Task result response. */ -public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { +public class GridTaskResultResponse extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -118,7 +118,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridTaskResultResponse _clone = new GridTaskResultResponse(); clone0(_clone); @@ -127,7 +127,7 @@ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridTaskResultResponse _clone = (GridTaskResultResponse)_msg; _clone.res = res; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index 2d0d82f..ae0d638 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -18,11 +18,11 @@ package org.apache.ignite.internal.processors.rest.protocols.tcp; import org.apache.ignite.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.marshaller.*; -import org.gridgain.grid.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -34,7 +34,7 @@ import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemca /** * Memcached message wrapper for direct marshalling. */ -public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdapter { +public class GridMemcachedMessageWrapper extends MessageAdapter { /** */ private static final long serialVersionUID = 3053626103006980626L; @@ -42,7 +42,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap private static final Charset UTF_8 = Charset.forName("UTF-8"); /** Stream. */ - private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); + private final DirectByteBufferStream stream = new DirectByteBufferStream(null); /** * Memcached message bytes. @@ -95,7 +95,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridMemcachedMessageWrapper _clone = new GridMemcachedMessageWrapper(); clone0(_clone); @@ -104,7 +104,7 @@ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdap } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridMemcachedMessageWrapper _clone = (GridMemcachedMessageWrapper)_msg; _clone.bytes = bytes; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java index 1fc7a0d..b743e66 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java @@ -19,12 +19,11 @@ package org.apache.ignite.internal.processors.rest.protocols.tcp; import org.apache.ignite.*; import org.apache.ignite.client.marshaller.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.processors.rest.client.message.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.plugin.extensions.communication.*; -import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import java.io.*; @@ -46,7 +45,7 @@ public class GridTcpRestDirectParser implements GridNioParser { private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); /** Message reader. */ - private final MessageReader rdr = new GridTcpCommunicationMessageReader(null); + private final MessageReader rdr = new DirectMessageReader(null); /** Protocol handler. */ private final GridTcpRestProtocol proto; @@ -74,7 +73,7 @@ public class GridTcpRestDirectParser implements GridNioParser { return memcacheMsg; } - GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY); + MessageAdapter msg = ses.removeMeta(MSG_META_KEY); if (msg == null && buf.hasRemaining()) { byte type = buf.get(buf.position()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java index e256dd0..aba17f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java @@ -17,8 +17,8 @@ package org.apache.ignite.internal.processors.streamer; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -26,7 +26,7 @@ import java.nio.*; /** * Streamer cancel request. */ -public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapter { +public class GridStreamerCancelRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -56,7 +56,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridStreamerCancelRequest _clone = new GridStreamerCancelRequest(); clone0(_clone); @@ -65,7 +65,7 @@ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapte } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridStreamerCancelRequest _clone = (GridStreamerCancelRequest)_msg; _clone.cancelledFutId = cancelledFutId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java index d81b46d..e10ef04 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java @@ -19,10 +19,10 @@ package org.apache.ignite.internal.processors.streamer; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.tostring.*; 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 java.nio.*; @@ -31,7 +31,7 @@ import java.util.*; /** * */ -public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAdapter { +public class GridStreamerExecutionRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -151,7 +151,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridStreamerExecutionRequest _clone = new GridStreamerExecutionRequest(); clone0(_clone); @@ -160,7 +160,7 @@ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAda } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridStreamerExecutionRequest _clone = (GridStreamerExecutionRequest)_msg; _clone.forceLocDep = forceLocDep; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java index 9b1ef21..a9c05c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java @@ -17,9 +17,9 @@ package org.apache.ignite.internal.processors.streamer; -import org.apache.ignite.internal.util.direct.*; 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 java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * */ -public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { +public class GridStreamerResponse extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -76,7 +76,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridStreamerResponse _clone = new GridStreamerResponse(); clone0(_clone); @@ -85,7 +85,7 @@ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridStreamerResponse _clone = (GridStreamerResponse)_msg; _clone.futId = futId; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java index 0af18a1..7ca3f9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; @@ -33,6 +32,7 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.streamer.*; import org.apache.ignite.streamer.router.*; import org.apache.ignite.thread.*; @@ -1037,7 +1037,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { * @return Execution request. * @throws IgniteCheckedException If failed. */ - private GridTcpCommunicationMessageAdapter createExecutionRequest(GridStreamerExecutionBatch batch) + private MessageAdapter createExecutionRequest(GridStreamerExecutionBatch batch) throws IgniteCheckedException { boolean depEnabled = ctx.deploy().enabled(); @@ -1111,7 +1111,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { * @param msg Message to send. * @throws IgniteCheckedException If failed. */ - private void sendWithRetries(UUID dstNodeId, GridTcpCommunicationMessageAdapter msg) throws IgniteCheckedException { + private void sendWithRetries(UUID dstNodeId, MessageAdapter msg) throws IgniteCheckedException { for (int i = 0; i < SEND_RETRY_COUNT; i++) { try { ctx.io().send(dstNodeId, topic, msg, GridIoPolicy.SYSTEM_POOL); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java index ef7a4df..9895f43 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.processors.version; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import java.nio.*; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index f4b7ca3..a35a357 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -31,12 +31,11 @@ import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.mxbean.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.portables.*; import org.apache.ignite.spi.*; -import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.processors.streamer.*; import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.io.*; @@ -44,10 +43,6 @@ import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.lifecycle.*; -import org.apache.ignite.portables.*; -import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.transactions.*; import org.jdk8.backport.*; @@ -9231,12 +9226,11 @@ public abstract class IgniteUtils { * * @param msg Message. * @param out Stream to write to. - * @param buf Byte buffer that will be passed to {@link GridTcpCommunicationMessageAdapter#writeTo(ByteBuffer)} - * method. + * @param buf Byte buffer that will be passed to {@link MessageAdapter#writeTo(ByteBuffer)} method. * @return Number of written bytes. * @throws IOException In case of error. */ - public static int writeMessageFully(GridTcpCommunicationMessageAdapter msg, OutputStream out, ByteBuffer buf) + public static int writeMessageFully(MessageAdapter msg, OutputStream out, ByteBuffer buf) throws IOException { assert msg != null; assert out != null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java deleted file mode 100644 index e414f55..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java +++ /dev/null @@ -1,116 +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.util.direct; - -import org.apache.ignite.plugin.extensions.communication.*; - -import java.io.*; -import java.nio.*; -import java.util.*; - -/** - * Communication message adapter. - */ -public abstract class GridTcpCommunicationMessageAdapter implements Serializable, Cloneable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - protected static final Object NULL = new Object(); - - /** */ - protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); - - /** - * @param writer Writer. - */ - public final void setWriter(MessageWriter writer) { - assert writer != null; - - commState.setWriter(writer); - } - - /** - * @param reader Reader. - */ - public final void setReader(MessageReader reader) { - assert reader != null; - - commState.setReader(reader); - } - - /** - * @param buf Byte buffer. - * @return Whether message was fully written. - */ - public abstract boolean writeTo(ByteBuffer buf); - - /** - * @param buf Byte buffer. - * @return Whether message was fully read. - */ - public abstract boolean readFrom(ByteBuffer buf); - - /** - * @return Message type. - */ - public abstract byte directType(); - - /** {@inheritDoc} */ - @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") - @Override public abstract GridTcpCommunicationMessageAdapter clone(); - - /** - * Clones all fields of the provided message to {@code this}. - * - * @param _msg Message to clone from. - */ - protected abstract void clone0(GridTcpCommunicationMessageAdapter _msg); - - /** - * @return {@code True} if should skip recovery for this message. - */ - public boolean skipRecovery() { - return false; - } - - /** - * @param arr Array. - * @return Array iterator. - */ - protected final Iterator arrayIterator(final Object[] arr) { - return new Iterator() { - private int idx; - - @Override public boolean hasNext() { - return idx < arr.length; - } - - @Override public Object next() { - if (!hasNext()) - throw new NoSuchElementException(); - - return arr[idx++]; - } - - @Override public void remove() { - throw new UnsupportedOperationException(); - } - }; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java deleted file mode 100644 index ddcbddd..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java +++ /dev/null @@ -1,375 +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.util.direct; - -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.managers.checkpoint.*; -import org.apache.ignite.internal.managers.communication.*; -import org.apache.ignite.internal.managers.deployment.*; -import org.apache.ignite.internal.managers.eventstorage.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.processors.cache.query.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.processors.continuous.*; -import org.apache.ignite.internal.processors.dataload.*; -import org.apache.ignite.internal.processors.rest.client.message.*; -import org.apache.ignite.internal.processors.rest.handlers.task.*; -import org.apache.ignite.internal.processors.rest.protocols.tcp.*; -import org.apache.ignite.internal.processors.streamer.*; -import org.apache.ignite.spi.collision.jobstealing.*; -import org.apache.ignite.spi.communication.tcp.*; -import org.jdk8.backport.*; - -import java.util.*; - -/** - * Communication message factory. - */ -public class GridTcpCommunicationMessageFactory { - /** Common message producers. */ - private static final GridTcpCommunicationMessageProducer[] COMMON = new GridTcpCommunicationMessageProducer[83]; - - /** - * Custom messages registry. Used for test purposes. - */ - private static final Map CUSTOM = new ConcurrentHashMap8<>(); - - /** */ - public static final int MAX_COMMON_TYPE = 82; - - static { - registerCommon(new GridTcpCommunicationMessageProducer() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { - switch (type) { - case 0: - return new GridJobCancelRequest(); - - case 1: - return new GridJobExecuteRequest(); - - case 2: - return new GridJobExecuteResponse(); - - case 3: - return new GridJobSiblingsRequest(); - - case 4: - return new GridJobSiblingsResponse(); - - case 5: - return new GridTaskCancelRequest(); - - case 6: - return new GridTaskSessionRequest(); - - case 7: - return new GridCheckpointRequest(); - - case 8: - return new GridIoMessage(); - - case 9: - return new GridIoUserMessage(); - - case 10: - return new GridDeploymentInfoBean(); - - case 11: - return new GridDeploymentRequest(); - - case 12: - return new GridDeploymentResponse(); - - case 13: - return new GridEventStorageMessage(); - - case 14: - return new GridCacheEvictionRequest(); - - case 15: - return new GridCacheEvictionResponse(); - - case 16: - return new GridCacheOptimisticCheckPreparedTxRequest(); - - case 17: - return new GridCacheOptimisticCheckPreparedTxResponse(); - - case 18: - return new GridCachePessimisticCheckCommittedTxRequest(); - - case 19: - return new GridCachePessimisticCheckCommittedTxResponse(); - - case 20: - return new GridCacheTtlUpdateRequest(); - - case 21: - return new GridDistributedLockRequest(); - - case 22: - return new GridDistributedLockResponse(); - - case 23: - return new GridDistributedTxFinishRequest(); - - case 24: - return new GridDistributedTxFinishResponse(); - - case 25: - return new GridDistributedTxPrepareRequest(); - - case 26: - return new GridDistributedTxPrepareResponse(); - - case 27: - return new GridDistributedUnlockRequest(); - - case 28: - return new GridDhtAffinityAssignmentRequest(); - - case 29: - return new GridDhtAffinityAssignmentResponse(); - - case 30: - return new GridDhtLockRequest(); - - case 31: - return new GridDhtLockResponse(); - - case 32: - return new GridDhtTxFinishRequest(); - - case 33: - return new GridDhtTxFinishResponse(); - - case 34: - return new GridDhtTxPrepareRequest(); - - case 35: - return new GridDhtTxPrepareResponse(); - - case 36: - return new GridDhtUnlockRequest(); - - case 37: - return new GridDhtAtomicDeferredUpdateResponse(); - - case 38: - return new GridDhtAtomicUpdateRequest(); - - case 39: - return new GridDhtAtomicUpdateResponse(); - - case 40: - return new GridNearAtomicUpdateRequest(); - - case 41: - return new GridNearAtomicUpdateResponse(); - - case 42: - return new GridDhtForceKeysRequest(); - - case 43: - return new GridDhtForceKeysResponse(); - - case 44: - return new GridDhtPartitionDemandMessage(); - - case 45: - return new GridDhtPartitionSupplyMessage(); - - case 46: - return new GridDhtPartitionsFullMessage(); - - case 47: - return new GridDhtPartitionsSingleMessage(); - - case 48: - return new GridDhtPartitionsSingleRequest(); - - case 49: - return new GridNearGetRequest(); - - case 50: - return new GridNearGetResponse(); - - case 51: - return new GridNearLockRequest(); - - case 52: - return new GridNearLockResponse(); - - case 53: - return new GridNearTxFinishRequest(); - - case 54: - return new GridNearTxFinishResponse(); - - case 55: - return new GridNearTxPrepareRequest(); - - case 56: - return new GridNearTxPrepareResponse(); - - case 57: - return new GridNearUnlockRequest(); - - case 58: - return new GridCacheQueryRequest(); - - case 59: - return new GridCacheQueryResponse(); - - case 60: - return new GridClockDeltaSnapshotMessage(); - - case 61: - return new GridContinuousMessage(); - - case 62: - return new GridDataLoadRequest(); - - case 63: - return new GridDataLoadResponse(); - - // 64-71: IgniteFS messages. - - case 72: - return new GridClientHandshakeRequestWrapper(); - - case 73: - return new GridClientHandshakeResponseWrapper(); - - case 74: - return new GridClientMessageWrapper(); - - case 75: - return new GridClientPingPacketWrapper(); - - case 76: - return new GridTaskResultRequest(); - - case 77: - return new GridTaskResultResponse(); - - case 78: - return new GridMemcachedMessageWrapper(); - - case 79: - return new GridStreamerCancelRequest(); - - case 80: - return new GridStreamerExecutionRequest(); - - case 81: - return new GridStreamerResponse(); - - case 82: - return new JobStealingRequest(); - - default: - assert false : "Invalid message type."; - - return null; - } - } - }, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, /* 64-71: IgniteFS messages. */ 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82); - } - - /** - * @param type Message type. - * @return New message. - */ - public static GridTcpCommunicationMessageAdapter create(byte type) { - if (type == TcpCommunicationSpi.NODE_ID_MSG_TYPE) - return new TcpCommunicationSpi.NodeIdMessage(); - else if (type == TcpCommunicationSpi.RECOVERY_LAST_ID_MSG_TYPE) - return new TcpCommunicationSpi.RecoveryLastReceivedMessage(); - else if (type == TcpCommunicationSpi.HANDSHAKE_MSG_TYPE) - return new TcpCommunicationSpi.HandshakeMessage(); - else - return create0(type); - } - - /** - * @param type Message type. - * @return New message. - */ - private static GridTcpCommunicationMessageAdapter create0(byte type) { - if (type >= 0 && type < COMMON.length) { - GridTcpCommunicationMessageProducer producer = COMMON[type]; - - if (producer != null) - return producer.create(type); - else - throw new IllegalStateException("Common message type producer is not registered: " + type); - } - else { - GridTcpCommunicationMessageProducer c = CUSTOM.get(type); - - if (c != null) - return c.create(type); - else - throw new IllegalStateException("Custom message type producer is not registered: " + type); - } - } - - /** - * Register message producer for common message type. - * - * @param producer Producer. - * @param types Types applicable for this producer. - */ - public static void registerCommon(GridTcpCommunicationMessageProducer producer, int... types) { - for (int type : types) { - assert type >= 0 && type < COMMON.length : "Common type being registered is out of common messages " + - "array length: " + type; - - COMMON[type] = producer; - } - } - - /** - * Registers factory for custom message. Used for test purposes. - * - * @param producer Message producer. - * @param type Message type. - */ - public static void registerCustom(GridTcpCommunicationMessageProducer producer, byte type) { - assert producer != null; - - CUSTOM.put(type, producer); - } - - /** - * @return Common message producers. - */ - public static GridTcpCommunicationMessageProducer[] commonProducers() { - return COMMON; - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageProducer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageProducer.java deleted file mode 100644 index a856603..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageProducer.java +++ /dev/null @@ -1,31 +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.util.direct; - -/** - * Message producer. Each component have to register it's own message producer. - */ -public interface GridTcpCommunicationMessageProducer { - /** - * Create message. - * - * @param type Message type. - * @return Communication message. - */ - public GridTcpCommunicationMessageAdapter create(byte type); -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java deleted file mode 100644 index 66a8394..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java +++ /dev/null @@ -1,774 +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.util.direct; - -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.gridgain.grid.util.direct.*; -import org.jetbrains.annotations.*; -import sun.misc.*; - -import java.nio.*; -import java.util.*; - -import static org.apache.ignite.internal.util.direct.GridTcpCommunicationMessageAdapter.*; - -/** - * Communication message state. - */ -@SuppressWarnings("PublicField") -public class GridTcpCommunicationMessageState { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** */ - private final MessageWriter writer = new GridTcpCommunicationMessageWriter(); - - /** */ - private MessageReader reader; - - /** */ - public int idx; - - /** */ - public boolean typeWritten; - - /** */ - public Iterator it; - - /** */ - public Object cur = NULL; - - /** */ - public boolean keyDone; - - /** */ - public int readSize = -1; - - /** */ - public int readItems; - - /** - * @param writer Writer. - */ - public final void setWriter(MessageWriter writer) { -// if (this.writer == null) -// this.writer = writer; - } - - /** - * @param reader Reader. - */ - public final void setReader(MessageReader reader) { - if (this.reader == null) - this.reader = reader; - } - - /** - * @param buf Buffer. - */ - public final void setBuffer(ByteBuffer buf) { - if (writer != null) - writer.setBuffer(buf); - - if (reader != null) - reader.setBuffer(buf); - } - - /** - * @param name Field name. - * @param b Byte value. - * @return Whether value was written. - */ - public final boolean putByte(String name, byte b) { - return writer.writeByte(name, b); - } - - /** - * @param name Field name. - * @return Byte value. - */ - public final byte getByte(String name) { - return reader.readByte(name); - } - - /** - * @param name Field name. - * @param s Short value. - * @return Whether value was written. - */ - public final boolean putShort(String name, short s) { - return writer.writeShort(name, s); - } - - /** - * @param name Field name. - * @return Short value. - */ - public final short getShort(String name) { - return reader.readShort(name); - } - - /** - * @param name Field name. - * @param i Integer value. - * @return Whether value was written. - */ - public final boolean putInt(String name, int i) { - return writer.writeInt(name, i); - } - - /** - * @param name Field name. - * @return Integer value. - */ - public final int getInt(String name) { - return reader.readInt(name); - } - - /** - * @param name Field name. - * @param l Long value. - * @return Whether value was written. - */ - public final boolean putLong(String name, long l) { - return writer.writeLong(name, l); - } - - /** - * @param name Field name. - * @return Long value. - */ - public final long getLong(String name) { - return reader.readLong(name); - } - - /** - * @param name Field name. - * @param f Float value. - * @return Whether value was written. - */ - public final boolean putFloat(String name, float f) { - return writer.writeFloat(name, f); - } - - /** - * @param name Field name. - * @return Float value. - */ - public final float getFloat(String name) { - return reader.readFloat(name); - } - - /** - * @param name Field name. - * @param d Double value. - * @return Whether value was written. - */ - public final boolean putDouble(String name, double d) { - return writer.writeDouble(name, d); - } - - /** - * @param name Field name. - * @return Double value. - */ - public final double getDouble(String name) { - return reader.readDouble(name); - } - - /** - * @param name Field name. - * @param c Char value. - * @return Whether value was written. - */ - public final boolean putChar(String name, char c) { - return writer.writeChar(name, c); - } - - /** - * @param name Field name. - * @return Char value. - */ - public final char getChar(String name) { - return reader.readChar(name); - } - - /** - * @param name Field name. - * @param b Boolean value. - * @return Whether value was written. - */ - public final boolean putBoolean(String name, boolean b) { - return writer.writeBoolean(name, b); - } - - /** - * @param name Field name. - * @return Boolean value. - */ - public final boolean getBoolean(String name) { - return reader.readBoolean(name); - } - - /** - * @param name Field name. - * @param arr Byte array. - * @return Whether array was fully written. - */ - public final boolean putByteArray(String name, @Nullable byte[] arr) { - return writer.writeByteArray(name, arr); - } - - /** - * @param name Field name. - * @return Byte array. - */ - public final byte[] getByteArray(String name) { - return reader.readByteArray(name); - } - - /** - * @param name Field name. - * @param arr Short array. - * @return Whether array was fully written. - */ - public final boolean putShortArray(String name, short[] arr) { - return writer.writeShortArray(name, arr); - } - - /** - * @param name Field name. - * @return Short array. - */ - public final short[] getShortArray(String name) { - return reader.readShortArray(name); - } - - /** - * @param name Field name. - * @param arr Integer array. - * @return Whether array was fully written. - */ - public final boolean putIntArray(String name, int[] arr) { - return writer.writeIntArray(name, arr); - } - - /** - * @param name Field name. - * @return Integer array. - */ - public final int[] getIntArray(String name) { - return reader.readIntArray(name); - } - - /** - * @param name Field name. - * @param arr Long array. - * @return Whether array was fully written. - */ - public final boolean putLongArray(String name, long[] arr) { - return writer.writeLongArray(name, arr); - } - - /** - * @param name Field name. - * @return Long array. - */ - public final long[] getLongArray(String name) { - return reader.readLongArray(name); - } - - /** - * @param name Field name. - * @param arr Float array. - * @return Whether array was fully written. - */ - public final boolean putFloatArray(String name, float[] arr) { - return writer.writeFloatArray(name, arr); - } - - /** - * @param name Field name. - * @return Float array. - */ - public final float[] getFloatArray(String name) { - return reader.readFloatArray(name); - } - - /** - * @param name Field name. - * @param arr Double array. - * @return Whether array was fully written. - */ - public final boolean putDoubleArray(String name, double[] arr) { - return writer.writeDoubleArray(name, arr); - } - - /** - * @param name Field name. - * @return Double array. - */ - public final double[] getDoubleArray(String name) { - return reader.readDoubleArray(name); - } - - /** - * @param name Field name. - * @param arr Char array. - * @return Whether array was fully written. - */ - public final boolean putCharArray(String name, char[] arr) { - return writer.writeCharArray(name, arr); - } - - /** - * @param name Field name. - * @return Char array. - */ - public final char[] getCharArray(String name) { - return reader.readCharArray(name); - } - - /** - * @param name Field name. - * @param arr Boolean array. - * @return Whether array was fully written. - */ - public final boolean putBooleanArray(String name, boolean[] arr) { - return writer.writeBooleanArray(name, arr); - } - - /** - * @param name Field name. - * @return Boolean array. - */ - public final boolean[] getBooleanArray(String name) { - return reader.readBooleanArray(name); - } - - /** - * @param name Field name. - * @param buf Buffer. - * @return Whether value was fully written. - */ - public final boolean putByteBuffer(String name, @Nullable ByteBuffer buf) { - byte[] arr = null; - - if (buf != null) { - ByteBuffer buf0 = buf.duplicate(); - - arr = new byte[buf0.remaining()]; - - buf0.get(arr); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link ByteBuffer}. - */ - public final ByteBuffer getByteBuffer(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else - return ByteBuffer.wrap(arr); - } - - /** - * @param name Field name. - * @param uuid {@link UUID}. - * @return Whether value was fully written. - */ - public final boolean putUuid(String name, @Nullable UUID uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link UUID}. - */ - public final UUID getUuid(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new UUID(most, least); - } - } - - /** - * @param name Field name. - * @param uuid {@link IgniteUuid}. - * @return Whether value was fully written. - */ - public final boolean putGridUuid(String name, @Nullable IgniteUuid uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[24]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link IgniteUuid}. - */ - public final IgniteUuid getGridUuid(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new IgniteUuid(new UUID(most, least), loc); - } - } - - /** - * @param name Field name. - * @param ver {@link GridClockDeltaVersion}. - * @return Whether value was fully written. - */ - public final boolean putClockDeltaVersion(String name, @Nullable GridClockDeltaVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridClockDeltaVersion}. - */ - public final GridClockDeltaVersion getClockDeltaVersion(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new GridClockDeltaVersion(ver, topVer); - } - } - - /** - * @param name Field name. - * @param list {@link GridByteArrayList}. - * @return Whether value was fully written. - */ - public final boolean putByteArrayList(String name, @Nullable GridByteArrayList list) { - return putByteArray(name, list != null ? list.array() : null); - } - - /** - * @param name Field name. - * @return {@link GridByteArrayList}. - */ - @SuppressWarnings("IfMayBeConditional") - public final GridByteArrayList getByteArrayList(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else - return new GridByteArrayList(arr); - } - - /** - * @param name Field name. - * @param list {@link GridLongList}. - * @return Whether value was fully written. - */ - public final boolean putLongList(String name, @Nullable GridLongList list) { - return putLongArray(name, list != null ? list.array() : null); - } - - /** - * @param name Field name. - * @return {@link GridLongList}. - */ - @SuppressWarnings("IfMayBeConditional") - public final GridLongList getLongList(String name) { - long[] arr = getLongArray(name); - - if (arr == null) - return null; - else - return new GridLongList(arr); - } - - /** - * @param name Field name. - * @param ver {@link org.apache.ignite.internal.processors.cache.version.GridCacheVersion}. - * @return Whether value was fully written. - */ - public final boolean putCacheVersion(String name, @Nullable GridCacheVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[24]; - - UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridCacheVersion}. - */ - public final GridCacheVersion getCacheVersion(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); - int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4); - long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order); - } - } - - /** - * @param name Field name. - * @param id {@link GridDhtPartitionExchangeId}. - * @return Whether value was fully written. - */ - public final boolean putDhtPartitionExchangeId(String name, @Nullable GridDhtPartitionExchangeId id) { - byte[] arr = null; - - if (id != null) { - arr = new byte[28]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridDhtPartitionExchangeId}. - */ - public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20); - - return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer); - } - } - - /** - * @param name Field name. - * @param bytes {@link GridCacheValueBytes}. - * @return Whether value was fully written. - */ - public final boolean putValueBytes(String name, @Nullable GridCacheValueBytes bytes) { - byte[] arr = null; - - if (bytes != null) { - byte[] bytes0 = bytes.get(); - - if (bytes0 != null) { - int len = bytes0.length; - - arr = new byte[len + 2]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); - UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); - UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); - } - else { - arr = new byte[1]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false); - } - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridCacheValueBytes}. - */ - public final GridCacheValueBytes getValueBytes(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); - - if (notNull) { - int len = arr.length - 2; - - assert len >= 0 : len; - - byte[] bytesArr = new byte[len]; - - UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len); - - boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len); - - return new GridCacheValueBytes(bytesArr, isPlain); - } - else - return new GridCacheValueBytes(); - } - } - - /** - * @param name Field name. - * @param str {@link String}. - * @return Whether value was fully written. - */ - public final boolean putString(String name, @Nullable String str) { - return putByteArray(name, str != null ? str.getBytes() : null); - } - - /** - * @param name Field name. - * @return {@link String}. - */ - @SuppressWarnings("IfMayBeConditional") - public final String getString(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else - return new String(arr); - } - - /** - * @param name Field name. - * @param bits {@link BitSet}. - * @return Whether value was fully written. - */ - public final boolean putBitSet(String name, @Nullable BitSet bits) { - return putLongArray(name, bits != null ? bits.toLongArray() : null); - } - - /** - * @param name Field name. - * @return {@link BitSet}. - */ - @SuppressWarnings("IfMayBeConditional") - public final BitSet getBitSet(String name) { - long[] arr = getLongArray(name); - - if (arr == null) - return null; - else - return BitSet.valueOf(arr); - } - - /** - * @param name Field name. - * @param e Enum. - * @return Whether value was fully written. - */ - public final boolean putEnum(String name, @Nullable Enum e) { - return putByte(name, e != null ? (byte)e.ordinal() : -1); - } - - /** - * @param name Field name. - * @param msg {@link GridTcpCommunicationMessageAdapter}. - * @return Whether value was fully written. - */ - public final boolean putMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { - if (msg != null) - msg.setWriter(writer); - - return writer.writeMessage(name, msg); - } - - /** - * @param name Field name. - * @return {@link GridTcpCommunicationMessageAdapter}. - */ - public final GridTcpCommunicationMessageAdapter getMessage(String name) { - return reader.readMessage(name); - } - - public final boolean lastRead() { - return reader.isLastRead(); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpMessageFactory.java deleted file mode 100644 index 7f33cd1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpMessageFactory.java +++ /dev/null @@ -1,29 +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.util.direct; - -/** - * - */ -public interface GridTcpMessageFactory { - /** - * @param type Message type. - * @return Message instance. - */ - public GridTcpCommunicationMessageAdapter create(byte type); -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java index 043e2bb..1e9d98d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.util.ipc; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -143,7 +143,7 @@ public class IpcToNioAdapter { * @param msg Buffer to send. * @return Send result. */ - private GridNioFuture send(GridTcpCommunicationMessageAdapter msg) { + private GridNioFuture send(MessageAdapter msg) { assert writeBuf.hasArray(); try { @@ -188,7 +188,7 @@ public class IpcToNioAdapter { @Override public GridNioFuture onSessionWrite(GridNioSession ses, Object msg) { assert ses == IpcToNioAdapter.this.ses; - return send((GridTcpCommunicationMessageAdapter)msg); + return send((MessageAdapter)msg); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java index e8ddb7d..6084e09 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java @@ -18,8 +18,8 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -97,7 +97,7 @@ public interface GridCommunicationClient { * @throws IgniteCheckedException If failed. * @return {@code True} if should try to resend message. */ - boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg) throws IgniteCheckedException; + boolean sendMessage(@Nullable UUID nodeId, MessageAdapter msg) throws IgniteCheckedException; /** * @param timeout Timeout. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java index b87236c..0071942 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java @@ -18,7 +18,8 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.jetbrains.annotations.*; @@ -50,7 +51,7 @@ public class GridDirectParser implements GridNioParser { if (msgFactory == null) msgFactory = spi.getSpiContext().messageFactory(); - GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY); + MessageAdapter msg = ses.removeMeta(MSG_META_KEY); if (msg == null && buf.hasRemaining()) msg = msgFactory.create(buf.get()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageReader.java index c4c3bb4..17249fa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageReader.java @@ -17,7 +17,8 @@ package org.apache.ignite.internal.util.nio; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.nio.*; @@ -33,7 +34,7 @@ public interface GridNioMessageReader { * @param buf Buffer. * @return Whether message was fully read. */ - public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf); + public boolean read(@Nullable UUID nodeId, MessageAdapter msg, ByteBuffer buf); /** * @return Optional message factory. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageWriter.java index 38ce18c..e517b3c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageWriter.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.util.nio; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -34,7 +34,7 @@ public interface GridNioMessageWriter { * @param buf Buffer. * @return Whether message was fully written. */ - public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf); + public boolean write(@Nullable UUID nodeId, MessageAdapter msg, ByteBuffer buf); /** * @param nodeId Node ID. @@ -44,6 +44,6 @@ public interface GridNioMessageWriter { * @return Number of bytes written. * @throws IOException In case of error. */ - public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out, + public int writeFully(@Nullable UUID nodeId, MessageAdapter msg, OutputStream out, ByteBuffer buf) throws IOException; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java index 2438e14..9ec25f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java @@ -21,13 +21,13 @@ import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.ssl.*; 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.internal.util.worker.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.thread.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -339,7 +339,7 @@ public class GridNioServer { * @param msg Message. * @return Future for operation. */ - GridNioFuture send(GridNioSession ses, GridTcpCommunicationMessageAdapter msg) { + GridNioFuture send(GridNioSession ses, MessageAdapter msg) { assert ses instanceof GridSelectorNioSessionImpl; GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses; @@ -378,7 +378,7 @@ public class GridNioServer { * @param msg Message. * @return Future. */ - public GridNioFuture sendSystem(GridNioSession ses, GridTcpCommunicationMessageAdapter msg) { + public GridNioFuture sendSystem(GridNioSession ses, MessageAdapter msg) { return sendSystem(ses, msg, null); } @@ -391,7 +391,7 @@ public class GridNioServer { * @return Future. */ public GridNioFuture sendSystem(GridNioSession ses, - GridTcpCommunicationMessageAdapter msg, + MessageAdapter msg, @Nullable IgniteInClosure> lsnr) { assert ses instanceof GridSelectorNioSessionImpl; @@ -868,7 +868,7 @@ public class GridNioServer { } } - GridTcpCommunicationMessageAdapter msg; + MessageAdapter msg; boolean finished = false; if (req != null) { @@ -1005,7 +1005,7 @@ public class GridNioServer { } } - GridTcpCommunicationMessageAdapter msg; + MessageAdapter msg; boolean finished = false; if (req != null) { @@ -1744,7 +1744,7 @@ public class GridNioServer { private ByteBuffer msg; /** Direct message. */ - private GridTcpCommunicationMessageAdapter commMsg; + private MessageAdapter commMsg; /** */ private boolean accepted; @@ -1820,7 +1820,7 @@ public class GridNioServer { * @param commMsg Direct message. */ NioOperationFuture(GridSelectorNioSessionImpl ses, NioOperation op, - GridTcpCommunicationMessageAdapter commMsg) { + MessageAdapter commMsg) { assert ses != null; assert op != null; assert op != NioOperation.REGISTER; @@ -1848,7 +1848,7 @@ public class GridNioServer { /** * @return Direct message. */ - private GridTcpCommunicationMessageAdapter directMessage() { + private MessageAdapter directMessage() { return commMsg; } @@ -1959,7 +1959,7 @@ public class GridNioServer { return null; } else - return send(ses, (GridTcpCommunicationMessageAdapter)msg); + return send(ses, (MessageAdapter)msg); } else return send(ses, (ByteBuffer)msg); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java index c7bc570..5413f4a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java @@ -18,10 +18,10 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.ipc.shmem.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -102,7 +102,7 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien } /** {@inheritDoc} */ - @Override public synchronized boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg) + @Override public synchronized boolean sendMessage(@Nullable UUID nodeId, MessageAdapter msg) throws IgniteCheckedException { if (closed()) throw new IgniteCheckedException("Communication client was closed: " + this); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java index a6d0907..6b36f88 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -183,7 +183,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient } /** {@inheritDoc} */ - @Override public boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg) + @Override public boolean sendMessage(@Nullable UUID nodeId, MessageAdapter msg) throws IgniteCheckedException { if (closed()) throw new IgniteCheckedException("Client was closed: " + this); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpNioCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpNioCommunicationClient.java index 2b71d61..46d0646 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpNioCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpNioCommunicationClient.java @@ -18,9 +18,9 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; @@ -103,7 +103,7 @@ public class GridTcpNioCommunicationClient extends GridAbstractCommunicationClie } /** {@inheritDoc} */ - @Override public boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg) + @Override public boolean sendMessage(@Nullable UUID nodeId, MessageAdapter msg) throws IgniteCheckedException { // Node ID is never provided in asynchronous send mode. assert nodeId == null; diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java index ee90976..a59d7ab 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginContext.java @@ -20,7 +20,7 @@ package org.apache.ignite.plugin; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.spi.*; import java.util.*; diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java new file mode 100644 index 0000000..89d26fc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java @@ -0,0 +1,130 @@ +/* + * 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.plugin.extensions.communication; + +import org.apache.ignite.internal.direct.*; + +import java.io.*; +import java.nio.*; +import java.util.*; + +/** + * Communication message adapter. + */ +public abstract class MessageAdapter implements Serializable, Cloneable { + /** */ + // TODO: remove + protected static final Object NULL = new Object(); + + /** */ + // TODO: remove + protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); + + /** Writer. */ + protected MessageWriter writer; + + /** Reader. */ + protected MessageReader reader; + + /** + * @param writer Writer. + */ + public final void setWriter(MessageWriter writer) { + if (this.writer == null) + this.writer = writer; + } + + /** + * @param reader Reader. + */ + public final void setReader(MessageReader reader) { + if (this.reader == null) + this.reader = reader; + } + + /** + * @param buf Buffer. + */ + public final void setBuffer(ByteBuffer buf) { + if (writer != null) + writer.setBuffer(buf); + + if (reader != null) + reader.setBuffer(buf); + } + + /** + * @param buf Byte buffer. + * @return Whether message was fully written. + */ + public abstract boolean writeTo(ByteBuffer buf); + + /** + * @param buf Byte buffer. + * @return Whether message was fully read. + */ + public abstract boolean readFrom(ByteBuffer buf); + + /** + * @return Message type. + */ + public abstract byte directType(); + + /** {@inheritDoc} */ + @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") + @Override public abstract MessageAdapter clone(); + + /** + * Clones all fields of the provided message to {@code this}. + * + * @param _msg Message to clone from. + */ + protected abstract void clone0(MessageAdapter _msg); + + /** + * @return {@code True} if should skip recovery for this message. + */ + public boolean skipRecovery() { + return false; + } + + /** + * @param arr Array. + * @return Array iterator. + */ + protected final Iterator arrayIterator(final Object[] arr) { + return new Iterator() { + private int idx; + + @Override public boolean hasNext() { + return idx < arr.length; + } + + @Override public Object next() { + if (!hasNext()) + throw new NoSuchElementException(); + + return arr[idx++]; + } + + @Override public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index 1431738..d09f00c 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -9,15 +9,13 @@ package org.apache.ignite.plugin.extensions.communication; -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.plugin.*; - import java.nio.*; +import java.util.*; /** * TODO */ -public interface MessageReader extends IgniteExtension { +public interface MessageReader { public void setBuffer(ByteBuffer buf); public byte readByte(String name); @@ -52,7 +50,11 @@ public interface MessageReader extends IgniteExtension { public boolean[] readBooleanArray(String name); - public GridTcpCommunicationMessageAdapter readMessage(String name); + public MessageAdapter readMessage(String name); + + public Collection readCollection(String name, Class itemCls); + + public Map readMap(String name, Class keyCls, Class valCls); public boolean isLastRead(); } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java index 51e51a9..70dc3dc 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java @@ -9,9 +9,11 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.plugin.*; + /** * TODO */ -public interface MessageReaderFactory { +public interface MessageReaderFactory extends IgniteExtension { public MessageReader reader(); } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index 125c84c..5f7ddf9 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -9,15 +9,13 @@ package org.apache.ignite.plugin.extensions.communication; -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.plugin.*; - import java.nio.*; +import java.util.*; /** * TODO */ -public interface MessageWriter extends IgniteExtension { +public interface MessageWriter { public void setBuffer(ByteBuffer buf); public boolean writeByte(String name, byte val); @@ -52,5 +50,9 @@ public interface MessageWriter extends IgniteExtension { public boolean writeBooleanArray(String name, boolean[] val); - public boolean writeMessage(String name, GridTcpCommunicationMessageAdapter val); + public boolean writeMessage(String name, MessageAdapter val); + + public boolean writeCollection(String name, Collection col, Class itemCls); + + public boolean writeMap(String name, Map map, Class keyCls, Class valCls); } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java index 613f312..47b5a34 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java @@ -9,9 +9,11 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.plugin.*; + /** * TODO */ -public interface MessageWriterFactory { +public interface MessageWriterFactory extends IgniteExtension { public MessageWriter writer(); } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java index 27fbb75..21f75a8 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java @@ -21,7 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.authentication.*; import org.apache.ignite.internal.managers.communication.*; diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java index b030a2d..06004c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java @@ -20,9 +20,9 @@ package org.apache.ignite.spi; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.swapspace.*; import org.jetbrains.annotations.*; diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index 0653dcd..d468c28 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -17,8 +17,8 @@ package org.apache.ignite.spi.collision.jobstealing; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -26,7 +26,7 @@ import java.nio.*; /** * Job stealing request. */ -public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { +public class JobStealingRequest extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -56,7 +56,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { JobStealingRequest _clone = new JobStealingRequest(); clone0(_clone); @@ -65,7 +65,7 @@ public class JobStealingRequest extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { JobStealingRequest _clone = (JobStealingRequest)_msg; _clone.delta = delta; diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index 3ca4d4b..4db4ef8 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -24,13 +24,12 @@ import org.apache.ignite.events.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.thread.*; import org.apache.ignite.internal.managers.eventstorage.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.ipc.*; import org.apache.ignite.internal.util.ipc.shmem.*; @@ -39,11 +38,6 @@ import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.resources.*; -import org.apache.ignite.spi.*; -import org.apache.ignite.spi.communication.*; -import org.apache.ignite.thread.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -150,7 +144,7 @@ import static org.apache.ignite.events.EventType.*; @IgniteSpiMultipleInstancesSupport(true) @IgniteSpiConsistencyChecked(optional = false) public class TcpCommunicationSpi extends IgniteSpiAdapter - implements CommunicationSpi, TcpCommunicationSpiMBean { + implements CommunicationSpi, TcpCommunicationSpiMBean { /** IPC error message. */ public static final String OUT_OF_RESOURCES_TCP_MSG = "Failed to allocate shared memory segment " + "(switching to TCP, may be slower). For troubleshooting see " + @@ -245,8 +239,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter public static final byte HANDSHAKE_MSG_TYPE = -3; /** Server listener. */ - private final GridNioServerListener srvLsnr = - new GridNioServerListenerAdapter() { + private final GridNioServerListener srvLsnr = + new GridNioServerListenerAdapter() { @Override public void onSessionWriteTimeout(GridNioSession ses) { LT.warn(log, null, "Communication SPI Session write timed out (consider increasing " + "'socketWriteTimeout' " + "configuration property) [remoteAddr=" + ses.remoteAddress() + @@ -298,14 +292,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter } } - CommunicationListener lsnr0 = lsnr; + CommunicationListener lsnr0 = lsnr; if (lsnr0 != null) lsnr0.onDisconnected(id); } } - @Override public void onMessage(GridNioSession ses, GridTcpCommunicationMessageAdapter msg) { + @Override public void onMessage(GridNioSession ses, MessageAdapter msg) { UUID sndId = ses.meta(NODE_ID_META); if (sndId == null) { @@ -685,7 +679,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter private double bufSizeRatio = IgniteSystemProperties.getDouble(IGNITE_COMMUNICATION_BUF_RESIZE_RATIO, 0.8); /** NIO server. */ - private GridNioServer nioSrvr; + private GridNioServer nioSrvr; /** Shared memory server. */ private IpcSharedMemoryServerEndpoint shmemSrv; @@ -724,7 +718,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter private final ConcurrentMap clients = GridConcurrentFactory.newMap(); /** SPI listener. */ - private volatile CommunicationListener lsnr; + private volatile CommunicationListener lsnr; /** Bound port. */ private int boundTcpPort = -1; @@ -1233,7 +1227,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter } /** {@inheritDoc} */ - @Override public void setListener(CommunicationListener lsnr) { + @Override public void setListener(CommunicationListener lsnr) { this.lsnr = lsnr; } @@ -1467,7 +1461,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter * @return Server instance. * @throws IgniteCheckedException Thrown if it's not possible to create server. */ - private GridNioServer resetNioServer() throws IgniteCheckedException { + private GridNioServer resetNioServer() throws IgniteCheckedException { if (boundTcpPort >= 0) throw new IgniteCheckedException("Tcp NIO server was already created on port " + boundTcpPort); @@ -1476,8 +1470,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter // If configured TCP port is busy, find first available in range. for (int port = locPort; port < locPort + locPortRange; port++) { try { - GridNioServer srvr = - GridNioServer.builder() + GridNioServer srvr = + GridNioServer.builder() .address(locHost) .port(port) .listener(srvLsnr) @@ -1673,7 +1667,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter } /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) throws IgniteSpiException { + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { assert node != null; assert msg != null; @@ -2255,8 +2249,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter * @param msg Communication message. * @param msgC Closure to call when message processing finished. */ - protected void notifyListener(UUID sndId, GridTcpCommunicationMessageAdapter msg, IgniteRunnable msgC) { - CommunicationListener lsnr = this.lsnr; + protected void notifyListener(UUID sndId, MessageAdapter msg, IgniteRunnable msgC) { + CommunicationListener lsnr = this.lsnr; if (lsnr != null) // Notify listener of a new message. @@ -2420,7 +2414,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter /** {@inheritDoc} */ @Override protected void body() throws InterruptedException { try { - IpcToNioAdapter adapter = new IpcToNioAdapter<>( + IpcToNioAdapter adapter = new IpcToNioAdapter<>( metricsLsnr, log, endpoint, @@ -2944,7 +2938,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter * Handshake message. */ @SuppressWarnings("PublicInnerClass") - public static class HandshakeMessage extends GridTcpCommunicationMessageAdapter { + public static class HandshakeMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -2958,7 +2952,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter private long connectCnt; /** - * Default constructor required by {@link GridTcpCommunicationMessageAdapter}. + * Default constructor required by {@link MessageAdapter}. */ public HandshakeMessage() { // No-op. @@ -3044,12 +3038,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter msg) { + @Override protected void clone0(MessageAdapter msg) { // No-op. } @@ -3063,7 +3057,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter * Recovery acknowledgment message. */ @SuppressWarnings("PublicInnerClass") - public static class RecoveryLastReceivedMessage extends GridTcpCommunicationMessageAdapter { + public static class RecoveryLastReceivedMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -3071,7 +3065,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter private long rcvCnt; /** - * Default constructor required by {@link GridTcpCommunicationMessageAdapter}. + * Default constructor required by {@link MessageAdapter}. */ public RecoveryLastReceivedMessage() { // No-op. @@ -3120,12 +3114,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter msg) { + @Override protected void clone0(MessageAdapter msg) { // No-op. } @@ -3144,7 +3138,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter * Node ID message. */ @SuppressWarnings("PublicInnerClass") - public static class NodeIdMessage extends GridTcpCommunicationMessageAdapter { + public static class NodeIdMessage extends MessageAdapter { /** */ private static final long serialVersionUID = 0L; @@ -3204,12 +3198,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { // No-op. } diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java deleted file mode 100644 index 76b6eb7..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java +++ /dev/null @@ -1,733 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.apache.ignite.internal.util.*; -import org.apache.ignite.internal.util.direct.*; -import org.jetbrains.annotations.*; -import sun.misc.*; -import sun.nio.ch.*; - -import java.nio.*; - -/** - * Portable stream based on {@link ByteBuffer}. - */ -public class GridTcpCommunicationByteBufferStream { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** */ - private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class); - - /** */ - private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class); - - /** */ - private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class); - - /** */ - private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class); - - /** */ - private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class); - - /** */ - private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class); - - /** */ - private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class); - - /** */ - private static final byte[] BYTE_ARR_EMPTY = new byte[0]; - - /** */ - private static final short[] SHORT_ARR_EMPTY = new short[0]; - - /** */ - private static final int[] INT_ARR_EMPTY = new int[0]; - - /** */ - private static final long[] LONG_ARR_EMPTY = new long[0]; - - /** */ - private static final float[] FLOAT_ARR_EMPTY = new float[0]; - - /** */ - private static final double[] DOUBLE_ARR_EMPTY = new double[0]; - - /** */ - private static final char[] CHAR_ARR_EMPTY = new char[0]; - - /** */ - private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0]; - - /** */ - private static final ArrayCreator BYTE_ARR_CREATOR = new ArrayCreator() { - @Override public byte[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return BYTE_ARR_EMPTY; - - default: - return new byte[len]; - } - } - }; - - /** */ - private static final ArrayCreator SHORT_ARR_CREATOR = new ArrayCreator() { - @Override public short[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return SHORT_ARR_EMPTY; - - default: - return new short[len]; - } - } - }; - - /** */ - private static final ArrayCreator INT_ARR_CREATOR = new ArrayCreator() { - @Override public int[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return INT_ARR_EMPTY; - - default: - return new int[len]; - } - } - }; - - /** */ - private static final ArrayCreator LONG_ARR_CREATOR = new ArrayCreator() { - @Override public long[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return LONG_ARR_EMPTY; - - default: - return new long[len]; - } - } - }; - - /** */ - private static final ArrayCreator FLOAT_ARR_CREATOR = new ArrayCreator() { - @Override public float[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return FLOAT_ARR_EMPTY; - - default: - return new float[len]; - } - } - }; - - /** */ - private static final ArrayCreator DOUBLE_ARR_CREATOR = new ArrayCreator() { - @Override public double[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return DOUBLE_ARR_EMPTY; - - default: - return new double[len]; - } - } - }; - - /** */ - private static final ArrayCreator CHAR_ARR_CREATOR = new ArrayCreator() { - @Override public char[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return CHAR_ARR_EMPTY; - - default: - return new char[len]; - } - } - }; - - /** */ - private static final ArrayCreator BOOLEAN_ARR_CREATOR = new ArrayCreator() { - @Override public boolean[] create(int len) { - assert len >= 0; - - switch (len) { - case 0: - return BOOLEAN_ARR_EMPTY; - - default: - return new boolean[len]; - } - } - }; - - /** */ - private final GridTcpMessageFactory msgFactory; - - /** */ - private ByteBuffer buf; - - /** */ - private byte[] heapArr; - - /** */ - private long baseOff; - - /** */ - private int arrOff = -1; - - /** */ - private Object tmpArr; - - /** */ - private int tmpArrOff; - - /** */ - private int tmpArrBytes; - - /** */ - private boolean msgTypeDone; - - /** */ - private GridTcpCommunicationMessageAdapter msg; - - /** */ - private boolean lastFinished; - - /** - * @param msgFactory Message factory. - */ - public GridTcpCommunicationByteBufferStream(@Nullable GridTcpMessageFactory msgFactory) { - this.msgFactory = msgFactory; - } - - /** - * @param buf Buffer. - */ - public void setBuffer(ByteBuffer buf) { - assert buf != null; - - if (this.buf != buf) { - this.buf = buf; - - heapArr = buf.isDirect() ? null : buf.array(); - baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF; - } - } - - public int remaining() { - return buf.remaining(); - } - - /** - * @return Whether last object was fully written or read. - */ - public boolean lastFinished() { - return lastFinished; - } - - /** {@inheritDoc} */ - public void writeByte(byte val) { - int pos = buf.position(); - - UNSAFE.putByte(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - public void writeByteArray(byte[] val) { - assert val != null; - - lastFinished = writeArray(val, BYTE_ARR_OFF, val.length, val.length); - } - - /** - * @param val Array. - */ - public void writeByteArray(byte[] val, int off, int len) { - assert val != null; - - lastFinished = writeArray(val, BYTE_ARR_OFF + off, len, len, true); - } - - /** {@inheritDoc} */ - public void writeBoolean(boolean val) { - int pos = buf.position(); - - UNSAFE.putBoolean(heapArr, baseOff + pos, val); - - buf.position(pos + 1); - } - - /** {@inheritDoc} */ - public void writeBooleanArray(boolean[] val) { - assert val != null; - - lastFinished = writeArray(val, BOOLEAN_ARR_OFF, val.length, val.length); - } - - /** {@inheritDoc} */ - public void writeShort(short val) { - int pos = buf.position(); - - UNSAFE.putShort(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - public void writeShortArray(short[] val) { - assert val != null; - - lastFinished = writeArray(val, SHORT_ARR_OFF, val.length, val.length << 1); - } - - /** {@inheritDoc} */ - public void writeChar(char val) { - int pos = buf.position(); - - UNSAFE.putChar(heapArr, baseOff + pos, val); - - buf.position(pos + 2); - } - - /** {@inheritDoc} */ - public void writeCharArray(char[] val) { - assert val != null; - - lastFinished = writeArray(val, CHAR_ARR_OFF, val.length, val.length << 1); - } - - /** {@inheritDoc} */ - public void writeInt(int val) { - int pos = buf.position(); - - UNSAFE.putInt(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - public void writeIntArray(int[] val) { - assert val != null; - - lastFinished = writeArray(val, INT_ARR_OFF, val.length, val.length << 2); - } - - /** {@inheritDoc} */ - public void writeFloat(float val) { - int pos = buf.position(); - - UNSAFE.putFloat(heapArr, baseOff + pos, val); - - buf.position(pos + 4); - } - - /** {@inheritDoc} */ - public void writeFloatArray(float[] val) { - assert val != null; - - lastFinished = writeArray(val, FLOAT_ARR_OFF, val.length, val.length << 2); - } - - /** {@inheritDoc} */ - public void writeLong(long val) { - int pos = buf.position(); - - UNSAFE.putLong(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - public void writeLongArray(long[] val) { - assert val != null; - - lastFinished = writeArray(val, LONG_ARR_OFF, val.length, val.length << 3); - } - - /** {@inheritDoc} */ - public void writeDouble(double val) { - int pos = buf.position(); - - UNSAFE.putDouble(heapArr, baseOff + pos, val); - - buf.position(pos + 8); - } - - /** {@inheritDoc} */ - public void writeDoubleArray(double[] val) { - assert val != null; - - lastFinished = writeArray(val, DOUBLE_ARR_OFF, val.length, val.length << 3); - } - - /** - * @param msg Message. - */ - public void writeMessage(GridTcpCommunicationMessageAdapter msg) { - assert msg != null; - - lastFinished = buf.hasRemaining() && msg.writeTo(buf); - } - - /** {@inheritDoc} */ - public byte readByte() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getByte(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public byte[] readByteArray() { - return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF); - } - - /** - * @param len Length. - * @return Array. - */ - public byte[] readByteArray(int len) { - return readArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF, len); - } - - /** {@inheritDoc} */ - public boolean readBoolean() { - assert buf.hasRemaining(); - - int pos = buf.position(); - - buf.position(pos + 1); - - return UNSAFE.getBoolean(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public boolean[] readBooleanArray() { - return readArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF); - } - - /** {@inheritDoc} */ - public short readShort() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getShort(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public short[] readShortArray() { - return readArray(SHORT_ARR_CREATOR, 1, SHORT_ARR_OFF); - } - - /** {@inheritDoc} */ - public char readChar() { - assert buf.remaining() >= 2; - - int pos = buf.position(); - - buf.position(pos + 2); - - return UNSAFE.getChar(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public char[] readCharArray() { - return readArray(CHAR_ARR_CREATOR, 1, CHAR_ARR_OFF); - } - - /** {@inheritDoc} */ - public int readInt() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getInt(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public int[] readIntArray() { - return readArray(INT_ARR_CREATOR, 2, INT_ARR_OFF); - } - - /** {@inheritDoc} */ - public float readFloat() { - assert buf.remaining() >= 4; - - int pos = buf.position(); - - buf.position(pos + 4); - - return UNSAFE.getFloat(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public float[] readFloatArray() { - return readArray(FLOAT_ARR_CREATOR, 2, FLOAT_ARR_OFF); - } - - /** {@inheritDoc} */ - public long readLong() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getLong(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public long[] readLongArray() { - return readArray(LONG_ARR_CREATOR, 3, LONG_ARR_OFF); - } - - /** {@inheritDoc} */ - public double readDouble() { - assert buf.remaining() >= 8; - - int pos = buf.position(); - - buf.position(pos + 8); - - return UNSAFE.getDouble(heapArr, baseOff + pos); - } - - /** {@inheritDoc} */ - public double[] readDoubleArray() { - return readArray(DOUBLE_ARR_CREATOR, 3, DOUBLE_ARR_OFF); - } - - /** - * @return Message. - */ - public GridTcpCommunicationMessageAdapter readMessage() { - if (!msgTypeDone) { - if (!buf.hasRemaining()) { - lastFinished = false; - - return null; - } - - byte type = readByte(); - - msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type); - - msgTypeDone = true; - } - - if (msg == null || msg.readFrom(buf)) { - GridTcpCommunicationMessageAdapter msg0 = msg; - - msgTypeDone = false; - msg = null; - - lastFinished = true; - - return msg0; - } - else { - lastFinished = false; - - return null; - } - } - - /** - * @param arr Array. - * @param off Offset. - * @param len Length. - * @param bytes Length in bytes. - * @return Whether array was fully written - */ - private boolean writeArray(Object arr, long off, int len, int bytes) { - return writeArray(arr, off, len, bytes, false); - } - - /** - * @param arr Array. - * @param off Offset. - * @param len Length. - * @param bytes Length in bytes. - * @param skipLen {@code true} if length should not be written. - * @return Whether array was fully written - */ - private boolean writeArray(Object arr, long off, int len, int bytes, boolean skipLen) { - assert arr != null; - assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive(); - assert off > 0; - assert len >= 0; - assert bytes >= 0; - assert bytes >= arrOff; - - if (arrOff == -1) { - if (!skipLen) { - if (remaining() < 4) - return false; - - writeInt(len); - } - - arrOff = 0; - } - - int toWrite = bytes - arrOff; - int pos = buf.position(); - int remaining = buf.remaining(); - - if (toWrite <= remaining) { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, toWrite); - - pos += toWrite; - - buf.position(pos); - - arrOff = -1; - - return true; - } - else { - UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining); - - pos += remaining; - - buf.position(pos); - - arrOff += remaining; - - return false; - } - } - - /** - * @param creator Array creator. - * @param lenShift Array length shift size. - * @param off Base offset. - * @return Array or special value if it was not fully read. - */ - private T readArray(ArrayCreator creator, int lenShift, long off) { - return readArray(creator, lenShift, off, -1); - } - - /** - * @param creator Array creator. - * @param lenShift Array length shift size. - * @param off Base offset. - * @param len Length. - * @return Array or special value if it was not fully read. - */ - private T readArray(ArrayCreator creator, int lenShift, long off, int len) { - assert creator != null; - - if (tmpArr == null) { - if (len == -1) { - if (remaining() < 4) { - lastFinished = false; - - return null; - } - - len = readInt(); - } - - switch (len) { - case -1: - lastFinished = true; - - return null; - - case 0: - lastFinished = true; - - return creator.create(0); - - default: - tmpArr = creator.create(len); - tmpArrBytes = len << lenShift; - } - } - - int toRead = tmpArrBytes - tmpArrOff; - int remaining = buf.remaining(); - int pos = buf.position(); - - if (remaining < toRead) { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining); - - buf.position(pos + remaining); - - tmpArrOff += remaining; - - lastFinished = false; - - return null; - } - else { - UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead); - - buf.position(pos + toRead); - - T arr = (T)tmpArr; - - tmpArr = null; - tmpArrBytes = 0; - tmpArrOff = 0; - - lastFinished = true; - - return arr; - } - } - - /** - * Array creator. - */ - private static interface ArrayCreator { - /** - * @param len Array length or {@code -1} if array was not fully read. - * @return New array. - */ - public T create(int len); - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java deleted file mode 100644 index 574378f..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java +++ /dev/null @@ -1,237 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.jetbrains.annotations.*; - -import java.nio.*; - -/** - * Portable reader implementation. - */ -public class GridTcpCommunicationMessageReader implements MessageReader { - /** Stream. */ - private final GridTcpCommunicationByteBufferStream stream; - - /** Whether last field was fully read. */ - private boolean lastRead; - - /** - * @param msgFactory Message factory. - */ - public GridTcpCommunicationMessageReader(GridTcpMessageFactory msgFactory) { - this.stream = new GridTcpCommunicationByteBufferStream(msgFactory); - } - - /** {@inheritDoc} */ - @Override public void setBuffer(ByteBuffer buf) { - stream.setBuffer(buf); - } - - /** {@inheritDoc} */ - @Override public byte readByte(String name) { - if (stream.remaining() < 1) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readByte(); - } - } - - /** {@inheritDoc} */ - @Override public short readShort(String name) { - if (stream.remaining() < 2) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readShort(); - } - } - - /** {@inheritDoc} */ - @Override public int readInt(String name) { - if (stream.remaining() < 4) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readInt(); - } - } - - /** {@inheritDoc} */ - @Override public long readLong(String name) { - if (stream.remaining() < 8) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readLong(); - } - } - - /** {@inheritDoc} */ - @Override public float readFloat(String name) { - if (stream.remaining() < 4) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readFloat(); - } - } - - /** {@inheritDoc} */ - @Override public double readDouble(String name) { - if (stream.remaining() < 8) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readDouble(); - } - } - - /** {@inheritDoc} */ - @Override public char readChar(String name) { - if (stream.remaining() < 2) { - lastRead = false; - - return 0; - } - else { - lastRead = true; - - return stream.readChar(); - } - } - - /** {@inheritDoc} */ - @Override public boolean readBoolean(String name) { - if (stream.remaining() < 1) { - lastRead = false; - - return false; - } - else { - lastRead = true; - - return stream.readBoolean(); - } - } - - /** {@inheritDoc} */ - @Nullable @Override public byte[] readByteArray(String name) { - byte[] arr = stream.readByteArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public short[] readShortArray(String name) { - short[] arr = stream.readShortArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public int[] readIntArray(String name) { - int[] arr = stream.readIntArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public long[] readLongArray(String name) { - long[] arr = stream.readLongArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public float[] readFloatArray(String name) { - float[] arr = stream.readFloatArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public double[] readDoubleArray(String name) { - double[] arr = stream.readDoubleArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public char[] readCharArray(String name) { - char[] arr = stream.readCharArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public boolean[] readBooleanArray(String name) { - boolean[] arr = stream.readBooleanArray(); - - lastRead = stream.lastFinished(); - - return arr; - } - - /** {@inheritDoc} */ - @Nullable @Override public GridTcpCommunicationMessageAdapter readMessage(String name) { - GridTcpCommunicationMessageAdapter msg = stream.readMessage(); - - lastRead = stream.lastFinished(); - - return msg; - } - - /** {@inheritDoc} */ - @Override public boolean isLastRead() { - return lastRead; - } -} diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java deleted file mode 100644 index 82ad4f8..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java +++ /dev/null @@ -1,262 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.util.direct; - -import org.apache.ignite.internal.util.direct.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.jetbrains.annotations.*; - -import java.nio.*; - -/** - * Portable writer implementation. - */ -public class GridTcpCommunicationMessageWriter implements MessageWriter { - /** Stream. */ - private final GridTcpCommunicationByteBufferStream stream = new GridTcpCommunicationByteBufferStream(null); - - /** {@inheritDoc} */ - @Override public void setBuffer(ByteBuffer buf) { - stream.setBuffer(buf); - } - - /** {@inheritDoc} */ - @Override public boolean writeByte(String name, byte val) { - if (stream.remaining() < 1) - return false; - - stream.writeByte(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeShort(String name, short val) { - if (stream.remaining() < 2) - return false; - - stream.writeShort(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeInt(String name, int val) { - if (stream.remaining() < 4) - return false; - - stream.writeInt(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeLong(String name, long val) { - if (stream.remaining() < 8) - return false; - - stream.writeLong(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeFloat(String name, float val) { - if (stream.remaining() < 4) - return false; - - stream.writeFloat(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeDouble(String name, double val) { - if (stream.remaining() < 8) - return false; - - stream.writeDouble(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeChar(String name, char val) { - if (stream.remaining() < 2) - return false; - - stream.writeChar(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeBoolean(String name, boolean val) { - if (stream.remaining() < 1) - return false; - - stream.writeBoolean(val); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean writeByteArray(String name, @Nullable byte[] val) { - if (val != null) { - stream.writeByteArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeShortArray(String name, @Nullable short[] val) { - if (val != null) { - stream.writeShortArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeIntArray(String name, @Nullable int[] val) { - if (val != null) { - stream.writeIntArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeLongArray(String name, @Nullable long[] val) { - if (val != null) { - stream.writeLongArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeFloatArray(String name, @Nullable float[] val) { - if (val != null) { - stream.writeFloatArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeDoubleArray(String name, @Nullable double[] val) { - if (val != null) { - stream.writeDoubleArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeCharArray(String name, @Nullable char[] val) { - if (val != null) { - stream.writeCharArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeBooleanArray(String name, @Nullable boolean[] val) { - if (val != null) { - stream.writeBooleanArray(val); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 4) - return false; - - stream.writeInt(-1); - - return true; - } - } - - /** {@inheritDoc} */ - @Override public boolean writeMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) { - if (msg != null) { - stream.writeMessage(msg); - - return stream.lastFinished(); - } - else { - if (stream.remaining() < 1) - return false; - - stream.writeByte(Byte.MIN_VALUE); - - return true; - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java index 4e817a3..c9ec0e0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java @@ -23,11 +23,11 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; -import org.apache.ignite.internal.util.direct.*; 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.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; @@ -732,7 +732,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest { private CountDownLatch waitLatch = new CountDownLatch(1); /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { sendMessage0(node, msg); } @@ -745,7 +745,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest { * @param msg Message to be sent. * @throws org.apache.ignite.spi.IgniteSpiException If failed. */ - private void sendMessage0(ClusterNode node, GridTcpCommunicationMessageAdapter msg) throws IgniteSpiException { + private void sendMessage0(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { if (msg instanceof GridIoMessage) { GridIoMessage msg0 = (GridIoMessage)msg; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java index 13762fb..ce1d765 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java @@ -19,7 +19,8 @@ package org.apache.ignite.internal.managers.communication; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; @@ -50,7 +51,7 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest static { GridTcpCommunicationMessageFactory.registerCustom(new GridTcpCommunicationMessageProducer() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { + @Override public MessageAdapter create(byte type) { return new TestMessage(); } }, DIRECT_TYPE); @@ -141,15 +142,15 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest } /** */ - private static class TestMessage extends GridTcpCommunicationMessageAdapter { + private static class TestMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { // No-op. } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java index cf89a1f..d125375 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java @@ -22,9 +22,9 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.discovery.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.marshaller.jdk.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.*; @@ -183,7 +183,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public void send(ClusterNode node, GridTopic topic, GridTcpCommunicationMessageAdapter msg, + @Override public void send(ClusterNode node, GridTopic topic, MessageAdapter msg, GridIoPolicy plc) throws IgniteCheckedException { // No-op. } @@ -218,15 +218,15 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest { } /** */ - private static class Message extends GridTcpCommunicationMessageAdapter implements Serializable { + private static class Message extends MessageAdapter implements Serializable { /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { // No-op. } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java index 7be98ab..acd6bf3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -168,7 +168,7 @@ public class GridDeploymentMessageCountSelfTest extends GridCommonAbstractTest { private AtomicInteger msgCnt = new AtomicInteger(); /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { if (isDeploymentMessage((GridIoMessage)msg)) msgCnt.incrementAndGet(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java index 0b23669..a13982a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java @@ -22,7 +22,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -191,7 +191,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest private Map, AtomicInteger> cntMap = new HashMap<>(); /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { AtomicInteger cntr = cntMap.get(((GridIoMessage)msg).message().getClass()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java index d37eab5..85ba6ce 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.distributed.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -185,7 +185,7 @@ public class GridCacheReplicatedSynchronousCommitTest extends GridCommonAbstract } /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { Object obj = ((GridIoMessage)msg).message(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java index 254cf5a..2442c8b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -134,7 +134,7 @@ public abstract class IgniteTxReentryAbstractSelfTest extends GridCommonAbstract private AtomicInteger dhtLocks = new AtomicInteger(); /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { countMsg((GridIoMessage)msg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAtomicTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAtomicTimeoutSelfTest.java index 6d62a84..55d1068 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAtomicTimeoutSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAtomicTimeoutSelfTest.java @@ -26,10 +26,10 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.nio.*; 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.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.testframework.*; @@ -274,7 +274,7 @@ public class GridCacheAtomicTimeoutSelfTest extends GridCommonAbstractTest { private boolean skipDhtResponse; /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { if (!skipMessage((GridIoMessage)msg)) super.sendMessage(node, msg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java index 7c860e1..f693179 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java @@ -25,10 +25,10 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; @@ -239,7 +239,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCommunicationSpi(new TcpCommunicationSpi() { - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { if (!F.eq(ignoreMsgNodeId, node.id()) || !ignoredMessage((GridIoMessage)msg)) super.sendMessage(node, msg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java index e4bda25..9568789 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java @@ -26,10 +26,10 @@ import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.processors.cache.transactions.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; @@ -418,7 +418,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCommunicationSpi(new TcpCommunicationSpi() { - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { if (getSpiContext().localNode().id().equals(failingNodeId)) { if (ignoredMessage((GridIoMessage)msg) && ignoreMsgNodeIds != null) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java index 5398701..e621847 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java @@ -24,8 +24,8 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -141,7 +141,7 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest private Collection sentMsgs = new ConcurrentLinkedQueue<>(); /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { recordMessage((GridIoMessage)msg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java index 1e83921..9fc882e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java @@ -24,8 +24,8 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -296,7 +296,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA */ private static class DelayCommunicationSpi extends TcpCommunicationSpi { /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException { try { if (delayMessage((GridIoMessage)msg)) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java index cfd1b87..5d8545f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java @@ -24,7 +24,7 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.transactions.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -224,7 +224,7 @@ public class GridCacheReplicatedInvalidateSelfTest extends GridCommonAbstractTes } /** {@inheritDoc} */ - @Override public void sendMessage(ClusterNode destNode, GridTcpCommunicationMessageAdapter msg) + @Override public void sendMessage(ClusterNode destNode, MessageAdapter msg) throws IgniteSpiException { Object msg0 = ((GridIoMessage)msg).message(); diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java index 78b1aca..94b8a87 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java @@ -22,10 +22,10 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; -import org.apache.ignite.internal.util.direct.*; 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.apache.ignite.spi.communication.*; import org.apache.ignite.spi.communication.tcp.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -123,7 +123,7 @@ public class GridIoManagerBenchmark0 extends GridCommonAbstractTest { new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg) { try { - rcv.send(sndNode, topic, (GridTcpCommunicationMessageAdapter)msg, PUBLIC_POOL); + rcv.send(sndNode, topic, (MessageAdapter)msg, PUBLIC_POOL); } catch (IgniteCheckedException e) { error("Failed to send message.", e); @@ -217,7 +217,7 @@ public class GridIoManagerBenchmark0 extends GridCommonAbstractTest { new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg) { try { - rcv.send(sndNode, topic, (GridTcpCommunicationMessageAdapter)msg, PUBLIC_POOL); + rcv.send(sndNode, topic, (MessageAdapter)msg, PUBLIC_POOL); } catch (IgniteCheckedException e) { error("Failed to send message.", e); @@ -317,7 +317,7 @@ public class GridIoManagerBenchmark0 extends GridCommonAbstractTest { new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg) { try { - rcv.send(sndNode, topic, (GridTcpCommunicationMessageAdapter)msg, PUBLIC_POOL); + rcv.send(sndNode, topic, (MessageAdapter)msg, PUBLIC_POOL); } catch (IgniteCheckedException e) { error("Failed to send message.", e); diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java index 0392643..1c63e60 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridTestMessage.java @@ -17,9 +17,9 @@ package org.apache.ignite.loadtests.communication; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -27,7 +27,7 @@ import java.nio.*; /** * */ -class GridTestMessage extends GridTcpCommunicationMessageAdapter implements Externalizable { +class GridTestMessage extends MessageAdapter implements Externalizable { /** */ private IgniteUuid id; @@ -109,12 +109,12 @@ class GridTestMessage extends GridTcpCommunicationMessageAdapter implements Exte /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { throw new UnsupportedOperationException(); } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { // No-op. } diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java index 1eb9f47..1aabf89 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java @@ -19,10 +19,11 @@ package org.apache.ignite.spi.communication; import org.apache.ignite.*; import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; 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.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.*; import org.apache.ignite.testframework.junits.spi.*; @@ -49,7 +50,7 @@ public abstract class GridAbstractCommunicationSelfTest> msgDestMap = new HashMap<>(); /** */ - protected static final Map> spis = new HashMap<>(); + protected static final Map> spis = new HashMap<>(); /** */ protected static final Collection nodes = new ArrayList<>(); @@ -62,7 +63,7 @@ public abstract class GridAbstractCommunicationSelfTest { + private class MessageListener implements CommunicationListener { /** */ private final UUID locNodeId; @@ -84,7 +85,7 @@ public abstract class GridAbstractCommunicationSelfTest spi : spis.values()) { + for (CommunicationSpi spi : spis.values()) { spi.onContextDestroyed(); spi.setListener(null); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index f36fa58..e1244a0 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -17,8 +17,8 @@ package org.apache.ignite.spi.communication; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.nio.*; import java.util.*; @@ -26,7 +26,7 @@ import java.util.*; /** * Test message for communication SPI tests. */ -public class GridTestMessage extends GridTcpCommunicationMessageAdapter { +public class GridTestMessage extends MessageAdapter { /** */ public static final byte DIRECT_TYPE = (byte)200; @@ -95,7 +95,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { /** {@inheritDoc} */ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public GridTcpCommunicationMessageAdapter clone() { + @Override public MessageAdapter clone() { GridTestMessage msg = new GridTestMessage(); clone0(msg); @@ -104,7 +104,7 @@ public class GridTestMessage extends GridTcpCommunicationMessageAdapter { } /** {@inheritDoc} */ - @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + @Override protected void clone0(MessageAdapter _msg) { GridTestMessage _clone = (GridTestMessage)_msg; _clone.srcNodeId = srcNodeId; diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java index f0ee2fe..27c98c9 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java @@ -22,11 +22,11 @@ import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.jdk.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; @@ -259,7 +259,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest { * @param obj Message being sent. * @param srcNodeId Sender node id. */ - private void checkAwaitMessageType(GridTcpCommunicationMessageAdapter obj, UUID srcNodeId) { + private void checkAwaitMessageType(MessageAdapter obj, UUID srcNodeId) { try { GridIoMessage plainMsg = (GridIoMessage)obj; @@ -277,7 +277,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override protected void notifyListener(UUID sndId, GridTcpCommunicationMessageAdapter msg, + @Override protected void notifyListener(UUID sndId, MessageAdapter msg, IgniteRunnable msgC) { checkAwaitMessageType(msg, sndId); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java index 4892db0..39bfe37 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java @@ -20,11 +20,12 @@ package org.apache.ignite.spi.communication.tcp; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.*; @@ -52,7 +53,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest spiRsrcs = new ArrayList<>(); /** */ - protected static final List> spis = new ArrayList<>(); + protected static final List> spis = new ArrayList<>(); /** */ protected static final List nodes = new ArrayList<>(); @@ -66,7 +67,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest { + private static class MessageListener implements CommunicationListener { /** */ private final CountDownLatch latch; @@ -100,7 +101,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest spi : spis) { + for (CommunicationSpi spi : spis) { spi.onContextDestroyed(); spi.setListener(null); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanTest.java index 0e974b0..1c68264 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiLanTest.java @@ -20,9 +20,9 @@ package org.apache.ignite.spi.communication.tcp; import mx4j.tools.adaptor.http.*; import org.apache.ignite.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.config.*; @@ -79,7 +79,7 @@ public class GridTcpCommunicationSpiLanTest extends GridSpiAbstractTest { + private class MessageListener implements CommunicationListener { /** Node id of local node. */ private final UUID locNodeId; @@ -100,7 +100,7 @@ public class GridTcpCommunicationSpiLanTest extends GridSpiAbstractTest spiRsrcs = new ArrayList<>(); /** SPIs */ - private static final Map> spis = + private static final Map> spis = new ConcurrentHashMap<>(); /** Listeners. */ @@ -74,7 +75,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS static { GridTcpCommunicationMessageFactory.registerCustom(new GridTcpCommunicationMessageProducer() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { + @Override public MessageAdapter create(byte type) { return new GridTestMessage(); } }, GridTestMessage.DIRECT_TYPE); @@ -93,7 +94,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS * Accumulating listener. */ @SuppressWarnings({"deprecation"}) - private static class MessageListener implements CommunicationListener { + private static class MessageListener implements CommunicationListener { /** Node id of local node. */ private final UUID locNodeId; @@ -113,7 +114,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS } /** {@inheritDoc} */ - @Override public void onMessage(UUID nodeId, GridTcpCommunicationMessageAdapter msg, IgniteRunnable msgC) { + @Override public void onMessage(UUID nodeId, MessageAdapter msg, IgniteRunnable msgC) { msgC.run(); if (msg instanceof GridTestMessage) { @@ -283,7 +284,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS try { for (ClusterNode node : nodes) { - GridTcpCommunicationMessageAdapter msg = + MessageAdapter msg = new GridTestMessage(from.id(), msgId.getAndIncrement(), 0); spis.get(from.id()).sendMessage(node, msg); @@ -331,7 +332,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS fut2.get(); // Wait when all messages are acknowledged to do not break next tests' logic. - for (CommunicationSpi spi : spis.values()) { + for (CommunicationSpi spi : spis.values()) { GridNioServer srv = U.field(spi, "nioSrvr"); Collection sessions = GridTestUtils.getFieldValue(srv, "sessions"); @@ -376,7 +377,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS ClusterNode to = nodes.get(1); - CommunicationSpi spi = spis.get(from.id()); + CommunicationSpi spi = spis.get(from.id()); while (cntr.getAndIncrement() < msgCnt) { GridTestMessage msg = new GridTestMessage(from.id(), msgId.getAndIncrement(), 0); @@ -414,7 +415,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS /** * @return Spi. */ - private CommunicationSpi newCommunicationSpi() { + private CommunicationSpi newCommunicationSpi() { TcpCommunicationSpi spi = new TcpCommunicationSpi(); if (!useShmem) @@ -445,7 +446,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS Map ctxs = new HashMap<>(); for (int i = 0; i < getSpiCount(); i++) { - CommunicationSpi spi = newCommunicationSpi(); + CommunicationSpi spi = newCommunicationSpi(); GridTestUtils.setFieldValue(spi, "gridName", "grid-" + i); @@ -520,7 +521,7 @@ public abstract class GridTcpCommunicationSpiMultithreadedSelfTest extends GridS /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { - for (CommunicationSpi spi : spis.values()) { + for (CommunicationSpi spi : spis.values()) { spi.onContextDestroyed(); spi.setListener(null); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java index 641805d..78e1b81 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java @@ -19,11 +19,12 @@ package org.apache.ignite.spi.communication.tcp; import org.apache.ignite.*; import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.*; @@ -57,7 +58,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest { + private class TestListener implements CommunicationListener { /** */ private ConcurrentHashSet msgIds = new ConcurrentHashSet<>(); @@ -80,7 +81,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest spi : spis) { + for (CommunicationSpi spi : spis) { spi.onContextDestroyed(); spi.setListener(null); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java index cdd6ef6..c2c1676 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java @@ -20,11 +20,12 @@ package org.apache.ignite.spi.communication.tcp; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.*; import org.apache.ignite.testframework.*; @@ -65,7 +66,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest */ static { GridTcpCommunicationMessageFactory.registerCustom(new GridTcpCommunicationMessageProducer() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { + @Override public MessageAdapter create(byte type) { return new GridTestMessage(); } }, GridTestMessage.DIRECT_TYPE); @@ -80,7 +81,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest /** */ @SuppressWarnings({"deprecation"}) - private class TestListener implements CommunicationListener { + private class TestListener implements CommunicationListener { /** */ private boolean block; @@ -94,7 +95,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest private AtomicInteger rcvCnt = new AtomicInteger(); /** {@inheritDoc} */ - @Override public void onMessage(UUID nodeId, GridTcpCommunicationMessageAdapter msg, IgniteRunnable msgC) { + @Override public void onMessage(UUID nodeId, MessageAdapter msg, IgniteRunnable msgC) { // info("Test listener received message: " + msg); assertTrue("Unexpected message: " + msg, msg instanceof GridTestMessage); @@ -703,7 +704,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest * @throws Exception If failed. */ private void stopSpis() throws Exception { - for (CommunicationSpi spi : spis) { + for (CommunicationSpi spi : spis) { spi.onContextDestroyed(); spi.setListener(null); diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index 137adf2..48d9e2d 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -21,15 +21,15 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.swapspace.*; -import org.gridgain.grid.util.direct.*; import org.jetbrains.annotations.*; import java.io.*; @@ -519,10 +519,10 @@ public class GridSpiTestContext implements IgniteSpiContext { /** {@inheritDoc} */ @Override public GridTcpMessageFactory messageFactory() { return new GridTcpMessageFactory() { - @Override public GridTcpCommunicationMessageAdapter create(byte type) { - GridTcpCommunicationMessageAdapter msg = GridTcpCommunicationMessageFactory.create(type); + @Override public MessageAdapter create(byte type) { + MessageAdapter msg = GridTcpCommunicationMessageFactory.create(type); - msg.setReader(new GridTcpCommunicationMessageReader(null)); + msg.setReader(new DirectMessageReader(null)); return msg; } diff --git a/modules/indexing/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java index a2b7ddf..e9bc33e 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java @@ -24,9 +24,9 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.processors.cache.query.*; -import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; @@ -165,7 +165,7 @@ public class GridOrderedMessageCancelSelfTest extends GridCommonAbstractTest { */ private static class CommunicationSpi extends TcpCommunicationSpi { /** {@inheritDoc} */ - @Override protected void notifyListener(UUID sndId, GridTcpCommunicationMessageAdapter msg, + @Override protected void notifyListener(UUID sndId, MessageAdapter msg, IgniteRunnable msgC) { try { GridIoMessage ioMsg = (GridIoMessage)msg; -- 1.9.3 (Apple Git-50) From e8302ce92a9a3bd8477f3e6696aa8436341bb418 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 20:12:53 -0800 Subject: [PATCH 33/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 218 ++-------- .../internal/direct/DirectByteBufferStream.java | 460 +++++++++++++++++++-- .../internal/direct/DirectMessageReader.java | 46 +++ .../internal/direct/DirectMessageWriter.java | 36 ++ .../ignite/internal/util/GridByteArrayList.java | 28 +- .../apache/ignite/internal/util/GridLongList.java | 29 +- .../apache/ignite/internal/util/GridUuidCache.java | 59 --- .../apache/ignite/internal/util/IgniteUtils.java | 26 +- .../ignite/internal/util/IgniteUuidCache.java | 59 +++ .../extensions/communication/MessageReader.java | 12 + .../extensions/communication/MessageWriter.java | 12 + 11 files changed, 707 insertions(+), 278 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/GridUuidCache.java create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index b43434f..7296ccc 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -155,17 +155,6 @@ public class CommunicationMessageCodeGenerator { else generate(cls); } - -// type = 0; -// -// for (Class cls : classes) { -// if (Modifier.isAbstract(cls.getModifiers())) -// continue; -// -// System.out.println("case " + type++ + ":"); -// System.out.println(" return new " + cls.getSimpleName() + "();"); -// System.out.println(); -// } } /** @@ -223,11 +212,6 @@ public class CommunicationMessageCodeGenerator { readFound = true; } -// else if (type >= 0 && line.contains("public byte directType()")) { -// src.add(TAB + TAB + "return " + type + ';'); -// -// skip = true; -// } else if (line.contains("public MessageAdapter clone()")) { src.addAll(clone); @@ -537,208 +521,66 @@ public class CommunicationMessageCodeGenerator { String field = raw ? "null" : '"' + name + '"'; if (type == byte.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByte", field, name); + returnFalseIfFailed(write, "writer.writeByte", field, name); else if (type == short.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putShort", field, name); + returnFalseIfFailed(write, "writer.writeShort", field, name); else if (type == int.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", field, name); + returnFalseIfFailed(write, "writer.writeInt", field, name); else if (type == long.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLong", field, name); + returnFalseIfFailed(write, "writer.writeLong", field, name); else if (type == float.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloat", field, name); + returnFalseIfFailed(write, "writer.writeFloat", field, name); else if (type == double.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDouble", field, name); + returnFalseIfFailed(write, "writer.writeDouble", field, name); else if (type == char.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putChar", field, name); + returnFalseIfFailed(write, "writer.writeChar", field, name); else if (type == boolean.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBoolean", field, name); + returnFalseIfFailed(write, "writer.writeBoolean", field, name); else if (type == byte[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArray", field, name); + returnFalseIfFailed(write, "writer.writeByteArray", field, name); else if (type == short[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putShortArray", field, name); + returnFalseIfFailed(write, "writer.writeShortArray", field, name); else if (type == int[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putIntArray", field, name); + returnFalseIfFailed(write, "writer.writeIntArray", field, name); else if (type == long[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongArray", field, name); + returnFalseIfFailed(write, "writer.writeLongArray", field, name); else if (type == float[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putFloatArray", field, name); + returnFalseIfFailed(write, "writer.writeFloatArray", field, name); else if (type == double[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDoubleArray", field, name); + returnFalseIfFailed(write, "writer.writeDoubleArray", field, name); else if (type == char[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putCharArray", field, name); + returnFalseIfFailed(write, "writer.writeCharArray", field, name); else if (type == boolean[].class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBooleanArray", field, name); + returnFalseIfFailed(write, "writer.writeBooleanArray", field, name); else if (type == UUID.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putUuid", field, name); - else if (type == ByteBuffer.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteBuffer", field, name); + returnFalseIfFailed(write, "writer.writeByteArray", field, "U.uuidToBytes(" + name + ")"); else if (type == IgniteUuid.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putGridUuid", field, name); - else if (type == GridClockDeltaVersion.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putClockDeltaVersion", field, name); + returnFalseIfFailed(write, "writer.writeByteArray", field, "U.igniteUuidToBytes(" + name + ")"); else if (type == GridByteArrayList.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putByteArrayList", field, name); + returnFalseIfFailed(write, "writer.writeByteArray", field, name); else if (type == GridLongList.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putLongList", field, name); - else if (type == GridCacheVersion.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putCacheVersion", field, name); - else if (type == GridDhtPartitionExchangeId.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putDhtPartitionExchangeId", field, name); - else if (type == GridCacheValueBytes.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putValueBytes", field, name); - //else if (type == GridDrInternalRequestEntry.class) - // returnFalseIfFailed(write, COMM_STATE_VAR + ".putDrInternalRequestEntry", field, name); + returnFalseIfFailed(write, "writer.writeLongList", field, name); else if (type == String.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putString", field, name); + returnFalseIfFailed(write, "writer.writeString", field, name); else if (type == BitSet.class) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putBitSet", field, name); + returnFalseIfFailed(write, "writer.writeBitSet", field, name); else if (type.isEnum()) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putEnum", field, name); + returnFalseIfFailed(write, "writer.writeEnum", field, name); else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfFailed(write, COMM_STATE_VAR + ".putMessage", field, name); - else if (type.isArray() || Collection.class.isAssignableFrom(type)) { - boolean isArr = type.isArray(); - - if (isArr) - colItemType = type.getComponentType(); - + returnFalseIfFailed(write, "writer.writeMessage", field, name); + else if (type.isArray()) + returnFalseIfFailed(write, "writer.writeArray", field, name); + else if (Collection.class.isAssignableFrom(type)) { assert colItemType != null; - write.add(builder().a("if (").a(name).a(" != null) {").toString()); - - indent++; - - write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + "." + (isArr ? "length" : "size()")); - - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = ").a(isArr ? "arrayIterator(" + name + ")" : name + ".iterator()"). - a(";").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). - toString()); - - indent++; - - write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); - - indent++; - - write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); - - indent--; - - write.add(EMPTY); - - returnFalseIfWriteFailed(colItemType, "(" + colItemType.getSimpleName() + ")" + CUR_VAR, - null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = null;").toString()); - - indent--; - - write.add(builder().a("} else {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); - - indent--; - - write.add(builder().a("}").toString()); + returnFalseIfFailed(write, "writer.writeCollection", field, name, colItemType.getSimpleName() + ".class"); } else if (Map.class.isAssignableFrom(type)) { assert mapKeyType != null; assert mapValType != null; - write.add(builder().a("if (").a(name).a(" != null) {").toString()); - - indent++; - - write.add(builder().a("if (").a(IT_VAR).a(" == null) {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", name + ".size()"); - - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = ").a(name).a(".entrySet().iterator();").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a("while (").a(IT_VAR).a(".hasNext() || ").a(CUR_VAR).a(" != NULL").a(") {"). - toString()); - - indent++; - - write.add(builder().a("if (").a(CUR_VAR).a(" == NULL)").toString()); - - indent++; - - write.add(builder().a(CUR_VAR).a(" = ").a(IT_VAR).a(".next();").toString()); - - indent--; - - String entryType = "Map.Entry<" + U.box(mapKeyType).getSimpleName() + ", " + - U.box(mapValType).getSimpleName() + ">"; - - write.add(EMPTY); - write.add(builder().a(entryType).a(" e = (").a(entryType).a(")").a(CUR_VAR).a(";").toString()); - write.add(EMPTY); - write.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); - - indent++; - - returnFalseIfWriteFailed(mapKeyType, "e.getKey()", null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - - returnFalseIfWriteFailed(mapValType, "e.getValue()", null, null, null, true); - - write.add(EMPTY); - write.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); - write.add(EMPTY); - write.add(builder().a(CUR_VAR).a(" = NULL;").toString()); - - indent--; - - write.add(builder().a("}").toString()); - write.add(EMPTY); - write.add(builder().a(IT_VAR).a(" = null;").toString()); - - indent--; - - write.add(builder().a("} else {").toString()); - - indent++; - - returnFalseIfFailed(write, COMM_STATE_VAR + ".putInt", "null", "-1"); - - indent--; - - write.add(builder().a("}").toString()); + returnFalseIfFailed(write, "writer.writeMap", field, name, mapKeyType.getSimpleName() + ".class", + mapValType.getSimpleName() + ".class"); } else throw new IllegalStateException("Unsupported type: " + type); 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 0f6a6f9..cbb8d4c 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 @@ -18,7 +18,6 @@ package org.apache.ignite.internal.direct; import org.apache.ignite.internal.util.*; -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.*; @@ -208,17 +207,38 @@ public class DirectByteBufferStream { private static final Object NULL = new Object(); /** */ - private static final Map, IgniteInClosure> WRITERS = U.newHashMap(8); - - /** */ - private static final Map, IgniteOutClosure> READERS = U.newHashMap(8); + private static final Map, Type> TYPES = U.newHashMap(30); static { - WRITERS.put(byte.class, new CI1() { - @Override public void apply(Object o) { - - } - }); + TYPES.put(byte.class, Type.BYTE); + TYPES.put(Byte.class, Type.BYTE); + TYPES.put(short.class, Type.SHORT); + TYPES.put(Short.class, Type.SHORT); + TYPES.put(int.class, Type.INT); + TYPES.put(Integer.class, Type.INT); + TYPES.put(long.class, Type.LONG); + TYPES.put(Long.class, Type.LONG); + TYPES.put(float.class, Type.FLOAT); + TYPES.put(Float.class, Type.FLOAT); + TYPES.put(double.class, Type.DOUBLE); + TYPES.put(Double.class, Type.DOUBLE); + TYPES.put(char.class, Type.CHAR); + TYPES.put(Character.class, Type.CHAR); + TYPES.put(boolean.class, Type.BOOLEAN); + TYPES.put(Boolean.class, Type.BOOLEAN); + TYPES.put(byte[].class, Type.BYTE_ARR); + TYPES.put(short[].class, Type.SHORT_ARR); + TYPES.put(int[].class, Type.INT_ARR); + TYPES.put(long[].class, Type.LONG_ARR); + TYPES.put(float[].class, Type.FLOAT_ARR); + TYPES.put(double[].class, Type.DOUBLE_ARR); + TYPES.put(char[].class, Type.CHAR_ARR); + TYPES.put(boolean[].class, Type.BOOLEAN_ARR); + TYPES.put(String.class, Type.STRING); + TYPES.put(BitSet.class, Type.BIT_SET); + TYPES.put(UUID.class, Type.UUID); + TYPES.put(IgniteUuid.class, Type.IGNITE_UUID); + TYPES.put(MessageAdapter.class, Type.MSG); } /** */ @@ -267,6 +287,9 @@ public class DirectByteBufferStream { private int readItems; /** */ + private Object[] objArr; + + /** */ private Collection col; /** */ @@ -485,6 +508,22 @@ public class DirectByteBufferStream { writeInt(-1); } + public void writeString(String val) { + writeByteArray(val != null ? val.getBytes() : null); + } + + public void writeBitSet(BitSet val) { + writeLongArray(val != null ? val.toLongArray() : null); + } + + public void writeUuid(UUID val) { + writeByteArray(val != null ? U.uuidToBytes(val) : null); + } + + public void writeIgniteUuid(IgniteUuid val) { + writeByteArray(val != null ? U.igniteUuidToBytes(val) : null); + } + /** * @param msg Message. */ @@ -495,6 +534,39 @@ public class DirectByteBufferStream { writeByte(Byte.MIN_VALUE); } + public void writeObjectArray(T[] arr, Class itemCls) { + if (arr != null) { + if (it == null) { + writeInt(arr.length); + + if (!lastFinished) + return; + + it = arrayIterator(arr); + } + + Type itemType = TYPES.get(itemCls); + + assert itemType != null; + + while (it.hasNext() || cur != NULL) { + if (cur == NULL) + cur = it.next(); + + write(itemType, cur); + + if (!lastFinished) + return; + + cur = NULL; + } + + it = null; + } + else + writeInt(-1); + } + public void writeCollection(Collection col, Class itemCls) { if (col != null) { if (it == null) { @@ -506,13 +578,15 @@ public class DirectByteBufferStream { it = col.iterator(); } - IgniteInClosure itemWriter = WRITERS.get(itemCls); + Type itemType = TYPES.get(itemCls); + + assert itemType != null; while (it.hasNext() || cur != NULL) { if (cur == NULL) cur = it.next(); - itemWriter.apply(cur); + write(itemType, cur); if (!lastFinished) return; @@ -526,6 +600,7 @@ public class DirectByteBufferStream { writeInt(-1); } + @SuppressWarnings("unchecked") public void writeMap(Map map, Class keyCls, Class valCls) { if (map != null) { if (it == null) { @@ -537,8 +612,11 @@ public class DirectByteBufferStream { it = map.entrySet().iterator(); } - IgniteInClosure keyWriter = WRITERS.get(keyCls); - IgniteInClosure valWriter = WRITERS.get(valCls); + Type keyType = TYPES.get(keyCls); + Type valType = TYPES.get(valCls); + + assert keyType != null; + assert valType != null; while (it.hasNext() || cur != NULL) { if (cur == NULL) @@ -547,7 +625,7 @@ public class DirectByteBufferStream { Map.Entry e = (Map.Entry)cur; if (!keyDone) { - keyWriter.apply(e.getKey()); + write(keyType, e.getKey()); if (!lastFinished) return; @@ -555,7 +633,7 @@ public class DirectByteBufferStream { keyDone = true; } - valWriter.apply(e.getValue()); + write(valType, e.getValue()); if (!lastFinished) return; @@ -738,6 +816,30 @@ public class DirectByteBufferStream { return readArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF); } + public String readString() { + byte[] arr = readByteArray(); + + return arr != null ? new String(arr) : null; + } + + public BitSet readBitSet() { + long[] arr = readLongArray(); + + return arr != null ? BitSet.valueOf(arr) : null; + } + + public UUID readUuid() { + byte[] arr = readByteArray(); + + return arr != null ? U.bytesToUuid(arr, 0) : null; + } + + public IgniteUuid readIgniteUuid() { + byte[] arr = readByteArray(); + + return arr != null ? U.bytesToIgniteUuid(arr, 0) : null; + } + /** * @return Message. */ @@ -770,6 +872,49 @@ public class DirectByteBufferStream { return null; } + @SuppressWarnings("unchecked") + public T[] readObjectArray(Class itemCls) { + if (readSize == -1) { + int size = readInt(); + + if (!lastFinished) + return null; + + readSize = size; + } + + if (readSize >= 0) { + if (objArr == null) + objArr = new Object[readSize]; + + Type itemType = TYPES.get(itemCls); + + assert itemType != null; + + for (int i = readItems; i < readSize; i++) { + Object item = read(itemType); + + if (!lastFinished) + return null; + + objArr[i] = item; + + readItems++; + } + } + + readSize = -1; + readItems = 0; + cur = null; + + T[] objArr0 = (T[])objArr; + + objArr = null; + + return objArr0; + } + + @SuppressWarnings("unchecked") public Collection readCollection(Class itemCls) { if (readSize == -1) { int size = readInt(); @@ -784,10 +929,12 @@ public class DirectByteBufferStream { if (col == null) col = new ArrayList<>(readSize); - IgniteOutClosure itemReader = READERS.get(itemCls); + Type itemType = TYPES.get(itemCls); + + assert itemType != null; for (int i = readItems; i < readSize; i++) { - Object item = itemReader.apply(); + Object item = read(itemType); if (!lastFinished) return null; @@ -800,10 +947,16 @@ public class DirectByteBufferStream { readSize = -1; readItems = 0; + cur = null; + + Collection col0 = (Collection)col; + + col = null; - return (Collection)col; + return col0; } + @SuppressWarnings("unchecked") public Map readMap(Class keyCls, Class valCls) { if (readSize == -1) { int size = readInt(); @@ -818,12 +971,15 @@ public class DirectByteBufferStream { if (map == null) map = U.newHashMap(readSize); - IgniteOutClosure keyReader = READERS.get(keyCls); - IgniteOutClosure valReader = READERS.get(valCls); + Type keyType = TYPES.get(keyCls); + Type valType = TYPES.get(valCls); + + assert keyType != null; + assert valType != null; for (int i = readItems; i < readSize; i++) { if (!keyDone) { - Object key = keyReader.apply(); + Object key = read(keyType); if (!lastFinished) return null; @@ -832,7 +988,7 @@ public class DirectByteBufferStream { keyDone = true; } - Object val = valReader.apply(); + Object val = read(valType); if (!lastFinished) return null; @@ -849,7 +1005,11 @@ public class DirectByteBufferStream { readItems = 0; cur = null; - return (Map)map; + Map map0 = (Map)map; + + map = null; + + return map0; } /** @@ -935,6 +1095,7 @@ public class DirectByteBufferStream { * @param len Length. * @return Array or special value if it was not fully read. */ + @SuppressWarnings("unchecked") private T readArray(ArrayCreator creator, int lenShift, long off, int len) { assert creator != null; @@ -996,6 +1157,213 @@ public class DirectByteBufferStream { } } + private void write(Type type, Object val) { + switch (type) { + case BYTE: + writeByte((Byte)val); + + break; + + case SHORT: + writeShort((Short)val); + + break; + + case INT: + writeInt((Integer)val); + + break; + + case LONG: + writeLong((Long)val); + + break; + + case FLOAT: + writeFloat((Float)val); + + break; + + case DOUBLE: + writeDouble((Double)val); + + break; + + case CHAR: + writeChar((Character)val); + + break; + + case BOOLEAN: + writeBoolean((Boolean)val); + + break; + + case BYTE_ARR: + writeByteArray((byte[])val); + + break; + + case SHORT_ARR: + writeShortArray((short[])val); + + break; + + case INT_ARR: + writeIntArray((int[])val); + + break; + + case LONG_ARR: + writeLongArray((long[])val); + + break; + + case FLOAT_ARR: + writeFloatArray((float[])val); + + break; + + case DOUBLE_ARR: + writeDoubleArray((double[])val); + + break; + + case CHAR_ARR: + writeCharArray((char[])val); + + break; + + case BOOLEAN_ARR: + writeBooleanArray((boolean[])val); + + break; + + case STRING: + writeString((String)val); + + break; + + case BIT_SET: + writeBitSet((BitSet)val); + + break; + + case UUID: + writeUuid((UUID)val); + + break; + + case IGNITE_UUID: + writeIgniteUuid((IgniteUuid)val); + + break; + + case MSG: + writeMessage((MessageAdapter)val); + + break; + + default: + throw new IllegalArgumentException("Unknown type: " + type); + } + } + + private Object read(Type type) { + switch (type) { + case BYTE: + return readByte(); + + case SHORT: + return readShort(); + + case INT: + return readInt(); + + case LONG: + return readLong(); + + case FLOAT: + return readFloat(); + + case DOUBLE: + return readDouble(); + + case CHAR: + return readChar(); + + case BOOLEAN: + return readBoolean(); + + case BYTE_ARR: + return readByteArray(); + + case SHORT_ARR: + return readShortArray(); + + case INT_ARR: + return readIntArray(); + + case LONG_ARR: + return readLongArray(); + + case FLOAT_ARR: + return readFloatArray(); + + case DOUBLE_ARR: + return readDoubleArray(); + + case CHAR_ARR: + return readCharArray(); + + case BOOLEAN_ARR: + return readBooleanArray(); + + case STRING: + return readString(); + + case BIT_SET: + return readBitSet(); + + case UUID: + return readUuid(); + + case IGNITE_UUID: + return readIgniteUuid(); + + case MSG: + return readMessage(); + + default: + throw new IllegalArgumentException("Unknown type: " + type); + } + } + + /** + * @param arr Array. + * @return Array iterator. + */ + private Iterator arrayIterator(final Object[] arr) { + return new Iterator() { + private int idx; + + @Override public boolean hasNext() { + return idx < arr.length; + } + + @Override public Object next() { + if (!hasNext()) + throw new NoSuchElementException(); + + return arr[idx++]; + } + + @Override public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + /** * Array creator. */ @@ -1006,4 +1374,48 @@ public class DirectByteBufferStream { */ public T create(int len); } + + private enum Type { + BYTE, + + SHORT, + + INT, + + LONG, + + FLOAT, + + DOUBLE, + + CHAR, + + BOOLEAN, + + BYTE_ARR, + + SHORT_ARR, + + INT_ARR, + + LONG_ARR, + + FLOAT_ARR, + + DOUBLE_ARR, + + CHAR_ARR, + + BOOLEAN_ARR, + + STRING, + + BIT_SET, + + UUID, + + IGNITE_UUID, + + MSG + } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java index 60c04d2..547c71a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.direct; +import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; @@ -190,6 +191,42 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ + @Override public String readString(String name) { + String val = stream.readString(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public BitSet readBitSet(String name) { + BitSet val = stream.readBitSet(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public UUID readUuid(String name) { + UUID val = stream.readUuid(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ + @Override public IgniteUuid readIgniteUuid(String name) { + IgniteUuid val = stream.readIgniteUuid(); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ @Nullable @Override public MessageAdapter readMessage(String name) { MessageAdapter msg = stream.readMessage(); @@ -199,6 +236,15 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ + @Override public T[] readObjectArray(String name, Class itemCls) { + T[] msg = stream.readObjectArray(itemCls); + + lastRead = stream.lastFinished(); + + return msg; + } + + /** {@inheritDoc} */ @Override public Collection readCollection(String name, Class itemCls) { Collection col = stream.readCollection(itemCls); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java index 120b148..d7c679d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.direct; +import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; @@ -148,6 +149,34 @@ public class DirectMessageWriter implements MessageWriter { } /** {@inheritDoc} */ + @Override public boolean writeString(String name, String val) { + stream.writeString(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeBitSet(String name, BitSet val) { + stream.writeBitSet(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeUuid(String name, UUID val) { + stream.writeUuid(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ + @Override public boolean writeIgniteUuid(String name, IgniteUuid val) { + stream.writeIgniteUuid(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ @Override public boolean writeMessage(String name, @Nullable MessageAdapter msg) { if (msg != null) msg.setWriter(this); @@ -158,6 +187,13 @@ public class DirectMessageWriter implements MessageWriter { } /** {@inheritDoc} */ + @Override public boolean writeObjectArray(String name, T[] arr, Class itemCls) { + stream.writeObjectArray(arr, itemCls); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ @Override public boolean writeCollection(String name, Collection col, Class itemCls) { stream.writeCollection(col, itemCls); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java index a9b7ffc..9cff49c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.util; import org.apache.ignite.internal.util.io.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import java.io.*; import java.nio.*; @@ -28,7 +29,7 @@ import java.util.*; /** * Re-sizable array implementation of the byte list (eliminating auto-boxing of primitive byte type). */ -public class GridByteArrayList implements Externalizable { +public class GridByteArrayList extends MessageAdapter implements Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -406,6 +407,31 @@ public class GridByteArrayList implements Externalizable { } /** {@inheritDoc} */ + @Override public boolean writeTo(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 0; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public MessageAdapter clone() { + return null; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override protected void clone0(MessageAdapter _msg) { + // TODO: implement. + } + + /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridByteArrayList.class, this); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java index d167e55..2525467 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java @@ -19,16 +19,18 @@ package org.apache.ignite.internal.util; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.plugin.extensions.communication.*; import org.jetbrains.annotations.*; import java.io.*; +import java.nio.*; import java.util.*; /** * Minimal list API to work with primitive longs. This list exists * to avoid boxing/unboxing when using standard list from Java. */ -public class GridLongList implements Externalizable { +public class GridLongList extends MessageAdapter implements Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -501,4 +503,29 @@ public class GridLongList implements Externalizable { else idx -= cnt; } + + /** {@inheritDoc} */ + @Override public boolean writeTo(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf) { + return false; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 0; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override public MessageAdapter clone() { + return null; // TODO: implement. + } + + /** {@inheritDoc} */ + @Override protected void clone0(MessageAdapter _msg) { + // TODO: implement. + } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUuidCache.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUuidCache.java deleted file mode 100644 index bbcb7db..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUuidCache.java +++ /dev/null @@ -1,59 +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.util; - -import java.util.*; -import java.util.concurrent.*; - -/** - * - */ -public final class GridUuidCache { - /** Maximum cache size. */ - private static final int MAX = 1024; - - /** Cache. */ - private static final ConcurrentMap cache = - new GridBoundedConcurrentLinkedHashMap<>(MAX, 1024, 0.75f, 64); - - /** - * Gets cached UUID to preserve memory. - * - * @param id Read UUID. - * @return Cached UUID equivalent to the read one. - */ - public static UUID onGridUuidRead(UUID id) { - UUID cached = cache.get(id); - - if (cached == null) { - UUID old = cache.putIfAbsent(id, cached = id); - - if (old != null) - cached = old; - } - - return cached; - } - - /** - * Ensure singleton. - */ - private GridUuidCache() { - // No-op. - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index a35a357..33a6e99 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -4423,7 +4423,7 @@ public abstract class IgniteUtils { long most = in.readLong(); long least = in.readLong(); - return GridUuidCache.onGridUuidRead(new UUID(most, least)); + return IgniteUuidCache.onIgniteUuidRead(new UUID(most, least)); } return null; @@ -4463,7 +4463,7 @@ public abstract class IgniteUtils { long most = in.readLong(); long least = in.readLong(); - UUID globalId = GridUuidCache.onGridUuidRead(new UUID(most, least)); + UUID globalId = IgniteUuidCache.onIgniteUuidRead(new UUID(most, least)); long locId = in.readLong(); @@ -4477,10 +4477,26 @@ public abstract class IgniteUtils { * Converts GridUuid to bytes. * * @param uuid GridUuid to convert. + * @return Bytes. + */ + public static byte[] igniteUuidToBytes(IgniteUuid uuid) { + assert uuid != null; + + byte[] out = new byte[24]; + + igniteUuidToBytes(uuid, out, 0); + + return out; + } + + /** + * Converts GridUuid to bytes. + * + * @param uuid GridUuid to convert. * @param out Output array to write to. * @param off Offset from which to write. */ - public static void gridUuidToBytes(IgniteUuid uuid, byte[] out, int off) { + public static void igniteUuidToBytes(IgniteUuid uuid, byte[] out, int off) { assert uuid != null; U.longToBytes(uuid.globalId().getMostSignificantBits(), out, off); @@ -4495,12 +4511,12 @@ public abstract class IgniteUtils { * @param off Offset from which start reading. * @return GridUuid instance. */ - public static IgniteUuid bytesToGridUuid(byte[] in, int off) { + public static IgniteUuid bytesToIgniteUuid(byte[] in, int off) { long most = U.bytesToLong(in, off); long least = U.bytesToLong(in, off + 8); long locId = U.bytesToLong(in, off + 16); - return new IgniteUuid(GridUuidCache.onGridUuidRead(new UUID(most, least)), locId); + return new IgniteUuid(IgniteUuidCache.onIgniteUuidRead(new UUID(most, least)), locId); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java new file mode 100644 index 0000000..045589c --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java @@ -0,0 +1,59 @@ +/* + * 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.util; + +import java.util.*; +import java.util.concurrent.*; + +/** + * + */ +public final class IgniteUuidCache { + /** Maximum cache size. */ + private static final int MAX = 1024; + + /** Cache. */ + private static final ConcurrentMap cache = + new GridBoundedConcurrentLinkedHashMap<>(MAX, 1024, 0.75f, 64); + + /** + * Gets cached UUID to preserve memory. + * + * @param id Read UUID. + * @return Cached UUID equivalent to the read one. + */ + public static UUID onIgniteUuidRead(UUID id) { + UUID cached = cache.get(id); + + if (cached == null) { + UUID old = cache.putIfAbsent(id, cached = id); + + if (old != null) + cached = old; + } + + return cached; + } + + /** + * Ensure singleton. + */ + private IgniteUuidCache() { + // No-op. + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index d09f00c..aa1c09b 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -9,6 +9,8 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.lang.*; + import java.nio.*; import java.util.*; @@ -50,8 +52,18 @@ public interface MessageReader { public boolean[] readBooleanArray(String name); + public String readString(String name); + + public BitSet readBitSet(String name); + + public UUID readUuid(String name); + + public IgniteUuid readIgniteUuid(String name); + public MessageAdapter readMessage(String name); + public T[] readObjectArray(String name, Class itemCls); + public Collection readCollection(String name, Class itemCls); public Map readMap(String name, Class keyCls, Class valCls); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index 5f7ddf9..19bb268 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -9,6 +9,8 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.lang.*; + import java.nio.*; import java.util.*; @@ -50,8 +52,18 @@ public interface MessageWriter { public boolean writeBooleanArray(String name, boolean[] val); + public boolean writeString(String name, String val); + + public boolean writeBitSet(String name, BitSet val); + + public boolean writeUuid(String name, UUID val); + + public boolean writeIgniteUuid(String name, IgniteUuid val); + public boolean writeMessage(String name, MessageAdapter val); + public boolean writeObjectArray(String name, T[] arr, Class itemCls); + public boolean writeCollection(String name, Collection col, Class itemCls); public boolean writeMap(String name, Map map, Class keyCls, Class valCls); -- 1.9.3 (Apple Git-50) From 43e19ee9b01cb6450348090de2a924cce466f603 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 21:00:55 -0800 Subject: [PATCH 34/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 296 ++++----------------- .../apache/ignite/internal/GridDirectVersion.java | 32 --- .../managers/communication/GridIoMessage.java | 2 +- ...ridCachePessimisticCheckCommittedTxRequest.java | 2 - .../cache/distributed/dht/GridDhtLockRequest.java | 3 - .../cache/distributed/dht/GridDhtLockResponse.java | 1 - .../distributed/dht/GridDhtTxFinishRequest.java | 2 - .../distributed/dht/GridDhtTxPrepareRequest.java | 3 - .../distributed/dht/GridDhtTxPrepareResponse.java | 1 - .../dht/atomic/GridDhtAtomicUpdateRequest.java | 7 - .../dht/atomic/GridDhtAtomicUpdateResponse.java | 1 - .../dht/atomic/GridNearAtomicUpdateRequest.java | 3 - .../dht/atomic/GridNearAtomicUpdateResponse.java | 4 - .../cache/distributed/near/GridNearGetRequest.java | 2 - .../distributed/near/GridNearLockRequest.java | 3 - .../distributed/near/GridNearTxFinishRequest.java | 3 - .../distributed/near/GridNearTxPrepareRequest.java | 2 - .../cache/query/GridCacheQueryRequest.java | 3 - .../communication/MessageReaderFactory.java | 2 +- .../communication/MessageWriterFactory.java | 2 +- 20 files changed, 59 insertions(+), 315 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/GridDirectVersion.java diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 7296ccc..b828d73 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -10,11 +10,6 @@ package org.apache.ignite.codegen; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; @@ -23,7 +18,6 @@ import org.jetbrains.annotations.*; import java.io.*; import java.lang.reflect.*; import java.net.*; -import java.nio.*; import java.util.*; import static java.lang.reflect.Modifier.*; @@ -35,27 +29,7 @@ public class CommunicationMessageCodeGenerator { /** */ private static final Comparator FIELD_CMP = new Comparator() { @Override public int compare(Field f1, Field f2) { - int ver1 = 0; - - GridDirectVersion verAnn1 = f1.getAnnotation(GridDirectVersion.class); - - if (verAnn1 != null) { - ver1 = verAnn1.value(); - - assert ver1 > 0; - } - - int ver2 = 0; - - GridDirectVersion verAnn2 = f2.getAnnotation(GridDirectVersion.class); - - if (verAnn2 != null) { - ver2 = verAnn2.value(); - - assert ver2 > 0; - } - - return ver1 < ver2 ? -1 : ver1 > ver2 ? 1 : f1.getName().compareTo(f2.getName()); + return f1.getName().compareTo(f2.getName()); } }; @@ -552,24 +526,22 @@ public class CommunicationMessageCodeGenerator { returnFalseIfFailed(write, "writer.writeCharArray", field, name); else if (type == boolean[].class) returnFalseIfFailed(write, "writer.writeBooleanArray", field, name); - else if (type == UUID.class) - returnFalseIfFailed(write, "writer.writeByteArray", field, "U.uuidToBytes(" + name + ")"); - else if (type == IgniteUuid.class) - returnFalseIfFailed(write, "writer.writeByteArray", field, "U.igniteUuidToBytes(" + name + ")"); - else if (type == GridByteArrayList.class) - returnFalseIfFailed(write, "writer.writeByteArray", field, name); - else if (type == GridLongList.class) - returnFalseIfFailed(write, "writer.writeLongList", field, name); else if (type == String.class) returnFalseIfFailed(write, "writer.writeString", field, name); else if (type == BitSet.class) returnFalseIfFailed(write, "writer.writeBitSet", field, name); + else if (type == UUID.class) + returnFalseIfFailed(write, "writer.writeUuid", field, name); + else if (type == IgniteUuid.class) + returnFalseIfFailed(write, "writer.writeIgniteUuid", field, name); else if (type.isEnum()) returnFalseIfFailed(write, "writer.writeEnum", field, name); else if (BASE_CLS.isAssignableFrom(type)) returnFalseIfFailed(write, "writer.writeMessage", field, name); - else if (type.isArray()) - returnFalseIfFailed(write, "writer.writeArray", field, name); + else if (type.isArray()) { + returnFalseIfFailed(write, "writer.writeObjectArray", field, name, + type.getComponentType().getSimpleName() + ".class"); + } else if (Collection.class.isAssignableFrom(type)) { assert colItemType != null; @@ -603,223 +575,65 @@ public class CommunicationMessageCodeGenerator { String retType = type.getSimpleName(); if (type == byte.class) - returnFalseIfReadFailed("byte", name, null, COMM_STATE_VAR + ".getByte", field, false); + returnFalseIfReadFailed("byte", name, "reader.readByte", field); else if (type == short.class) - returnFalseIfReadFailed("short", name, null, COMM_STATE_VAR + ".getShort", field, false); + returnFalseIfReadFailed("short", name, "reader.readShort", field); else if (type == int.class) - returnFalseIfReadFailed("int", name, null, COMM_STATE_VAR + ".getInt", field, false); + returnFalseIfReadFailed("int", name, "reader.readInt", field); else if (type == long.class) - returnFalseIfReadFailed("long", name, null, COMM_STATE_VAR + ".getLong", field, false); + returnFalseIfReadFailed("long", name, "reader.readLong", field); else if (type == float.class) - returnFalseIfReadFailed("float", name, null, COMM_STATE_VAR + ".getFloat", field, false); + returnFalseIfReadFailed("float", name, "reader.readFloat", field); else if (type == double.class) - returnFalseIfReadFailed("double", name, null, COMM_STATE_VAR + ".getDouble", field, false); + returnFalseIfReadFailed("double", name, "reader.readDouble", field); else if (type == char.class) - returnFalseIfReadFailed("char", name, null, COMM_STATE_VAR + ".getChar", field, false); + returnFalseIfReadFailed("char", name, "reader.readChar", field); else if (type == boolean.class) - returnFalseIfReadFailed("boolean", name, null, COMM_STATE_VAR + ".getBoolean", field, false); + returnFalseIfReadFailed("boolean", name, "reader.readBoolean", field); else if (type == byte[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readByteArray", field); else if (type == short[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getShortArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readShortArray", field); else if (type == int[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getIntArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readIntArray", field); else if (type == long[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readLongArray", field); else if (type == float[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getFloatArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readFloatArray", field); else if (type == double[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDoubleArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readDoubleArray", field); else if (type == char[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCharArray", field, false); + returnFalseIfReadFailed(retType, name, "reader.readCharArray", field); else if (type == boolean[].class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBooleanArray", field, false); - else if (type == UUID.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getUuid", field, false); - else if (type == ByteBuffer.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteBuffer", field, false); - else if (type == IgniteUuid.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getGridUuid", field, false); - else if (type == GridClockDeltaVersion.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getClockDeltaVersion", field, false); - else if (type == GridLongList.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getLongList", field, false); - else if (type == GridByteArrayList.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getByteArrayList", field, false); - else if (type == GridCacheVersion.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getCacheVersion", field, false); - else if (type == GridDhtPartitionExchangeId.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDhtPartitionExchangeId", field, false); - else if (type == GridCacheValueBytes.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getValueBytes", field, false); - //else if (type == GridDrInternalRequestEntry.class) - // returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getDrInternalRequestEntry", field, false); + returnFalseIfReadFailed(retType, name, "reader.readBooleanArray", field); else if (type == String.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getString", field, false); + returnFalseIfReadFailed(retType, name, "reader.readString", field); else if (type == BitSet.class) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getBitSet", field, false); - else if (type.isEnum()) { - assert name != null; - - returnFalseIfReadFailed("byte", null, name + "0", COMM_STATE_VAR + ".getByte", field, false); - - read.add(EMPTY); - read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(name).a("0);").toString()); - } + returnFalseIfReadFailed(retType, name, "reader.readBitSet", field); + else if (type == UUID.class) + returnFalseIfReadFailed(retType, name, "reader.readUuid", field); + else if (type == IgniteUuid.class) + returnFalseIfReadFailed(retType, name, "reader.readGridUuid", field); + else if (type.isEnum()) + returnFalseIfReadFailed(retType, name, "reader.readEnum", field); else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfReadFailed(retType, name, null, COMM_STATE_VAR + ".getMessage", field, true); - else if (type.isArray() || Collection.class.isAssignableFrom(type)) { - assert name != null; - - boolean isArr = type.isArray(); - - if (isArr) - colItemType = type.getComponentType(); - + returnFalseIfReadFailed(retType, name, "reader.readMessage", field); + else if (type.isArray()) { + returnFalseIfReadFailed(retType, name, "reader.readObjectArray", field, + type.getComponentType().getSimpleName() + ".class"); + } + else if (Collection.class.isAssignableFrom(type)) { assert colItemType != null; - Class colType = Set.class.isAssignableFrom(type) ? HashSet.class : ArrayList.class; - - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); - - indent++; - - returnFalseIfReadFailed(int.class, null, null, null, null, true); - - read.add(builder().a(READ_SIZE_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); - - indent++; - - read.add(builder().a("if (").a(name).a(" == null)").toString()); - - indent++; - - if (isArr) { - String val = colItemType.isArray() ? - colItemType.getComponentType().getSimpleName() + "[" + READ_SIZE_VAR + "][]" : - colItemType.getSimpleName() + "[" + READ_SIZE_VAR + "]"; - - read.add(builder().a(name).a(" = new ").a(val).a(";"). - toString()); - } - else { - read.add(builder().a(name).a(" = new ").a(colType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(");"). - toString()); - } - - indent--; - - read.add(EMPTY); - read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). - toString()); - - indent++; - - String var = colItemType.isPrimitive() ? colItemType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(colItemType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(name).a(isArr ? "[i] = " : ".add(").a("(").a(U.box(colItemType).getSimpleName()). - a(")").a(DFLT_LOC_VAR).a(isArr ? ";" : ");").toString()); - read.add(EMPTY); - read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); - read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); + returnFalseIfReadFailed(retType, name, "reader.readCollection", field, + colItemType.getSimpleName() + ".class"); } else if (Map.class.isAssignableFrom(type)) { - assert name != null; assert mapKeyType != null; assert mapValType != null; - Class mapType = LinkedHashMap.class.isAssignableFrom(type) ? LinkedHashMap.class : HashMap.class; - - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" == -1) {").toString()); - - indent++; - - returnFalseIfReadFailed(int.class, null, null, null, null, true); - - read.add(builder().a(READ_SIZE_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a("if (").a(READ_SIZE_VAR).a(" >= 0) {").toString()); - - indent++; - - read.add(builder().a("if (").a(name).a(" == null)").toString()); - - indent++; - - read.add(builder().a(name).a(" = new ").a(mapType.getSimpleName()).a("<>(").a(READ_SIZE_VAR).a(", 1.0f);"). - toString()); - - indent--; - - read.add(EMPTY); - read.add(builder().a("for (int i = ").a(READ_ITEMS_VAR).a("; i < ").a(READ_SIZE_VAR).a("; i++) {"). - toString()); - - indent++; - - read.add(builder().a("if (!").a(KEY_DONE_VAR).a(") {").toString()); - - indent++; - - String var = mapKeyType.isPrimitive() ? mapKeyType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(mapKeyType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(CUR_VAR).a(" = ").a(DFLT_LOC_VAR).a(";").toString()); - read.add(builder().a(KEY_DONE_VAR).a(" = true;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - - var = mapValType.isPrimitive() ? mapValType.getSimpleName() + " " + DFLT_LOC_VAR : null; - - returnFalseIfReadFailed(mapValType, var, null, null, null, true); - - read.add(EMPTY); - read.add(builder().a(name).a(".put((").a(U.box(mapKeyType).getSimpleName()).a(")").a(CUR_VAR). - a(", ").a(DFLT_LOC_VAR).a(");").toString()); - read.add(EMPTY); - read.add(builder().a(KEY_DONE_VAR).a(" = false;").toString()); - read.add(EMPTY); - read.add(builder().a(READ_ITEMS_VAR).a("++;").toString()); - - indent--; - - read.add(builder().a("}").toString()); - - indent--; - - read.add(builder().a("}").toString()); - read.add(EMPTY); - read.add(builder().a(READ_SIZE_VAR).a(" = -1;").toString()); - read.add(builder().a(READ_ITEMS_VAR).a(" = 0;").toString()); - read.add(builder().a(CUR_VAR).a(" = null;").toString()); + returnFalseIfReadFailed(retType, name, "reader.readMap", field, mapKeyType.getSimpleName() + ".class", + mapValType.getSimpleName() + ".class"); } else throw new IllegalStateException("Unsupported type: " + type); @@ -828,24 +642,26 @@ public class CommunicationMessageCodeGenerator { /** * @param retType Return type. * @param var Variable name. - * @param locVar Local variable name. * @param mtd Method name. - * @param arg Method argument. - * @param cast Whether cast is needed. + * @param args Method arguments. */ - private void returnFalseIfReadFailed(String retType, @Nullable String var, @Nullable String locVar, String mtd, - @Nullable String arg, boolean cast) { + private void returnFalseIfReadFailed(String retType, String var, String mtd, @Nullable String... args) { assert retType != null; assert mtd != null; - if (var == null) - var = retType + " " + (locVar != null ? locVar : DFLT_LOC_VAR); + String argsStr = ""; + + if (args != null && args.length > 0) { + for (String arg : args) + argsStr += arg + ", "; + + argsStr = argsStr.substring(0, argsStr.length() - 2); + } - read.add(builder().a(var).a(" = ").a(cast ? "(" + retType + ")" : "").a(mtd). - a(arg != null ? "(" + arg + ");" : "();").toString()); + read.add(builder().a(var).a(" = ").a(mtd).a("(").a(argsStr).a(");").toString()); read.add(EMPTY); - read.add(builder().a("if (!").a(COMM_STATE_VAR).a(".lastRead())").toString()); + read.add(builder().a("if (!reader.lastRead())").toString()); indent++; @@ -872,7 +688,7 @@ public class CommunicationMessageCodeGenerator { argsStr = argsStr.substring(0, argsStr.length() - 2); } - code.add(builder().a("if (!").a(accessor).a("(" + argsStr + ")").a(")").toString()); + code.add(builder().a("if (!").a(accessor).a("(").a(argsStr).a("))").toString()); indent++; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridDirectVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/GridDirectVersion.java deleted file mode 100644 index b9566c5..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridDirectVersion.java +++ /dev/null @@ -1,32 +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; - -import java.lang.annotation.*; - -/** - * Assigns version to a field. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface GridDirectVersion { - /** - * @return Version index (must be above zero). - */ - int value(); -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java index cf908e8..5dc52d8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java @@ -270,7 +270,7 @@ public class GridIoMessage extends MessageAdapter { switch (commState.idx) { case 0: - msg = (MessageAdapter)commState.getMessage("msg"); + msg = commState.getMessage("msg"); if (!commState.lastRead()) return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index 4eb5624..bd5f826 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.distributed; -import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -52,7 +51,6 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr private long originatingThreadId; /** Flag indicating that this is near-only check. */ - @GridDirectVersion(1) private boolean nearOnlyCheck; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java index 3c72a2f..7a99720 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java @@ -71,15 +71,12 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { private long topVer; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** Indexes of keys needed to be preloaded. */ - @GridDirectVersion(3) private BitSet preloadKeys; /** TTL for read operation. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index eea4b85..f301a8f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -63,7 +63,6 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** */ @GridDirectCollection(byte[].class) - @GridDirectVersion(1) private List preloadEntriesBytes; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 1a53250..f814c5d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -78,11 +78,9 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest private GridCacheVersion writeVer; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** TTLs for optimistic transaction. */ 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 47c2a48..d7af780 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 @@ -80,14 +80,11 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque private boolean last; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; - @GridDirectVersion(3) /** Preload keys. */ private BitSet preloadKeys; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index 51d179f..fd6c0b4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -65,7 +65,6 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp /** */ @GridDirectCollection(byte[].class) - @GridDirectVersion(1) private List preloadEntriesBytes; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 8d4d36e..c69fc6e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -102,7 +102,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** Key bytes. */ @GridToStringInclude @GridDirectCollection(byte[].class) - @GridDirectVersion(1) private List nearKeyBytes; /** Values to update. */ @@ -113,11 +112,9 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** Value bytes. */ @GridToStringInclude @GridDirectCollection(GridCacheValueBytes.class) - @GridDirectVersion(1) private List nearValBytes; /** Force transform backups flag. */ - @GridDirectVersion(2) private boolean forceTransformBackups; /** Entry processors. */ @@ -126,7 +123,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** Entry processors bytes. */ @GridDirectCollection(byte[].class) - @GridDirectVersion(2) private List entryProcessorsBytes; /** Near entry processors. */ @@ -135,7 +131,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** Near entry processors bytes. */ @GridDirectCollection(byte[].class) - @GridDirectVersion(2) private List nearEntryProcessorsBytes; /** Optional arguments for entry processor. */ @@ -146,11 +141,9 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp private byte[][] invokeArgsBytes; /** Subject ID. */ - @GridDirectVersion(3) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(4) private int taskNameHash; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 41a48a1..afd013c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -65,7 +65,6 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im /** Evicted reader key bytes. */ @GridDirectCollection(byte[].class) - @GridDirectVersion(1) private Collection nearEvictedBytes; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index 2726a6d..f700649 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -125,15 +125,12 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im private boolean hasPrimary; /** Force transform backups flag. */ - @GridDirectVersion(2) private boolean forceTransformBackups; /** Subject ID. */ - @GridDirectVersion(3) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(4) private int taskNameHash; /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index fdfde26..d91e800 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -81,12 +81,10 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */ @GridDirectCollection(int.class) - @GridDirectVersion(1) private List nearValsIdxs; /** Indexes of keys for which update was skipped (used if originating node has near cache). */ @GridDirectCollection(int.class) - @GridDirectVersion(1) private List nearSkipIdxs; /** Values generated on primary node which should be put to originating node's near cache. */ @@ -97,11 +95,9 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** Serialized values generated on primary node which should be put to originating node's near cache. */ @GridToStringInclude @GridDirectCollection(GridCacheValueBytes.class) - @GridDirectVersion(1) private List nearValBytes; /** Version generated on primary node to be used for originating node's near cache update. */ - @GridDirectVersion(1) private GridCacheVersion nearVer; /** Near TTLs. */ 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 c99a65e..f8c5cc2 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 @@ -76,11 +76,9 @@ public class GridNearGetRequest extends GridCacheMessage implements private IgnitePredicate>[] filter; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** TTL for read operation. */ 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 d6455dd..da008ac 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 @@ -69,15 +69,12 @@ public class GridNearLockRequest extends GridDistributedLockRequest private GridCacheVersion[] dhtVers; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** Has transforms flag. */ - @GridDirectVersion(3) private boolean hasTransforms; /** Sync commit flag. */ 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 e2be312..a462751 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 @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near; -import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.processors.cache.version.*; @@ -50,11 +49,9 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques private long topVer; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** 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 f0ffa4e..1cd7ce0 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 @@ -58,11 +58,9 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ private Collection lastBackups; /** Subject ID. */ - @GridDirectVersion(1) private UUID subjId; /** Task name hash. */ - @GridDirectVersion(2) private int taskNameHash; /** 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 5f1552f..2893f4f 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 @@ -109,15 +109,12 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen private boolean all; /** */ - @GridDirectVersion(1) private boolean keepPortable; /** */ - @GridDirectVersion(2) private UUID subjId; /** */ - @GridDirectVersion(2) private int taskHash; /** diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java index 70dc3dc..65c4a33 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java @@ -14,6 +14,6 @@ import org.apache.ignite.plugin.*; /** * TODO */ -public interface MessageReaderFactory extends IgniteExtension { +public interface MessageReaderFactory extends Extension { public MessageReader reader(); } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java index 47b5a34..9214337 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java @@ -14,6 +14,6 @@ import org.apache.ignite.plugin.*; /** * TODO */ -public interface MessageWriterFactory extends IgniteExtension { +public interface MessageWriterFactory extends Extension { public MessageWriter writer(); } -- 1.9.3 (Apple Git-50) From 39fcfb630672dff86780d4c7826af6f27429990b Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 21:52:24 -0800 Subject: [PATCH 35/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 58 ++++++++-------------- .../internal/direct/DirectByteBufferStream.java | 11 ++++ .../internal/direct/DirectMessageReader.java | 9 ++++ .../internal/direct/DirectMessageWriter.java | 7 +++ .../extensions/communication/MessageAdapter.java | 6 +++ .../extensions/communication/MessageReader.java | 2 + .../extensions/communication/MessageWriter.java | 2 + 7 files changed, 58 insertions(+), 37 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index b828d73..b8c6aa9 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -34,6 +34,12 @@ public class CommunicationMessageCodeGenerator { }; /** */ + private static final String[] EXCLUDED_PACKAGES = new String[] { + "org.apache.ignite.internal.processors.rest.client.message", + "org.apache.ignite.internal.processors.rest.protocols.tcp" + }; + + /** */ private static final String SRC_DIR = U.getIgniteHome() + "/modules/core/src/main/java"; /** */ @@ -46,34 +52,13 @@ public class CommunicationMessageCodeGenerator { private static final String TAB = " "; /** */ - private static final String COMM_STATE_VAR = "commState"; - - /** */ private static final String BUF_VAR = "buf"; /** */ - private static final String STATE_VAR = COMM_STATE_VAR + "." + "idx"; - - /** */ - private static final String TYPE_WRITTEN_VAR = COMM_STATE_VAR + "." + "typeWritten"; - - /** */ - private static final String IT_VAR = COMM_STATE_VAR + "." + "it"; - - /** */ - private static final String CUR_VAR = COMM_STATE_VAR + "." + "cur"; + private static final String STATE_VAR = "state"; /** */ - private static final String KEY_DONE_VAR = COMM_STATE_VAR + "." + "keyDone"; - - /** */ - private static final String READ_SIZE_VAR = COMM_STATE_VAR + "." + "readSize"; - - /** */ - private static final String READ_ITEMS_VAR = COMM_STATE_VAR + "." + "readItems"; - - /** */ - private static final String DFLT_LOC_VAR = "_val"; + private static final String TYPE_WRITTEN_VAR = "typeWritten"; /** */ private final Collection write = new ArrayList<>(); @@ -297,14 +282,8 @@ public class CommunicationMessageCodeGenerator { for (Field field : cloningFields) { String name = field.getName(); - Class type = field.getType(); - - String res = name; - - if (BASE_CLS.isAssignableFrom(type)) - res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; - clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); + clone0.add(builder().a("_clone.").a(name).a(" = ").a(name).a(";").toString()); } } @@ -359,12 +338,12 @@ public class CommunicationMessageCodeGenerator { /** * @param code Code lines. * @param superMtd Super class method name. - * @param writeType Whether to write message type. + * @param write Whether write code is generated. */ - private void start(Collection code, @Nullable String superMtd, boolean writeType) { + private void start(Collection code, @Nullable String superMtd, boolean write) { assert code != null; - code.add(builder().a(COMM_STATE_VAR).a(".setBuffer(").a(BUF_VAR).a(");").toString()); + code.add(builder().a(write ? "writer" : "reader").a(".setBuffer(").a(BUF_VAR).a(");").toString()); code.add(EMPTY); if (superMtd != null) { @@ -373,12 +352,12 @@ public class CommunicationMessageCodeGenerator { code.add(EMPTY); } - if (writeType) { + if (write) { code.add(builder().a("if (!").a(TYPE_WRITTEN_VAR).a(") {").toString()); indent++; - returnFalseIfFailed(code, COMM_STATE_VAR + ".putByte", "null", "directType()"); + returnFalseIfFailed(code, "writer.writeByte", "null", "directType()"); code.add(EMPTY); code.add(builder().a(TYPE_WRITTEN_VAR).a(" = true;").toString()); @@ -537,7 +516,7 @@ public class CommunicationMessageCodeGenerator { else if (type.isEnum()) returnFalseIfFailed(write, "writer.writeEnum", field, name); else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfFailed(write, "writer.writeMessage", field, name); + returnFalseIfFailed(write, "writer.writeMessage", field, name + " != null ? " + name + ".clone() : null"); else if (type.isArray()) { returnFalseIfFailed(write, "writer.writeObjectArray", field, name, type.getComponentType().getSimpleName() + ".class"); @@ -615,7 +594,7 @@ public class CommunicationMessageCodeGenerator { else if (type == IgniteUuid.class) returnFalseIfReadFailed(retType, name, "reader.readGridUuid", field); else if (type.isEnum()) - returnFalseIfReadFailed(retType, name, "reader.readEnum", field); + returnFalseIfReadFailed(retType, name, "reader.readEnum", field, retType + ".class"); else if (BASE_CLS.isAssignableFrom(type)) returnFalseIfReadFailed(retType, name, "reader.readMessage", field); else if (type.isArray()) { @@ -776,6 +755,11 @@ public class CommunicationMessageCodeGenerator { if (path.endsWith(".class")) { String clsName = path.substring(prefixLen, path.length() - 6).replace(File.separatorChar, '.'); + for (String excluded : EXCLUDED_PACKAGES) { + if (clsName.startsWith(excluded)) + return; + } + Class cls = Class.forName(clsName, false, ldr); if (cls.getDeclaringClass() == null && cls.getEnclosingClass() == null && 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 cbb8d4c..e674861 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 @@ -524,6 +524,10 @@ public class DirectByteBufferStream { writeByteArray(val != null ? U.igniteUuidToBytes(val) : null); } + public void writeEnum(Enum val) { + writeByte(val != null ? (byte)val.ordinal() : -1); + } + /** * @param msg Message. */ @@ -840,6 +844,13 @@ public class DirectByteBufferStream { return arr != null ? U.bytesToIgniteUuid(arr, 0) : null; } + @SuppressWarnings("unchecked") + public > Enum readEnum(Class enumCls) { + byte ord = readByte(); + + return ord >= 0 ? (Enum)GridEnumCache.get(enumCls)[ord] : null; + } + /** * @return Message. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java index 547c71a..3875cfe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java @@ -227,6 +227,15 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ + @Override public > Enum readEnum(String name, Class enumCls) { + Enum val = stream.readEnum(enumCls); + + lastRead = stream.lastFinished(); + + return val; + } + + /** {@inheritDoc} */ @Nullable @Override public MessageAdapter readMessage(String name) { MessageAdapter msg = stream.readMessage(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java index d7c679d..e5f005d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java @@ -177,6 +177,13 @@ public class DirectMessageWriter implements MessageWriter { } /** {@inheritDoc} */ + @Override public boolean writeEnum(String name, Enum val) { + stream.writeEnum(val); + + return stream.lastFinished(); + } + + /** {@inheritDoc} */ @Override public boolean writeMessage(String name, @Nullable MessageAdapter msg) { if (msg != null) msg.setWriter(this); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java index 89d26fc..2234698 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java @@ -41,6 +41,12 @@ public abstract class MessageAdapter implements Serializable, Cloneable { /** Reader. */ protected MessageReader reader; + /** */ + protected boolean typeWritten; + + /** */ + protected int state; + /** * @param writer Writer. */ diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index aa1c09b..fa4ca66 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -60,6 +60,8 @@ public interface MessageReader { public IgniteUuid readIgniteUuid(String name); + public > Enum readEnum(String name, Class enumCls); + public MessageAdapter readMessage(String name); public T[] readObjectArray(String name, Class itemCls); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java index 19bb268..fc348ee 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java @@ -60,6 +60,8 @@ public interface MessageWriter { public boolean writeIgniteUuid(String name, IgniteUuid val); + public boolean writeEnum(String name, Enum val); + public boolean writeMessage(String name, MessageAdapter val); public boolean writeObjectArray(String name, T[] arr, Class itemCls); -- 1.9.3 (Apple Git-50) From 215268fe5c8461c65fc93868e21bba45e415072d Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 22:17:36 -0800 Subject: [PATCH 36/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 65 ++++++++++------------ .../internal/direct/DirectByteBufferStream.java | 13 +++-- .../internal/direct/DirectMessageReader.java | 12 ++-- .../extensions/communication/MessageReader.java | 6 +- 4 files changed, 46 insertions(+), 50 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index b8c6aa9..45a383c 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -449,7 +449,7 @@ public class CommunicationMessageCodeGenerator { indent++; returnFalseIfReadFailed(field.getType(), field.getName(), colAnn != null ? colAnn.value() : null, - mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null, false); + mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null); read.add(EMPTY); read.add(builder().a(STATE_VAR).a("++;").toString()); @@ -543,75 +543,72 @@ public class CommunicationMessageCodeGenerator { * @param colItemType Collection item type. * @param mapKeyType Map key type. * @param mapValType Map value type. - * @param raw Raw read flag. */ private void returnFalseIfReadFailed(Class type, @Nullable String name, @Nullable Class colItemType, - @Nullable Class mapKeyType, @Nullable Class mapValType, boolean raw) { + @Nullable Class mapKeyType, @Nullable Class mapValType) { assert type != null; - String field = raw ? "null" : '"' + name + '"'; - - String retType = type.getSimpleName(); + String field = '"' + name + '"'; if (type == byte.class) - returnFalseIfReadFailed("byte", name, "reader.readByte", field); + returnFalseIfReadFailed(name, "reader.readByte", field); else if (type == short.class) - returnFalseIfReadFailed("short", name, "reader.readShort", field); + returnFalseIfReadFailed(name, "reader.readShort", field); else if (type == int.class) - returnFalseIfReadFailed("int", name, "reader.readInt", field); + returnFalseIfReadFailed(name, "reader.readInt", field); else if (type == long.class) - returnFalseIfReadFailed("long", name, "reader.readLong", field); + returnFalseIfReadFailed(name, "reader.readLong", field); else if (type == float.class) - returnFalseIfReadFailed("float", name, "reader.readFloat", field); + returnFalseIfReadFailed(name, "reader.readFloat", field); else if (type == double.class) - returnFalseIfReadFailed("double", name, "reader.readDouble", field); + returnFalseIfReadFailed(name, "reader.readDouble", field); else if (type == char.class) - returnFalseIfReadFailed("char", name, "reader.readChar", field); + returnFalseIfReadFailed(name, "reader.readChar", field); else if (type == boolean.class) - returnFalseIfReadFailed("boolean", name, "reader.readBoolean", field); + returnFalseIfReadFailed(name, "reader.readBoolean", field); else if (type == byte[].class) - returnFalseIfReadFailed(retType, name, "reader.readByteArray", field); + returnFalseIfReadFailed(name, "reader.readByteArray", field); else if (type == short[].class) - returnFalseIfReadFailed(retType, name, "reader.readShortArray", field); + returnFalseIfReadFailed(name, "reader.readShortArray", field); else if (type == int[].class) - returnFalseIfReadFailed(retType, name, "reader.readIntArray", field); + returnFalseIfReadFailed(name, "reader.readIntArray", field); else if (type == long[].class) - returnFalseIfReadFailed(retType, name, "reader.readLongArray", field); + returnFalseIfReadFailed(name, "reader.readLongArray", field); else if (type == float[].class) - returnFalseIfReadFailed(retType, name, "reader.readFloatArray", field); + returnFalseIfReadFailed(name, "reader.readFloatArray", field); else if (type == double[].class) - returnFalseIfReadFailed(retType, name, "reader.readDoubleArray", field); + returnFalseIfReadFailed(name, "reader.readDoubleArray", field); else if (type == char[].class) - returnFalseIfReadFailed(retType, name, "reader.readCharArray", field); + returnFalseIfReadFailed(name, "reader.readCharArray", field); else if (type == boolean[].class) - returnFalseIfReadFailed(retType, name, "reader.readBooleanArray", field); + returnFalseIfReadFailed(name, "reader.readBooleanArray", field); else if (type == String.class) - returnFalseIfReadFailed(retType, name, "reader.readString", field); + returnFalseIfReadFailed(name, "reader.readString", field); else if (type == BitSet.class) - returnFalseIfReadFailed(retType, name, "reader.readBitSet", field); + returnFalseIfReadFailed(name, "reader.readBitSet", field); else if (type == UUID.class) - returnFalseIfReadFailed(retType, name, "reader.readUuid", field); + returnFalseIfReadFailed(name, "reader.readUuid", field); else if (type == IgniteUuid.class) - returnFalseIfReadFailed(retType, name, "reader.readGridUuid", field); + returnFalseIfReadFailed(name, "reader.readIgniteUuid", field); else if (type.isEnum()) - returnFalseIfReadFailed(retType, name, "reader.readEnum", field, retType + ".class"); + returnFalseIfReadFailed(name, "reader.readEnum", field, type.getSimpleName() + ".class"); else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfReadFailed(retType, name, "reader.readMessage", field); + returnFalseIfReadFailed(name, "reader.readMessage", field); else if (type.isArray()) { - returnFalseIfReadFailed(retType, name, "reader.readObjectArray", field, + returnFalseIfReadFailed(name, "reader.readObjectArray", field, type.getComponentType().getSimpleName() + ".class"); } else if (Collection.class.isAssignableFrom(type)) { assert colItemType != null; - returnFalseIfReadFailed(retType, name, "reader.readCollection", field, + returnFalseIfReadFailed(name, "reader.readCollection", field, colItemType.getSimpleName() + ".class"); } else if (Map.class.isAssignableFrom(type)) { assert mapKeyType != null; assert mapValType != null; - returnFalseIfReadFailed(retType, name, "reader.readMap", field, mapKeyType.getSimpleName() + ".class", + returnFalseIfReadFailed(name, "reader.readMap", field, mapKeyType.getSimpleName() + ".class", mapValType.getSimpleName() + ".class"); } else @@ -619,13 +616,11 @@ public class CommunicationMessageCodeGenerator { } /** - * @param retType Return type. * @param var Variable name. * @param mtd Method name. * @param args Method arguments. */ - private void returnFalseIfReadFailed(String retType, String var, String mtd, @Nullable String... args) { - assert retType != null; + private void returnFalseIfReadFailed(String var, String mtd, @Nullable String... args) { assert mtd != null; String argsStr = ""; @@ -640,7 +635,7 @@ public class CommunicationMessageCodeGenerator { read.add(builder().a(var).a(" = ").a(mtd).a("(").a(argsStr).a(");").toString()); read.add(EMPTY); - read.add(builder().a("if (!reader.lastRead())").toString()); + read.add(builder().a("if (!reader.isLastRead())").toString()); indent++; 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 e674861..3234a64 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 @@ -845,16 +845,17 @@ public class DirectByteBufferStream { } @SuppressWarnings("unchecked") - public > Enum readEnum(Class enumCls) { + public > T readEnum(Class enumCls) { byte ord = readByte(); - return ord >= 0 ? (Enum)GridEnumCache.get(enumCls)[ord] : null; + return ord >= 0 ? (T)GridEnumCache.get(enumCls)[ord] : null; } /** * @return Message. */ - public MessageAdapter readMessage() { + @SuppressWarnings("unchecked") + public T readMessage() { if (!msgTypeDone) { if (!buf.hasRemaining()) { lastFinished = false; @@ -877,7 +878,7 @@ public class DirectByteBufferStream { msgTypeDone = false; msg = null; - return msg0; + return (T)msg0; } else return null; @@ -926,7 +927,7 @@ public class DirectByteBufferStream { } @SuppressWarnings("unchecked") - public Collection readCollection(Class itemCls) { + public , T> C readCollection(Class itemCls) { if (readSize == -1) { int size = readInt(); @@ -964,7 +965,7 @@ public class DirectByteBufferStream { col = null; - return col0; + return (C)col0; } @SuppressWarnings("unchecked") diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java index 3875cfe..f0efbae 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java @@ -227,8 +227,8 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ - @Override public > Enum readEnum(String name, Class enumCls) { - Enum val = stream.readEnum(enumCls); + @Override public > T readEnum(String name, Class enumCls) { + T val = stream.readEnum(enumCls); lastRead = stream.lastFinished(); @@ -236,8 +236,8 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ - @Nullable @Override public MessageAdapter readMessage(String name) { - MessageAdapter msg = stream.readMessage(); + @Nullable @Override public T readMessage(String name) { + T msg = stream.readMessage(); lastRead = stream.lastFinished(); @@ -254,8 +254,8 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ - @Override public Collection readCollection(String name, Class itemCls) { - Collection col = stream.readCollection(itemCls); + @Override public , T> C readCollection(String name, Class itemCls) { + C col = stream.readCollection(itemCls); lastRead = stream.lastFinished(); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index fa4ca66..eca6afb 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -60,13 +60,13 @@ public interface MessageReader { public IgniteUuid readIgniteUuid(String name); - public > Enum readEnum(String name, Class enumCls); + public > T readEnum(String name, Class enumCls); - public MessageAdapter readMessage(String name); + public T readMessage(String name); public T[] readObjectArray(String name, Class itemCls); - public Collection readCollection(String name, Class itemCls); + public , T> C readCollection(String name, Class itemCls); public Map readMap(String name, Class keyCls, Class valCls); -- 1.9.3 (Apple Git-50) From 159c1e84622cdc0c1ab9f4aa60a721fbff0a51df Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 22:56:42 -0800 Subject: [PATCH 37/71] IGNITE-61 - Direct marshalling --- .../ignite/internal/GridJobCancelRequest.java | 44 +- .../ignite/internal/GridJobExecuteRequest.java | 344 ++++------ .../ignite/internal/GridJobExecuteResponse.java | 84 +-- .../ignite/internal/GridJobSiblingsRequest.java | 34 +- .../ignite/internal/GridJobSiblingsResponse.java | 24 +- .../ignite/internal/GridTaskCancelRequest.java | 24 +- .../ignite/internal/GridTaskSessionRequest.java | 44 +- .../internal/direct/DirectByteBufferStream.java | 4 +- .../internal/direct/DirectMessageReader.java | 4 +- .../direct/GridTcpCommunicationMessageState.java | 726 --------------------- .../managers/checkpoint/GridCheckpointRequest.java | 44 +- .../managers/communication/GridIoMessage.java | 88 ++- .../managers/communication/GridIoUserMessage.java | 157 ++--- .../deployment/GridDeploymentInfoBean.java | 137 +--- .../managers/deployment/GridDeploymentRequest.java | 111 +--- .../deployment/GridDeploymentResponse.java | 44 +- .../eventstorage/GridEventStorageMessage.java | 177 ++--- .../processors/cache/GridCacheEvictionRequest.java | 44 +- .../cache/GridCacheEvictionResponse.java | 91 +-- .../processors/cache/GridCacheMessage.java | 46 +- .../processors/cache/GridCacheValueBytes.java | 60 +- .../GridCacheOptimisticCheckPreparedTxRequest.java | 54 +- ...GridCacheOptimisticCheckPreparedTxResponse.java | 44 +- ...ridCachePessimisticCheckCommittedTxRequest.java | 74 +-- ...idCachePessimisticCheckCommittedTxResponse.java | 44 +- .../distributed/GridCacheTtlUpdateRequest.java | 262 ++------ .../distributed/GridDistributedBaseMessage.java | 158 +---- .../distributed/GridDistributedLockRequest.java | 270 +++----- .../distributed/GridDistributedLockResponse.java | 91 +-- .../GridDistributedTxFinishRequest.java | 238 +++---- .../GridDistributedTxFinishResponse.java | 34 +- .../GridDistributedTxPrepareRequest.java | 252 +++---- .../GridDistributedTxPrepareResponse.java | 34 +- .../distributed/GridDistributedUnlockRequest.java | 71 +- .../dht/GridDhtAffinityAssignmentRequest.java | 24 +- .../dht/GridDhtAffinityAssignmentResponse.java | 34 +- .../cache/distributed/dht/GridDhtLockRequest.java | 151 ++--- .../cache/distributed/dht/GridDhtLockResponse.java | 195 +----- .../distributed/dht/GridDhtTxFinishRequest.java | 240 +++---- .../distributed/dht/GridDhtTxFinishResponse.java | 24 +- .../distributed/dht/GridDhtTxPrepareRequest.java | 181 ++--- .../distributed/dht/GridDhtTxPrepareResponse.java | 205 ++---- .../distributed/dht/GridDhtUnlockRequest.java | 71 +- .../GridDhtAtomicDeferredUpdateResponse.java | 71 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 592 ++++------------- .../dht/atomic/GridDhtAtomicUpdateResponse.java | 101 +-- .../dht/atomic/GridNearAtomicUpdateRequest.java | 443 ++++--------- .../dht/atomic/GridNearAtomicUpdateResponse.java | 265 ++------ .../dht/preloader/GridDhtForceKeysRequest.java | 101 +-- .../dht/preloader/GridDhtForceKeysResponse.java | 101 +-- .../preloader/GridDhtPartitionDemandMessage.java | 121 ++-- .../dht/preloader/GridDhtPartitionExchangeId.java | 75 ++- .../preloader/GridDhtPartitionSupplyMessage.java | 168 ++--- .../GridDhtPartitionsAbstractMessage.java | 34 +- .../preloader/GridDhtPartitionsFullMessage.java | 44 +- .../preloader/GridDhtPartitionsSingleMessage.java | 24 +- .../preloader/GridDhtPartitionsSingleRequest.java | 10 +- .../cache/distributed/near/GridNearGetRequest.java | 242 ++----- .../distributed/near/GridNearGetResponse.java | 131 ++-- .../distributed/near/GridNearLockRequest.java | 228 ++----- .../distributed/near/GridNearLockResponse.java | 205 ++---- .../distributed/near/GridNearTxFinishRequest.java | 74 +-- .../distributed/near/GridNearTxFinishResponse.java | 44 +- .../distributed/near/GridNearTxPrepareRequest.java | 141 ++-- .../near/GridNearTxPrepareResponse.java | 215 ++---- .../distributed/near/GridNearUnlockRequest.java | 10 +- .../cache/query/GridCacheQueryRequest.java | 206 +++--- .../cache/query/GridCacheQueryResponse.java | 168 ++--- .../processors/cache/version/GridCacheVersion.java | 90 ++- .../clock/GridClockDeltaSnapshotMessage.java | 105 +-- .../processors/clock/GridClockDeltaVersion.java | 60 +- .../continuous/GridContinuousMessage.java | 56 +- .../processors/dataload/GridDataLoadRequest.java | 217 +++--- .../processors/dataload/GridDataLoadResponse.java | 44 +- .../internal/processors/fs/GridGgfsAckMessage.java | 44 +- .../internal/processors/fs/GridGgfsBlockKey.java | 54 +- .../processors/fs/GridGgfsBlocksMessage.java | 115 +--- .../fs/GridGgfsCommunicationMessage.java | 10 +- .../processors/fs/GridGgfsDeleteMessage.java | 34 +- .../processors/fs/GridGgfsFileAffinityRange.java | 64 +- .../processors/fs/GridGgfsFragmentizerRequest.java | 81 +-- .../fs/GridGgfsFragmentizerResponse.java | 24 +- .../processors/fs/GridGgfsSyncMessage.java | 34 +- .../message/GridClientHandshakeRequestWrapper.java | 4 +- .../GridClientHandshakeResponseWrapper.java | 8 +- .../client/message/GridClientMessageWrapper.java | 28 +- .../message/GridClientPingPacketWrapper.java | 14 +- .../rest/handlers/task/GridTaskResultRequest.java | 34 +- .../rest/handlers/task/GridTaskResultResponse.java | 54 +- .../protocols/tcp/GridMemcachedMessageWrapper.java | 4 +- .../streamer/GridStreamerCancelRequest.java | 24 +- .../streamer/GridStreamerExecutionRequest.java | 157 ++--- .../processors/streamer/GridStreamerResponse.java | 34 +- .../processors/version/GridVersionConverter.java | 46 -- .../ignite/internal/util/GridByteArrayList.java | 60 +- .../apache/ignite/internal/util/GridLongList.java | 60 +- .../extensions/communication/MessageAdapter.java | 47 -- .../extensions/communication/MessageReader.java | 2 +- .../collision/jobstealing/JobStealingRequest.java | 24 +- .../GridCommunicationSendMessageSelfTest.java | 4 +- .../ignite/spi/communication/GridTestMessage.java | 58 +- 101 files changed, 3349 insertions(+), 7241 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java index d55e205..5cb6a27 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java @@ -131,33 +131,33 @@ public class GridJobCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("jobId", jobId)) + if (!writer.writeIgniteUuid("jobId", jobId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putBoolean("sys", sys)) + if (!writer.writeBoolean("sys", sys)) return false; - commState.idx++; + state++; } @@ -167,32 +167,32 @@ public class GridJobCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - jobId = commState.getGridUuid("jobId"); + jobId = reader.readIgniteUuid("jobId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - sys = commState.getBoolean("sys"); + sys = reader.readBoolean("sys"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java index cdc6dfa..4631000 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java @@ -456,194 +456,141 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putString("cpSpi", cpSpi)) + if (!writer.writeString("cpSpi", cpSpi)) return false; - commState.idx++; + state++; case 2: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 3: - if (!commState.putBoolean("dynamicSiblings", dynamicSiblings)) + if (!writer.writeBoolean("dynamicSiblings", dynamicSiblings)) return false; - commState.idx++; + state++; case 4: - if (!commState.putBoolean("forceLocDep", forceLocDep)) + if (!writer.writeBoolean("forceLocDep", forceLocDep)) return false; - commState.idx++; + state++; case 5: - if (!commState.putBoolean("internal", internal)) + if (!writer.writeBoolean("internal", internal)) return false; - commState.idx++; + state++; case 6: - if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) + if (!writer.writeByteArray("jobAttrsBytes", jobAttrsBytes)) return false; - commState.idx++; + state++; case 7: - if (!commState.putByteArray("jobBytes", jobBytes)) + if (!writer.writeByteArray("jobBytes", jobBytes)) return false; - commState.idx++; + state++; case 8: - if (!commState.putGridUuid("jobId", jobId)) + if (!writer.writeIgniteUuid("jobId", jobId)) return false; - commState.idx++; + state++; case 9: - if (ldrParticipants != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParticipants.size())) - return false; - - commState.it = ldrParticipants.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("ldrParticipants", ldrParticipants, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 10: - if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes)) + if (!writer.writeByteArray("sesAttrsBytes", sesAttrsBytes)) return false; - commState.idx++; + state++; case 11: - if (!commState.putBoolean("sesFullSup", sesFullSup)) + if (!writer.writeBoolean("sesFullSup", sesFullSup)) return false; - commState.idx++; + state++; case 12: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; case 13: - if (!commState.putByteArray("siblingsBytes", siblingsBytes)) + if (!writer.writeByteArray("siblingsBytes", siblingsBytes)) return false; - commState.idx++; + state++; case 14: - if (!commState.putLong("startTaskTime", startTaskTime)) + if (!writer.writeLong("startTaskTime", startTaskTime)) return false; - commState.idx++; + state++; case 15: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 16: - if (!commState.putString("taskClsName", taskClsName)) + if (!writer.writeString("taskClsName", taskClsName)) return false; - commState.idx++; + state++; case 17: - if (!commState.putString("taskName", taskName)) + if (!writer.writeString("taskName", taskName)) return false; - commState.idx++; + state++; case 18: - if (!commState.putLong("timeout", timeout)) + if (!writer.writeLong("timeout", timeout)) return false; - commState.idx++; + state++; case 19: - if (top != null) { - if (commState.it == null) { - if (!commState.putInt(null, top.size())) - return false; - - commState.it = top.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putUuid(null, (UUID)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("top", top, UUID.class)) + return false; - commState.idx++; + state++; case 20: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -653,235 +600,176 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - cpSpi = commState.getString("cpSpi"); + cpSpi = reader.readString("cpSpi"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 3: - dynamicSiblings = commState.getBoolean("dynamicSiblings"); + dynamicSiblings = reader.readBoolean("dynamicSiblings"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - forceLocDep = commState.getBoolean("forceLocDep"); + forceLocDep = reader.readBoolean("forceLocDep"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - internal = commState.getBoolean("internal"); + internal = reader.readBoolean("internal"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); + jobAttrsBytes = reader.readByteArray("jobAttrsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - jobBytes = commState.getByteArray("jobBytes"); + jobBytes = reader.readByteArray("jobBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - jobId = commState.getGridUuid("jobId"); + jobId = reader.readIgniteUuid("jobId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + ldrParticipants = reader.readMap("ldrParticipants", UUID.class, IgniteUuid.class); - if (commState.readSize >= 0) { - if (ldrParticipants == null) - ldrParticipants = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParticipants.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 10: - sesAttrsBytes = commState.getByteArray("sesAttrsBytes"); + sesAttrsBytes = reader.readByteArray("sesAttrsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - sesFullSup = commState.getBoolean("sesFullSup"); + sesFullSup = reader.readBoolean("sesFullSup"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - siblingsBytes = commState.getByteArray("siblingsBytes"); + siblingsBytes = reader.readByteArray("siblingsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - startTaskTime = commState.getLong("startTaskTime"); + startTaskTime = reader.readLong("startTaskTime"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 15: - subjId = commState.getUuid("subjId"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 16: - taskClsName = commState.getString("taskClsName"); + taskClsName = reader.readString("taskClsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - taskName = commState.getString("taskName"); + taskName = reader.readString("taskName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - timeout = commState.getLong("timeout"); + timeout = reader.readLong("timeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 19: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (top == null) - top = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(null); + top = reader.readCollection("top", UUID.class); - if (!commState.lastRead()) - return false; - - top.add((UUID)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 20: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java index 5d936c8..3c3352a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java @@ -234,57 +234,57 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("gridExBytes", gridExBytes)) + if (!writer.writeByteArray("gridExBytes", gridExBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("isCancelled", isCancelled)) + if (!writer.writeBoolean("isCancelled", isCancelled)) return false; - commState.idx++; + state++; case 2: - if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes)) + if (!writer.writeByteArray("jobAttrsBytes", jobAttrsBytes)) return false; - commState.idx++; + state++; case 3: - if (!commState.putGridUuid("jobId", jobId)) + if (!writer.writeIgniteUuid("jobId", jobId)) return false; - commState.idx++; + state++; case 4: - if (!commState.putUuid("nodeId", nodeId)) + if (!writer.writeUuid("nodeId", nodeId)) return false; - commState.idx++; + state++; case 5: - if (!commState.putByteArray("resBytes", resBytes)) + if (!writer.writeByteArray("resBytes", resBytes)) return false; - commState.idx++; + state++; case 6: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; } @@ -294,64 +294,64 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - gridExBytes = commState.getByteArray("gridExBytes"); + gridExBytes = reader.readByteArray("gridExBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - isCancelled = commState.getBoolean("isCancelled"); + isCancelled = reader.readBoolean("isCancelled"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - jobAttrsBytes = commState.getByteArray("jobAttrsBytes"); + jobAttrsBytes = reader.readByteArray("jobAttrsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - jobId = commState.getGridUuid("jobId"); + jobId = reader.readIgniteUuid("jobId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - nodeId = commState.getUuid("nodeId"); + nodeId = reader.readUuid("nodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - resBytes = commState.getByteArray("resBytes"); + resBytes = reader.readByteArray("resBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java index db27003..2fc71d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java @@ -105,27 +105,27 @@ public class GridJobSiblingsRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putByteArray("topicBytes", topicBytes)) + if (!writer.writeByteArray("topicBytes", topicBytes)) return false; - commState.idx++; + state++; } @@ -135,24 +135,24 @@ public class GridJobSiblingsRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - topicBytes = commState.getByteArray("topicBytes"); + topicBytes = reader.readByteArray("topicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java index 0dad8d9..ffaaa1e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java @@ -97,21 +97,21 @@ public class GridJobSiblingsResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("siblingsBytes", siblingsBytes)) + if (!writer.writeByteArray("siblingsBytes", siblingsBytes)) return false; - commState.idx++; + state++; } @@ -121,16 +121,16 @@ public class GridJobSiblingsResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - siblingsBytes = commState.getByteArray("siblingsBytes"); + siblingsBytes = reader.readByteArray("siblingsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java index 21153af..75ff8ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java @@ -80,21 +80,21 @@ public class GridTaskCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; } @@ -104,16 +104,16 @@ public class GridTaskCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java index f33e97a..1f75ee2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java @@ -120,33 +120,33 @@ public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("attrsBytes", attrsBytes)) + if (!writer.writeByteArray("attrsBytes", attrsBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("jobId", jobId)) + if (!writer.writeIgniteUuid("jobId", jobId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; } @@ -156,32 +156,32 @@ public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - attrsBytes = commState.getByteArray("attrsBytes"); + attrsBytes = reader.readByteArray("attrsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - jobId = commState.getGridUuid("jobId"); + jobId = reader.readIgniteUuid("jobId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 3234a64..9d79f41 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 @@ -969,7 +969,7 @@ public class DirectByteBufferStream { } @SuppressWarnings("unchecked") - public Map readMap(Class keyCls, Class valCls) { + public , K, V> M readMap(Class keyCls, Class valCls) { if (readSize == -1) { int size = readInt(); @@ -1021,7 +1021,7 @@ public class DirectByteBufferStream { map = null; - return map0; + return (M)map0; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java index f0efbae..1bc3d50 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java @@ -263,8 +263,8 @@ public class DirectMessageReader implements MessageReader { } /** {@inheritDoc} */ - @Override public Map readMap(String name, Class keyCls, Class valCls) { - Map map = stream.readMap(keyCls, valCls); + @Override public , K, V> M readMap(String name, Class keyCls, Class valCls) { + M map = stream.readMap(keyCls, valCls); lastRead = stream.lastFinished(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java deleted file mode 100644 index ad9542a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageState.java +++ /dev/null @@ -1,726 +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.direct; - -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.jetbrains.annotations.*; -import sun.misc.*; - -import java.nio.*; -import java.util.*; - -import static org.apache.ignite.plugin.extensions.communication.MessageAdapter.*; - -/** - * Communication message state. - */ -@SuppressWarnings("PublicField") -public class GridTcpCommunicationMessageState { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** */ - private final MessageWriter writer = new DirectMessageWriter(); - - /** */ - private MessageReader reader; - - /** */ - public int idx; - - /** */ - public boolean typeWritten; - - /** */ - public Iterator it; - - /** */ - public Object cur; - - /** */ - public boolean keyDone; - - /** */ - public int readSize = -1; - - /** */ - public int readItems; - - /** - * @param writer Writer. - */ - public final void setWriter(MessageWriter writer) { -// if (this.writer == null) -// this.writer = writer; - } - - /** - * @param reader Reader. - */ - public final void setReader(MessageReader reader) { - if (this.reader == null) - this.reader = reader; - } - - /** - * @param buf Buffer. - */ - public final void setBuffer(ByteBuffer buf) { - if (writer != null) - writer.setBuffer(buf); - - if (reader != null) - reader.setBuffer(buf); - } - - /** - * @param name Field name. - * @param b Byte value. - * @return Whether value was written. - */ - public final boolean putByte(String name, byte b) { - return writer.writeByte(name, b); - } - - /** - * @param name Field name. - * @return Byte value. - */ - public final byte getByte(String name) { - return reader.readByte(name); - } - - /** - * @param name Field name. - * @param s Short value. - * @return Whether value was written. - */ - public final boolean putShort(String name, short s) { - return writer.writeShort(name, s); - } - - /** - * @param name Field name. - * @return Short value. - */ - public final short getShort(String name) { - return reader.readShort(name); - } - - /** - * @param name Field name. - * @param i Integer value. - * @return Whether value was written. - */ - public final boolean putInt(String name, int i) { - return writer.writeInt(name, i); - } - - /** - * @param name Field name. - * @return Integer value. - */ - public final int getInt(String name) { - return reader.readInt(name); - } - - /** - * @param name Field name. - * @param l Long value. - * @return Whether value was written. - */ - public final boolean putLong(String name, long l) { - return writer.writeLong(name, l); - } - - /** - * @param name Field name. - * @return Long value. - */ - public final long getLong(String name) { - return reader.readLong(name); - } - - /** - * @param name Field name. - * @param f Float value. - * @return Whether value was written. - */ - public final boolean putFloat(String name, float f) { - return writer.writeFloat(name, f); - } - - /** - * @param name Field name. - * @return Float value. - */ - public final float getFloat(String name) { - return reader.readFloat(name); - } - - /** - * @param name Field name. - * @param d Double value. - * @return Whether value was written. - */ - public final boolean putDouble(String name, double d) { - return writer.writeDouble(name, d); - } - - /** - * @param name Field name. - * @return Double value. - */ - public final double getDouble(String name) { - return reader.readDouble(name); - } - - /** - * @param name Field name. - * @param c Char value. - * @return Whether value was written. - */ - public final boolean putChar(String name, char c) { - return writer.writeChar(name, c); - } - - /** - * @param name Field name. - * @return Char value. - */ - public final char getChar(String name) { - return reader.readChar(name); - } - - /** - * @param name Field name. - * @param b Boolean value. - * @return Whether value was written. - */ - public final boolean putBoolean(String name, boolean b) { - return writer.writeBoolean(name, b); - } - - /** - * @param name Field name. - * @return Boolean value. - */ - public final boolean getBoolean(String name) { - return reader.readBoolean(name); - } - - /** - * @param name Field name. - * @param arr Byte array. - * @return Whether array was fully written. - */ - public final boolean putByteArray(String name, @Nullable byte[] arr) { - return writer.writeByteArray(name, arr); - } - - /** - * @param name Field name. - * @return Byte array. - */ - public final byte[] getByteArray(String name) { - return reader.readByteArray(name); - } - - /** - * @param name Field name. - * @param arr Short array. - * @return Whether array was fully written. - */ - public final boolean putShortArray(String name, short[] arr) { - return writer.writeShortArray(name, arr); - } - - /** - * @param name Field name. - * @return Short array. - */ - public final short[] getShortArray(String name) { - return reader.readShortArray(name); - } - - /** - * @param name Field name. - * @param arr Integer array. - * @return Whether array was fully written. - */ - public final boolean putIntArray(String name, int[] arr) { - return writer.writeIntArray(name, arr); - } - - /** - * @param name Field name. - * @return Integer array. - */ - public final int[] getIntArray(String name) { - return reader.readIntArray(name); - } - - /** - * @param name Field name. - * @param arr Long array. - * @return Whether array was fully written. - */ - public final boolean putLongArray(String name, long[] arr) { - return writer.writeLongArray(name, arr); - } - - /** - * @param name Field name. - * @return Long array. - */ - public final long[] getLongArray(String name) { - return reader.readLongArray(name); - } - - /** - * @param name Field name. - * @param arr Float array. - * @return Whether array was fully written. - */ - public final boolean putFloatArray(String name, float[] arr) { - return writer.writeFloatArray(name, arr); - } - - /** - * @param name Field name. - * @return Float array. - */ - public final float[] getFloatArray(String name) { - return reader.readFloatArray(name); - } - - /** - * @param name Field name. - * @param arr Double array. - * @return Whether array was fully written. - */ - public final boolean putDoubleArray(String name, double[] arr) { - return writer.writeDoubleArray(name, arr); - } - - /** - * @param name Field name. - * @return Double array. - */ - public final double[] getDoubleArray(String name) { - return reader.readDoubleArray(name); - } - - /** - * @param name Field name. - * @param arr Char array. - * @return Whether array was fully written. - */ - public final boolean putCharArray(String name, char[] arr) { - return writer.writeCharArray(name, arr); - } - - /** - * @param name Field name. - * @return Char array. - */ - public final char[] getCharArray(String name) { - return reader.readCharArray(name); - } - - /** - * @param name Field name. - * @param arr Boolean array. - * @return Whether array was fully written. - */ - public final boolean putBooleanArray(String name, boolean[] arr) { - return writer.writeBooleanArray(name, arr); - } - - /** - * @param name Field name. - * @return Boolean array. - */ - public final boolean[] getBooleanArray(String name) { - return reader.readBooleanArray(name); - } - - - /** - * @param name Field name. - * @param uuid {@link UUID}. - * @return Whether value was fully written. - */ - public final boolean putUuid(String name, @Nullable UUID uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link UUID}. - */ - public final UUID getUuid(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new UUID(most, least); - } - } - - /** - * @param name Field name. - * @param uuid {@link IgniteUuid}. - * @return Whether value was fully written. - */ - public final boolean putGridUuid(String name, @Nullable IgniteUuid uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[24]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link IgniteUuid}. - */ - public final IgniteUuid getGridUuid(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new IgniteUuid(new UUID(most, least), loc); - } - } - - /** - * @param name Field name. - * @param ver {@link GridClockDeltaVersion}. - * @return Whether value was fully written. - */ - public final boolean putClockDeltaVersion(String name, @Nullable GridClockDeltaVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridClockDeltaVersion}. - */ - public final GridClockDeltaVersion getClockDeltaVersion(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new GridClockDeltaVersion(ver, topVer); - } - } - - /** - * @param name Field name. - * @param list {@link GridByteArrayList}. - * @return Whether value was fully written. - */ - public final boolean putByteArrayList(String name, @Nullable GridByteArrayList list) { - return putByteArray(name, list != null ? list.array() : null); - } - - /** - * @param name Field name. - * @return {@link GridByteArrayList}. - */ - public final GridByteArrayList getByteArrayList(String name) { - byte[] arr = getByteArray(name); - - return arr != null ? new GridByteArrayList(arr) : null; - } - - /** - * @param name Field name. - * @param list {@link GridLongList}. - * @return Whether value was fully written. - */ - public final boolean putLongList(String name, @Nullable GridLongList list) { - return putLongArray(name, list != null ? list.array() : null); - } - - /** - * @param name Field name. - * @return {@link GridLongList}. - */ - public final GridLongList getLongList(String name) { - long[] arr = getLongArray(name); - - return arr != null ? new GridLongList(arr) : null; - } - - /** - * @param name Field name. - * @param ver {@link org.apache.ignite.internal.processors.cache.version.GridCacheVersion}. - * @return Whether value was fully written. - */ - public final boolean putCacheVersion(String name, @Nullable GridCacheVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[24]; - - UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridCacheVersion}. - */ - public final GridCacheVersion getCacheVersion(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); - int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4); - long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order); - } - } - - /** - * @param name Field name. - * @param id {@link GridDhtPartitionExchangeId}. - * @return Whether value was fully written. - */ - public final boolean putDhtPartitionExchangeId(String name, @Nullable GridDhtPartitionExchangeId id) { - byte[] arr = null; - - if (id != null) { - arr = new byte[28]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridDhtPartitionExchangeId}. - */ - public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20); - - return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer); - } - } - - /** - * @param name Field name. - * @param bytes {@link GridCacheValueBytes}. - * @return Whether value was fully written. - */ - public final boolean putValueBytes(String name, @Nullable GridCacheValueBytes bytes) { - byte[] arr = null; - - if (bytes != null) { - byte[] bytes0 = bytes.get(); - - if (bytes0 != null) { - int len = bytes0.length; - - arr = new byte[len + 2]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); - UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); - UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); - } - else { - arr = new byte[1]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false); - } - } - - return putByteArray(name, arr); - } - - /** - * @param name Field name. - * @return {@link GridCacheValueBytes}. - */ - public final GridCacheValueBytes getValueBytes(String name) { - byte[] arr = getByteArray(name); - - if (arr == null) - return null; - else { - boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); - - if (notNull) { - int len = arr.length - 2; - - assert len >= 0 : len; - - byte[] bytesArr = new byte[len]; - - UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len); - - boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len); - - return new GridCacheValueBytes(bytesArr, isPlain); - } - else - return new GridCacheValueBytes(); - } - } - - /** - * @param name Field name. - * @param str {@link String}. - * @return Whether value was fully written. - */ - public final boolean putString(String name, @Nullable String str) { - return putByteArray(name, str != null ? str.getBytes() : null); - } - - /** - * @param name Field name. - * @return {@link String}. - */ - public final String getString(String name) { - byte[] arr = getByteArray(name); - - return arr != null ? new String(arr) : null; - } - - /** - * @param name Field name. - * @param bits {@link BitSet}. - * @return Whether value was fully written. - */ - public final boolean putBitSet(String name, @Nullable BitSet bits) { - return putLongArray(name, bits != null ? bits.toLongArray() : null); - } - - /** - * @param name Field name. - * @return {@link BitSet}. - */ - public final BitSet getBitSet(String name) { - long[] arr = getLongArray(name); - - return arr != null ? BitSet.valueOf(arr) : null; - } - - /** - * @param name Field name. - * @param e Enum. - * @return Whether value was fully written. - */ - public final boolean putEnum(String name, @Nullable Enum e) { - return putByte(name, e != null ? (byte)e.ordinal() : -1); - } - - /** - * @param name Field name. - * @param msg {@link MessageAdapter}. - * @return Whether value was fully written. - */ - public final boolean putMessage(String name, @Nullable MessageAdapter msg) { - if (msg != null) - msg.setWriter(writer); - - return writer.writeMessage(name, msg); - } - - /** - * @param name Field name. - * @return {@link MessageAdapter}. - */ - public final MessageAdapter getMessage(String name) { - return reader.readMessage(name); - } - - public final boolean lastRead() { - return reader.isLastRead(); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java index fda129a..5085a9c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java @@ -105,33 +105,33 @@ public class GridCheckpointRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putString("cpSpi", cpSpi)) + if (!writer.writeString("cpSpi", cpSpi)) return false; - commState.idx++; + state++; case 1: - if (!commState.putString("key", key)) + if (!writer.writeString("key", key)) return false; - commState.idx++; + state++; case 2: - if (!commState.putGridUuid("sesId", sesId)) + if (!writer.writeIgniteUuid("sesId", sesId)) return false; - commState.idx++; + state++; } @@ -141,32 +141,32 @@ public class GridCheckpointRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - cpSpi = commState.getString("cpSpi"); + cpSpi = reader.readString("cpSpi"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - key = commState.getString("key"); + key = reader.readString("key"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - sesId = commState.getGridUuid("sesId"); + sesId = reader.readIgniteUuid("sesId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java index 5dc52d8..27d64be 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java @@ -200,63 +200,63 @@ public class GridIoMessage extends MessageAdapter { _clone.ordered = ordered; _clone.timeout = timeout; _clone.skipOnTimeout = skipOnTimeout; - _clone.msg = msg != null ? (MessageAdapter)msg.clone() : null; + _clone.msg = msg; } /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putMessage("msg", msg)) + if (!writer.writeMessage("msg", msg != null ? msg.clone() : null)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("ordered", ordered)) + if (!writer.writeBoolean("ordered", ordered)) return false; - commState.idx++; + state++; case 2: - if (!commState.putEnum("plc", plc)) + if (!writer.writeEnum("plc", plc)) return false; - commState.idx++; + state++; case 3: - if (!commState.putBoolean("skipOnTimeout", skipOnTimeout)) + if (!writer.writeBoolean("skipOnTimeout", skipOnTimeout)) return false; - commState.idx++; + state++; case 4: - if (!commState.putLong("timeout", timeout)) + if (!writer.writeLong("timeout", timeout)) return false; - commState.idx++; + state++; case 5: - if (!commState.putByteArray("topicBytes", topicBytes)) + if (!writer.writeByteArray("topicBytes", topicBytes)) return false; - commState.idx++; + state++; case 6: - if (!commState.putInt("topicOrd", topicOrd)) + if (!writer.writeInt("topicOrd", topicOrd)) return false; - commState.idx++; + state++; } @@ -266,66 +266,64 @@ public class GridIoMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - msg = commState.getMessage("msg"); + msg = reader.readMessage("msg"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - ordered = commState.getBoolean("ordered"); + ordered = reader.readBoolean("ordered"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - byte plc0 = commState.getByte("plc"); + plc = reader.readEnum("plc", GridIoPolicy.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - plc = GridIoPolicy.fromOrdinal(plc0); - - commState.idx++; + state++; case 3: - skipOnTimeout = commState.getBoolean("skipOnTimeout"); + skipOnTimeout = reader.readBoolean("skipOnTimeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - timeout = commState.getLong("timeout"); + timeout = reader.readLong("timeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - topicBytes = commState.getByteArray("topicBytes"); + topicBytes = reader.readByteArray("topicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - topicOrd = commState.getInt("topicOrd"); + topicOrd = reader.readInt("topicOrd"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java index 44039a3..0bc81d4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java @@ -231,89 +231,57 @@ public class GridIoUserMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("bodyBytes", bodyBytes)) + if (!writer.writeByteArray("bodyBytes", bodyBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putString("depClsName", depClsName)) + if (!writer.writeString("depClsName", depClsName)) return false; - commState.idx++; + state++; case 3: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 4: - if (ldrParties != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParties.size())) - return false; - - commState.it = ldrParties.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("ldrParties", ldrParties, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 5: - if (!commState.putByteArray("topicBytes", topicBytes)) + if (!writer.writeByteArray("topicBytes", topicBytes)) return false; - commState.idx++; + state++; case 6: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -323,101 +291,64 @@ public class GridIoUserMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - bodyBytes = commState.getByteArray("bodyBytes"); + bodyBytes = reader.readByteArray("bodyBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - depClsName = commState.getString("depClsName"); + depClsName = reader.readString("depClsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + ldrParties = reader.readMap("ldrParties", UUID.class, IgniteUuid.class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (ldrParties == null) - ldrParties = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParties.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - topicBytes = commState.getByteArray("topicBytes"); + topicBytes = reader.readByteArray("topicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java index c0698d0..4907c56 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java @@ -161,77 +161,45 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 2: - if (!commState.putBoolean("locDepOwner", locDepOwner)) + if (!writer.writeBoolean("locDepOwner", locDepOwner)) return false; - commState.idx++; + state++; case 3: - if (participants != null) { - if (commState.it == null) { - if (!commState.putInt(null, participants.size())) - return false; - - commState.it = participants.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("participants", participants, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 4: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -241,85 +209,48 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 2: - locDepOwner = commState.getBoolean("locDepOwner"); + locDepOwner = reader.readBoolean("locDepOwner"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + participants = reader.readMap("participants", UUID.class, IgniteUuid.class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (participants == null) - participants = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - participants.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 4: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java index 86019b9..50d9b24 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java @@ -180,66 +180,45 @@ public class GridDeploymentRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putBoolean("isUndeploy", isUndeploy)) + if (!writer.writeBoolean("isUndeploy", isUndeploy)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("ldrId", ldrId)) + if (!writer.writeIgniteUuid("ldrId", ldrId)) return false; - commState.idx++; + state++; case 2: - if (nodeIds != null) { - if (commState.it == null) { - if (!commState.putInt(null, nodeIds.size())) - return false; - - commState.it = nodeIds.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putUuid(null, (UUID)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nodeIds", nodeIds, UUID.class)) + return false; - commState.idx++; + state++; case 3: - if (!commState.putByteArray("resTopicBytes", resTopicBytes)) + if (!writer.writeByteArray("resTopicBytes", resTopicBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putString("rsrcName", rsrcName)) + if (!writer.writeString("rsrcName", rsrcName)) return false; - commState.idx++; + state++; } @@ -249,70 +228,48 @@ public class GridDeploymentRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - isUndeploy = commState.getBoolean("isUndeploy"); + isUndeploy = reader.readBoolean("isUndeploy"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - ldrId = commState.getGridUuid("ldrId"); + ldrId = reader.readIgniteUuid("ldrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nodeIds = reader.readCollection("nodeIds", UUID.class); - if (commState.readSize >= 0) { - if (nodeIds == null) - nodeIds = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - nodeIds.add((UUID)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 3: - resTopicBytes = commState.getByteArray("resTopicBytes"); + resTopicBytes = reader.readByteArray("resTopicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - rsrcName = commState.getString("rsrcName"); + rsrcName = reader.readString("rsrcName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java index de50cc9..c46d7f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java @@ -127,33 +127,33 @@ public class GridDeploymentResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArrayList("byteSrc", byteSrc)) + if (!writer.writeMessage("byteSrc", byteSrc != null ? byteSrc.clone() : null)) return false; - commState.idx++; + state++; case 1: - if (!commState.putString("errMsg", errMsg)) + if (!writer.writeString("errMsg", errMsg)) return false; - commState.idx++; + state++; case 2: - if (!commState.putBoolean("success", success)) + if (!writer.writeBoolean("success", success)) return false; - commState.idx++; + state++; } @@ -163,32 +163,32 @@ public class GridDeploymentResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - byteSrc = commState.getByteArrayList("byteSrc"); + byteSrc = reader.readMessage("byteSrc"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - errMsg = commState.getString("errMsg"); + errMsg = reader.readString("errMsg"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - success = commState.getBoolean("success"); + success = reader.readBoolean("success"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java index 1658b88..352d360 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java @@ -291,101 +291,69 @@ public class GridEventStorageMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 2: - if (!commState.putByteArray("evtsBytes", evtsBytes)) + if (!writer.writeByteArray("evtsBytes", evtsBytes)) return false; - commState.idx++; + state++; case 3: - if (!commState.putByteArray("exBytes", exBytes)) + if (!writer.writeByteArray("exBytes", exBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("filter", filter)) + if (!writer.writeByteArray("filter", filter)) return false; - commState.idx++; + state++; case 5: - if (!commState.putString("filterClsName", filterClsName)) + if (!writer.writeString("filterClsName", filterClsName)) return false; - commState.idx++; + state++; case 6: - if (ldrParties != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParties.size())) - return false; - - commState.it = ldrParties.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("ldrParties", ldrParties, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putByteArray("resTopicBytes", resTopicBytes)) + if (!writer.writeByteArray("resTopicBytes", resTopicBytes)) return false; - commState.idx++; + state++; case 8: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -395,117 +363,80 @@ public class GridEventStorageMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 2: - evtsBytes = commState.getByteArray("evtsBytes"); + evtsBytes = reader.readByteArray("evtsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - exBytes = commState.getByteArray("exBytes"); + exBytes = reader.readByteArray("exBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - filter = commState.getByteArray("filter"); + filter = reader.readByteArray("filter"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - filterClsName = commState.getString("filterClsName"); + filterClsName = reader.readString("filterClsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + ldrParties = reader.readMap("ldrParties", UUID.class, IgniteUuid.class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (ldrParties == null) - ldrParties = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParties.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - resTopicBytes = commState.getByteArray("resTopicBytes"); + resTopicBytes = reader.readByteArray("resTopicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java index bb63b86..ce7d4d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java @@ -164,36 +164,36 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putByteArray("entriesBytes", entriesBytes)) + if (!writer.writeByteArray("entriesBytes", entriesBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putLong("futId", futId)) + if (!writer.writeLong("futId", futId)) return false; - commState.idx++; + state++; case 5: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -203,35 +203,35 @@ public class GridCacheEvictionRequest extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - entriesBytes = commState.getByteArray("entriesBytes"); + entriesBytes = reader.readByteArray("entriesBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - futId = commState.getLong("futId"); + futId = reader.readLong("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java index 8199020..2687e95 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java @@ -153,57 +153,36 @@ public class GridCacheEvictionResponse extends GridCacheMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putBoolean("err", err)) + if (!writer.writeBoolean("err", err)) return false; - commState.idx++; + state++; case 4: - if (!commState.putLong("futId", futId)) + if (!writer.writeLong("futId", futId)) return false; - commState.idx++; + state++; case 5: - if (rejectedKeyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, rejectedKeyBytes.size())) - return false; - - commState.it = rejectedKeyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("rejectedKeyBytes", rejectedKeyBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -213,57 +192,35 @@ public class GridCacheEvictionResponse extends GridCacheMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - err = commState.getBoolean("err"); + err = reader.readBoolean("err"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - futId = commState.getLong("futId"); + futId = reader.readLong("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + rejectedKeyBytes = reader.readCollection("rejectedKeyBytes", byte[].class); - if (commState.readSize >= 0) { - if (rejectedKeyBytes == null) - rejectedKeyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - rejectedKeyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java index 78028b0..dc8feee 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java @@ -648,7 +648,7 @@ public abstract class GridCacheMessage extends MessageAdapter { GridCacheMessage _clone = (GridCacheMessage)_msg; _clone.msgId = msgId; - _clone.depInfo = depInfo != null ? (GridDeploymentInfoBean)depInfo.clone() : null; + _clone.depInfo = depInfo; _clone.err = err; _clone.skipPrepare = skipPrepare; _clone.cacheId = cacheId; @@ -657,33 +657,33 @@ public abstract class GridCacheMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putInt("cacheId", cacheId)) + if (!writer.writeInt("cacheId", cacheId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putMessage("depInfo", depInfo)) + if (!writer.writeMessage("depInfo", depInfo != null ? depInfo.clone() : null)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong("msgId", msgId)) + if (!writer.writeLong("msgId", msgId)) return false; - commState.idx++; + state++; } @@ -693,32 +693,32 @@ public abstract class GridCacheMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - cacheId = commState.getInt("cacheId"); + cacheId = reader.readInt("cacheId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - depInfo = (GridDeploymentInfoBean)commState.getMessage("depInfo"); + depInfo = reader.readMessage("depInfo"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - msgId = commState.getLong("msgId"); + msgId = reader.readLong("msgId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java index aba1c18..289db2e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java @@ -118,12 +118,57 @@ public class GridCacheValueBytes extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - return false; // TODO: implement. + writer.setBuffer(buf); + + if (!typeWritten) { + if (!writer.writeByte(null, directType())) + return false; + + typeWritten = true; + } + + switch (state) { + case 0: + if (!writer.writeByteArray("bytes", bytes)) + return false; + + state++; + + case 1: + if (!writer.writeBoolean("plain", plain)) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - return false; // TODO: implement. + reader.setBuffer(buf); + + switch (state) { + case 0: + bytes = reader.readByteArray("bytes"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 1: + plain = reader.readBoolean("plain"); + + if (!reader.isLastRead()) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @@ -133,12 +178,19 @@ public class GridCacheValueBytes extends MessageAdapter { /** {@inheritDoc} */ @Override public MessageAdapter clone() { - return null; // TODO: implement. + GridCacheValueBytes _clone = new GridCacheValueBytes(); + + clone0(_clone); + + return _clone; } /** {@inheritDoc} */ @Override protected void clone0(MessageAdapter _msg) { - // TODO: implement. + GridCacheValueBytes _clone = (GridCacheValueBytes)_msg; + + _clone.bytes = bytes; + _clone.plain = plain; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java index e021408..914f150 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -121,42 +121,42 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 10: - if (!commState.putCacheVersion("nearXidVer", nearXidVer)) + if (!writer.writeMessage("nearXidVer", nearXidVer != null ? nearXidVer.clone() : null)) return false; - commState.idx++; + state++; case 11: - if (!commState.putInt("txNum", txNum)) + if (!writer.writeInt("txNum", txNum)) return false; - commState.idx++; + state++; } @@ -166,43 +166,43 @@ public class GridCacheOptimisticCheckPreparedTxRequest extends GridDistrib /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - nearXidVer = commState.getCacheVersion("nearXidVer"); + nearXidVer = reader.readMessage("nearXidVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - txNum = commState.getInt("txNum"); + txNum = reader.readInt("txNum"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java index bba1efb..7c9ae63 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -108,36 +108,36 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 10: - if (!commState.putBoolean("success", success)) + if (!writer.writeBoolean("success", success)) return false; - commState.idx++; + state++; } @@ -147,35 +147,35 @@ public class GridCacheOptimisticCheckPreparedTxResponse extends GridDistri /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - success = commState.getBoolean("success"); + success = reader.readBoolean("success"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java index bd5f826..0aeabaf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -154,54 +154,54 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 10: - if (!commState.putCacheVersion("nearXidVer", nearXidVer)) + if (!writer.writeBoolean("nearOnlyCheck", nearOnlyCheck)) return false; - commState.idx++; + state++; case 11: - if (!commState.putUuid("originatingNodeId", originatingNodeId)) + if (!writer.writeMessage("nearXidVer", nearXidVer != null ? nearXidVer.clone() : null)) return false; - commState.idx++; + state++; case 12: - if (!commState.putLong("originatingThreadId", originatingThreadId)) + if (!writer.writeUuid("originatingNodeId", originatingNodeId)) return false; - commState.idx++; + state++; case 13: - if (!commState.putBoolean("nearOnlyCheck", nearOnlyCheck)) + if (!writer.writeLong("originatingThreadId", originatingThreadId)) return false; - commState.idx++; + state++; } @@ -211,59 +211,59 @@ public class GridCachePessimisticCheckCommittedTxRequest extends GridDistr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - nearXidVer = commState.getCacheVersion("nearXidVer"); + nearOnlyCheck = reader.readBoolean("nearOnlyCheck"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - originatingNodeId = commState.getUuid("originatingNodeId"); + nearXidVer = reader.readMessage("nearXidVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - originatingThreadId = commState.getLong("originatingThreadId"); + originatingNodeId = reader.readUuid("originatingNodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - nearOnlyCheck = commState.getBoolean("nearOnlyCheck"); + originatingThreadId = reader.readLong("originatingThreadId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java index 68495f3..36983be 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java @@ -140,36 +140,36 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putByteArray("committedTxInfoBytes", committedTxInfoBytes)) + if (!writer.writeByteArray("committedTxInfoBytes", committedTxInfoBytes)) return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 10: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; } @@ -179,35 +179,35 @@ public class GridCachePessimisticCheckCommittedTxResponse extends GridDist /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - committedTxInfoBytes = commState.getByteArray("committedTxInfoBytes"); + committedTxInfoBytes = reader.readByteArray("committedTxInfoBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java index f8f9870..96eb0a4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java @@ -195,138 +195,54 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (keysBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keysBytes.size())) - return false; - - commState.it = keysBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("keysBytes", keysBytes, byte[].class)) + return false; - commState.idx++; + state++; case 4: - if (nearKeysBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearKeysBytes.size())) - return false; - - commState.it = nearKeysBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearKeysBytes", nearKeysBytes, byte[].class)) + return false; - commState.idx++; + state++; case 5: - if (nearVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearVers.size())) - return false; - - commState.it = nearVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearVers", nearVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 6: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("ttl", ttl)) + if (!writer.writeLong("ttl", ttl)) return false; - commState.idx++; + state++; case 8: - if (vers != null) { - if (commState.it == null) { - if (!commState.putInt(null, vers.size())) - return false; - - commState.it = vers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("vers", vers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; } @@ -335,147 +251,59 @@ public class GridCacheTtlUpdateRequest extends GridCacheMessage { /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (keysBytes == null) - keysBytes = new ArrayList<>(commState.readSize); + keysBytes = reader.readCollection("keysBytes", byte[].class); - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - keysBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearKeysBytes == null) - nearKeysBytes = new ArrayList<>(commState.readSize); + nearKeysBytes = reader.readCollection("nearKeysBytes", byte[].class); - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearKeysBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nearVers = reader.readCollection("nearVers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (nearVers == null) - nearVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - nearVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 6: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - ttl = commState.getLong("ttl"); + ttl = reader.readLong("ttl"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + vers = reader.readCollection("vers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (vers == null) - vers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - vers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java index 55e5250..0c82e02 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java @@ -258,90 +258,48 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putByteArray("candsByIdxBytes", candsByIdxBytes)) + if (!writer.writeByteArray("candsByIdxBytes", candsByIdxBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("candsByKeyBytes", candsByKeyBytes)) + if (!writer.writeByteArray("candsByKeyBytes", candsByKeyBytes)) return false; - commState.idx++; + state++; case 5: - if (committedVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, committedVers.size())) - return false; - - commState.it = committedVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("committedVers", committedVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 6: - if (rolledbackVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, rolledbackVers.size())) - return false; - - commState.it = rolledbackVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("rolledbackVers", rolledbackVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putCacheVersion("ver", ver)) + if (!writer.writeMessage("ver", ver != null ? ver.clone() : null)) return false; - commState.idx++; + state++; } @@ -351,95 +309,51 @@ public abstract class GridDistributedBaseMessage extends GridCacheMessage< /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - candsByIdxBytes = commState.getByteArray("candsByIdxBytes"); + candsByIdxBytes = reader.readByteArray("candsByIdxBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - candsByKeyBytes = commState.getByteArray("candsByKeyBytes"); + candsByKeyBytes = reader.readByteArray("candsByKeyBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + committedVers = reader.readCollection("committedVers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (committedVers == null) - committedVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - committedVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + rolledbackVers = reader.readCollection("rolledbackVers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (rolledbackVers == null) - rolledbackVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - rolledbackVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - ver = commState.getCacheVersion("ver"); + ver = reader.readMessage("ver"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java index 3c94d51..a3f54c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java @@ -467,156 +467,114 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (drVersByIdx != null) { - if (commState.it == null) { - if (!commState.putInt(null, drVersByIdx.length)) - return false; - - commState.it = arrayIterator(drVersByIdx); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("drVersByIdx", drVersByIdx, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 10: - if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) + if (!writer.writeByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; - commState.idx++; + state++; case 11: - if (!commState.putBoolean("isInTx", isInTx)) + if (!writer.writeBoolean("isInTx", isInTx)) return false; - commState.idx++; + state++; case 12: - if (!commState.putBoolean("isInvalidate", isInvalidate)) + if (!writer.writeBoolean("isInvalidate", isInvalidate)) return false; - commState.idx++; + state++; case 13: - if (!commState.putBoolean("isRead", isRead)) + if (!writer.writeBoolean("isRead", isRead)) return false; - commState.idx++; + state++; case 14: - if (!commState.putEnum("isolation", isolation)) + if (!writer.writeEnum("isolation", isolation)) return false; - commState.idx++; + state++; case 15: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; - - commState.it = keyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("keyBytes", keyBytes, byte[].class)) + return false; - commState.idx++; + state++; case 16: - if (!commState.putCacheVersion("nearXidVer", nearXidVer)) + if (!writer.writeMessage("nearXidVer", nearXidVer != null ? nearXidVer.clone() : null)) return false; - commState.idx++; + state++; case 17: - if (!commState.putUuid("nodeId", nodeId)) + if (!writer.writeUuid("nodeId", nodeId)) return false; - commState.idx++; + state++; case 18: - if (!commState.putBoolean("partLock", partLock)) + if (!writer.writeBoolean("partLock", partLock)) return false; - commState.idx++; + state++; case 19: - if (!commState.putBooleanArray("retVals", retVals)) + if (!writer.writeBooleanArray("retVals", retVals)) return false; - commState.idx++; + state++; case 20: - if (!commState.putLong("threadId", threadId)) + if (!writer.writeLong("threadId", threadId)) return false; - commState.idx++; + state++; case 21: - if (!commState.putLong("timeout", timeout)) + if (!writer.writeLong("timeout", timeout)) return false; - commState.idx++; + state++; case 22: - if (!commState.putInt("txSize", txSize)) + if (!writer.writeInt("txSize", txSize)) return false; - commState.idx++; + state++; case 23: - if (!commState.putByteArray("writeEntriesBytes", writeEntriesBytes)) + if (!writer.writeByteArray("writeEntriesBytes", writeEntriesBytes)) return false; - commState.idx++; + state++; } @@ -626,185 +584,139 @@ public class GridDistributedLockRequest extends GridDistributedBaseMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (drVersByIdx == null) - drVersByIdx = new GridCacheVersion[commState.readSize]; + drVersByIdx = reader.readObjectArray("drVersByIdx", GridCacheVersion.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - drVersByIdx[i] = (GridCacheVersion)_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 9: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = reader.readByteArray("grpLockKeyBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - isInTx = commState.getBoolean("isInTx"); + isInTx = reader.readBoolean("isInTx"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - isInvalidate = commState.getBoolean("isInvalidate"); + isInvalidate = reader.readBoolean("isInvalidate"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - isRead = commState.getBoolean("isRead"); + isRead = reader.readBoolean("isRead"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - byte isolation0 = commState.getByte("isolation"); + isolation = reader.readEnum("isolation", IgniteTxIsolation.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - isolation = IgniteTxIsolation.fromOrdinal(isolation0); - - commState.idx++; + state++; case 15: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + keyBytes = reader.readCollection("keyBytes", byte[].class); - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - keyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 16: - nearXidVer = commState.getCacheVersion("nearXidVer"); + nearXidVer = reader.readMessage("nearXidVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - nodeId = commState.getUuid("nodeId"); + nodeId = reader.readUuid("nodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - partLock = commState.getBoolean("partLock"); + partLock = reader.readBoolean("partLock"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 19: - retVals = commState.getBooleanArray("retVals"); + retVals = reader.readBooleanArray("retVals"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - threadId = commState.getLong("threadId"); + threadId = reader.readLong("threadId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 21: - timeout = commState.getLong("timeout"); + timeout = reader.readLong("timeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 22: - txSize = commState.getInt("txSize"); + txSize = reader.readInt("txSize"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 23: - writeEntriesBytes = commState.getByteArray("writeEntriesBytes"); + writeEntriesBytes = reader.readByteArray("writeEntriesBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java index 32c73e6..ae7ac0e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java @@ -303,57 +303,36 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 9: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 10: - if (valBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, valBytes.size())) - return false; - - commState.it = valBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("valBytes", valBytes, GridCacheValueBytes.class)) + return false; - commState.idx++; + state++; } @@ -363,57 +342,35 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessag /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + valBytes = reader.readCollection("valBytes", GridCacheValueBytes.class); - if (commState.readSize >= 0) { - if (valBytes == null) - valBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(null); - - if (!commState.lastRead()) - return false; - - valBytes.add((GridCacheValueBytes)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java index 9a93a5e..ee4893d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java @@ -381,138 +381,96 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putCacheVersion("baseVer", baseVer)) + if (!writer.writeMessage("baseVer", baseVer != null ? baseVer.clone() : null)) return false; - commState.idx++; + state++; case 9: - if (!commState.putBoolean("commit", commit)) + if (!writer.writeBoolean("commit", commit)) return false; - commState.idx++; + state++; case 10: - if (!commState.putCacheVersion("commitVer", commitVer)) + if (!writer.writeMessage("commitVer", commitVer != null ? commitVer.clone() : null)) return false; - commState.idx++; + state++; case 11: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 12: - if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) + if (!writer.writeByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; - commState.idx++; + state++; case 13: - if (!commState.putBoolean("invalidate", invalidate)) + if (!writer.writeBoolean("invalidate", invalidate)) return false; - commState.idx++; + state++; case 14: - if (recoveryWritesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, recoveryWritesBytes.size())) - return false; - - commState.it = recoveryWritesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("recoveryWritesBytes", recoveryWritesBytes, byte[].class)) + return false; - commState.idx++; + state++; case 15: - if (!commState.putBoolean("syncCommit", syncCommit)) + if (!writer.writeBoolean("syncCommit", syncCommit)) return false; - commState.idx++; + state++; case 16: - if (!commState.putBoolean("syncRollback", syncRollback)) + if (!writer.writeBoolean("syncRollback", syncRollback)) return false; - commState.idx++; + state++; case 17: - if (!commState.putBoolean("sys", sys)) + if (!writer.writeBoolean("sys", sys)) return false; - commState.idx++; + state++; case 18: - if (!commState.putLong("threadId", threadId)) + if (!writer.writeLong("threadId", threadId)) return false; - commState.idx++; + state++; case 19: - if (!commState.putInt("txSize", txSize)) + if (!writer.writeInt("txSize", txSize)) return false; - commState.idx++; + state++; case 20: - if (writeEntriesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, writeEntriesBytes.size())) - return false; - - commState.it = writeEntriesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("writeEntriesBytes", writeEntriesBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -522,159 +480,115 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - baseVer = commState.getCacheVersion("baseVer"); + baseVer = reader.readMessage("baseVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - commit = commState.getBoolean("commit"); + commit = reader.readBoolean("commit"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - commitVer = commState.getCacheVersion("commitVer"); + commitVer = reader.readMessage("commitVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = reader.readByteArray("grpLockKeyBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - invalidate = commState.getBoolean("invalidate"); + invalidate = reader.readBoolean("invalidate"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + recoveryWritesBytes = reader.readCollection("recoveryWritesBytes", byte[].class); - if (commState.readSize >= 0) { - if (recoveryWritesBytes == null) - recoveryWritesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - recoveryWritesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 15: - syncCommit = commState.getBoolean("syncCommit"); + syncCommit = reader.readBoolean("syncCommit"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 16: - syncRollback = commState.getBoolean("syncRollback"); + syncRollback = reader.readBoolean("syncRollback"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - sys = commState.getBoolean("sys"); + sys = reader.readBoolean("sys"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - threadId = commState.getLong("threadId"); + threadId = reader.readLong("threadId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 19: - txSize = commState.getInt("txSize"); + txSize = reader.readInt("txSize"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + writeEntriesBytes = reader.readCollection("writeEntriesBytes", byte[].class); - if (commState.readSize >= 0) { - if (writeEntriesBytes == null) - writeEntriesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - writeEntriesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java index b94daa6..ab43a67 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -97,30 +97,30 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage extends GridCacheMessage extends GridDistributedBaseMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putCacheVersion("commitVer", commitVer)) + if (!writer.writeMessage("commitVer", commitVer != null ? commitVer.clone() : null)) return false; - commState.idx++; + state++; case 9: - if (!commState.putEnum("concurrency", concurrency)) + if (!writer.writeEnum("concurrency", concurrency)) return false; - commState.idx++; + state++; case 10: - if (!commState.putByteArray("dhtVersBytes", dhtVersBytes)) + if (!writer.writeByteArray("dhtVersBytes", dhtVersBytes)) return false; - commState.idx++; + state++; case 11: - if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes)) + if (!writer.writeByteArray("grpLockKeyBytes", grpLockKeyBytes)) return false; - commState.idx++; + state++; case 12: - if (!commState.putBoolean("invalidate", invalidate)) + if (!writer.writeBoolean("invalidate", invalidate)) return false; - commState.idx++; + state++; case 13: - if (!commState.putEnum("isolation", isolation)) + if (!writer.writeEnum("isolation", isolation)) return false; - commState.idx++; + state++; case 14: - if (!commState.putBoolean("partLock", partLock)) + if (!writer.writeBoolean("partLock", partLock)) return false; - commState.idx++; + state++; case 15: - if (readsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, readsBytes.size())) - return false; - - commState.it = readsBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("readsBytes", readsBytes, byte[].class)) + return false; - commState.idx++; + state++; case 16: - if (!commState.putBoolean("sys", sys)) + if (!writer.writeBoolean("sys", sys)) return false; - commState.idx++; + state++; case 17: - if (!commState.putLong("threadId", threadId)) + if (!writer.writeLong("threadId", threadId)) return false; - commState.idx++; + state++; case 18: - if (!commState.putLong("timeout", timeout)) + if (!writer.writeLong("timeout", timeout)) return false; - commState.idx++; + state++; case 19: - if (!commState.putByteArray("txNodesBytes", txNodesBytes)) + if (!writer.writeByteArray("txNodesBytes", txNodesBytes)) return false; - commState.idx++; + state++; case 20: - if (!commState.putInt("txSize", txSize)) + if (!writer.writeInt("txSize", txSize)) return false; - commState.idx++; + state++; case 21: - if (writesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, writesBytes.size())) - return false; - - commState.it = writesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("writesBytes", writesBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -589,171 +547,123 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMe /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - commitVer = commState.getCacheVersion("commitVer"); + commitVer = reader.readMessage("commitVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - byte concurrency0 = commState.getByte("concurrency"); + concurrency = reader.readEnum("concurrency", IgniteTxConcurrency.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - concurrency = IgniteTxConcurrency.fromOrdinal(concurrency0); - - commState.idx++; + state++; case 10: - dhtVersBytes = commState.getByteArray("dhtVersBytes"); + dhtVersBytes = reader.readByteArray("dhtVersBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes"); + grpLockKeyBytes = reader.readByteArray("grpLockKeyBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - invalidate = commState.getBoolean("invalidate"); + invalidate = reader.readBoolean("invalidate"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - byte isolation0 = commState.getByte("isolation"); + isolation = reader.readEnum("isolation", IgniteTxIsolation.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - isolation = IgniteTxIsolation.fromOrdinal(isolation0); - - commState.idx++; + state++; case 14: - partLock = commState.getBoolean("partLock"); + partLock = reader.readBoolean("partLock"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 15: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (readsBytes == null) - readsBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - readsBytes.add((byte[])_val); + readsBytes = reader.readCollection("readsBytes", byte[].class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 16: - sys = commState.getBoolean("sys"); + sys = reader.readBoolean("sys"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - threadId = commState.getLong("threadId"); + threadId = reader.readLong("threadId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - timeout = commState.getLong("timeout"); + timeout = reader.readLong("timeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 19: - txNodesBytes = commState.getByteArray("txNodesBytes"); + txNodesBytes = reader.readByteArray("txNodesBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - txSize = commState.getInt("txSize"); + txSize = reader.readInt("txSize"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 21: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + writesBytes = reader.readCollection("writesBytes", byte[].class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (writesBytes == null) - writesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - writesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index 057916c..cd47513 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -174,30 +174,30 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (!commState.putByteArray("candsBytes", candsBytes)) + if (!writer.writeByteArray("candsBytes", candsBytes)) return false; - commState.idx++; + state++; case 9: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; } @@ -207,27 +207,27 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseM /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - candsBytes = commState.getByteArray("candsBytes"); + candsBytes = reader.readByteArray("candsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java index d865208..9c3f6ab 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -138,45 +138,24 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 8: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; + if (!writer.writeCollection("keyBytes", keyBytes, byte[].class)) + return false; - commState.it = keyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } - - commState.idx++; + state++; } @@ -186,41 +165,19 @@ public class GridDistributedUnlockRequest extends GridDistributedBaseMessa /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 8: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - keyBytes.add((byte[])_val); - - commState.readItems++; - } - } + keyBytes = reader.readCollection("keyBytes", byte[].class); - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java index 1ba3753..3534fd3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java @@ -87,24 +87,24 @@ public class GridDhtAffinityAssignmentRequest extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridCacheMessage extends GridDistributedLockRequest { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 24: - if (!commState.putLong("accessTtl", accessTtl)) + if (!writer.writeLong("accessTtl", accessTtl)) return false; - commState.idx++; + state++; case 25: - if (!commState.putBitSet("invalidateEntries", invalidateEntries)) + if (!writer.writeBitSet("invalidateEntries", invalidateEntries)) return false; - commState.idx++; + state++; case 26: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 27: - if (nearKeyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearKeyBytes.size())) - return false; - - commState.it = nearKeyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearKeyBytes", nearKeyBytes, byte[].class)) + return false; - commState.idx++; + state++; case 28: - if (!commState.putByteArray("ownedBytes", ownedBytes)) + if (!writer.writeByteArray("ownedBytes", ownedBytes)) return false; - commState.idx++; + state++; case 29: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeBitSet("preloadKeys", preloadKeys)) return false; - commState.idx++; + state++; case 30: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 31: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 32: - if (!commState.putBitSet("preloadKeys", preloadKeys)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -468,105 +447,83 @@ public class GridDhtLockRequest extends GridDistributedLockRequest { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 24: - accessTtl = commState.getLong("accessTtl"); + accessTtl = reader.readLong("accessTtl"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 25: - invalidateEntries = commState.getBitSet("invalidateEntries"); + invalidateEntries = reader.readBitSet("invalidateEntries"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 26: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 27: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nearKeyBytes = reader.readCollection("nearKeyBytes", byte[].class); - if (commState.readSize >= 0) { - if (nearKeyBytes == null) - nearKeyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearKeyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 28: - ownedBytes = commState.getByteArray("ownedBytes"); + ownedBytes = reader.readByteArray("ownedBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 29: - topVer = commState.getLong("topVer"); + preloadKeys = reader.readBitSet("preloadKeys"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 30: - subjId = commState.getUuid("subjId"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 31: - taskNameHash = commState.getInt("taskNameHash"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 32: - preloadKeys = commState.getBitSet("preloadKeys"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index f301a8f..2f28b89 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -225,105 +225,42 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 11: - if (invalidParts != null) { - if (commState.it == null) { - if (!commState.putInt(null, invalidParts.size())) - return false; - - commState.it = invalidParts.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("invalidParts", invalidParts, int.class)) + return false; - commState.idx++; + state++; case 12: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 13: - if (nearEvictedBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearEvictedBytes.size())) - return false; - - commState.it = nearEvictedBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearEvictedBytes", nearEvictedBytes, byte[].class)) + return false; - commState.idx++; + state++; case 14: - if (preloadEntriesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, preloadEntriesBytes.size())) - return false; - - commState.it = preloadEntriesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("preloadEntriesBytes", preloadEntriesBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -333,109 +270,43 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 11: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (invalidParts == null) - invalidParts = new HashSet<>(commState.readSize); + invalidParts = reader.readCollection("invalidParts", int.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - invalidParts.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 12: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearEvictedBytes == null) - nearEvictedBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearEvictedBytes.add((byte[])_val); + nearEvictedBytes = reader.readCollection("nearEvictedBytes", byte[].class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 14: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (preloadEntriesBytes == null) - preloadEntriesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); + preloadEntriesBytes = reader.readCollection("preloadEntriesBytes", byte[].class); - if (!commState.lastRead()) - return false; - - preloadEntriesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index f814c5d..adc6df9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -382,138 +382,96 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 21: - if (!commState.putEnum("isolation", isolation)) + if (!writer.writeEnum("isolation", isolation)) return false; - commState.idx++; + state++; case 22: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 23: - if (!commState.putUuid("nearNodeId", nearNodeId)) + if (!writer.writeUuid("nearNodeId", nearNodeId)) return false; - commState.idx++; + state++; case 24: - if (!commState.putLongList("nearTtls", nearTtls)) + if (!writer.writeMessage("nearTtls", nearTtls != null ? nearTtls.clone() : null)) return false; - commState.idx++; + state++; case 25: - if (nearWritesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearWritesBytes.size())) - return false; - - commState.it = nearWritesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearWritesBytes", nearWritesBytes, byte[].class)) + return false; - commState.idx++; + state++; case 26: - if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) + if (!writer.writeBoolean("onePhaseCommit", onePhaseCommit)) return false; - commState.idx++; + state++; case 27: - if (pendingVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, pendingVers.size())) - return false; - - commState.it = pendingVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("pendingVers", pendingVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 28: - if (!commState.putBoolean("sysInvalidate", sysInvalidate)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 29: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeBoolean("sysInvalidate", sysInvalidate)) return false; - commState.idx++; + state++; case 30: - if (!commState.putLongList("ttls", ttls)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 31: - if (!commState.putCacheVersion("writeVer", writeVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 32: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeMessage("ttls", ttls != null ? ttls.clone() : null)) return false; - commState.idx++; + state++; case 33: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeMessage("writeVer", writeVer != null ? writeVer.clone() : null)) return false; - commState.idx++; + state++; } @@ -523,161 +481,115 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 21: - byte isolation0 = commState.getByte("isolation"); + isolation = reader.readEnum("isolation", IgniteTxIsolation.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - isolation = IgniteTxIsolation.fromOrdinal(isolation0); - - commState.idx++; + state++; case 22: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 23: - nearNodeId = commState.getUuid("nearNodeId"); + nearNodeId = reader.readUuid("nearNodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 24: - nearTtls = commState.getLongList("nearTtls"); + nearTtls = reader.readMessage("nearTtls"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 25: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nearWritesBytes = reader.readCollection("nearWritesBytes", byte[].class); - if (commState.readSize >= 0) { - if (nearWritesBytes == null) - nearWritesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearWritesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 26: - onePhaseCommit = commState.getBoolean("onePhaseCommit"); + onePhaseCommit = reader.readBoolean("onePhaseCommit"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 27: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + pendingVers = reader.readCollection("pendingVers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (pendingVers == null) - pendingVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - pendingVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 28: - sysInvalidate = commState.getBoolean("sysInvalidate"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 29: - topVer = commState.getLong("topVer"); + sysInvalidate = reader.readBoolean("sysInvalidate"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 30: - ttls = commState.getLongList("ttls"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 31: - writeVer = commState.getCacheVersion("writeVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 32: - subjId = commState.getUuid("subjId"); + ttls = reader.readMessage("ttls"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 33: - taskNameHash = commState.getInt("taskNameHash"); + writeVer = reader.readMessage("writeVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java index 590f06a..c8b2046 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java @@ -90,24 +90,24 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 5: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; } @@ -117,19 +117,19 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishRespon /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 5: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 d7af780..a57827c 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 @@ -346,111 +346,90 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 22: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 23: - if (!commState.putBitSet("invalidateNearEntries", invalidateNearEntries)) + if (!writer.writeBitSet("invalidateNearEntries", invalidateNearEntries)) return false; - commState.idx++; + state++; case 24: - if (!commState.putBoolean("last", last)) + if (!writer.writeBoolean("last", last)) return false; - commState.idx++; + state++; case 25: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 26: - if (!commState.putUuid("nearNodeId", nearNodeId)) + if (!writer.writeUuid("nearNodeId", nearNodeId)) return false; - commState.idx++; + state++; case 27: - if (nearWritesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearWritesBytes.size())) - return false; - - commState.it = nearWritesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearWritesBytes", nearWritesBytes, byte[].class)) + return false; - commState.idx++; + state++; case 28: - if (!commState.putCacheVersion("nearXidVer", nearXidVer)) + if (!writer.writeMessage("nearXidVer", nearXidVer != null ? nearXidVer.clone() : null)) return false; - commState.idx++; + state++; case 29: - if (!commState.putByteArray("ownedBytes", ownedBytes)) + if (!writer.writeByteArray("ownedBytes", ownedBytes)) return false; - commState.idx++; + state++; case 30: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeBitSet("preloadKeys", preloadKeys)) return false; - commState.idx++; + state++; case 31: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 32: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 33: - if (!commState.putBitSet("preloadKeys", preloadKeys)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -460,129 +439,107 @@ public class GridDhtTxPrepareRequest extends GridDistributedTxPrepareReque /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 22: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 23: - invalidateNearEntries = commState.getBitSet("invalidateNearEntries"); + invalidateNearEntries = reader.readBitSet("invalidateNearEntries"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 24: - last = commState.getBoolean("last"); + last = reader.readBoolean("last"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 25: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 26: - nearNodeId = commState.getUuid("nearNodeId"); + nearNodeId = reader.readUuid("nearNodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 27: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nearWritesBytes = reader.readCollection("nearWritesBytes", byte[].class); - if (commState.readSize >= 0) { - if (nearWritesBytes == null) - nearWritesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearWritesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 28: - nearXidVer = commState.getCacheVersion("nearXidVer"); + nearXidVer = reader.readMessage("nearXidVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 29: - ownedBytes = commState.getByteArray("ownedBytes"); + ownedBytes = reader.readByteArray("ownedBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 30: - topVer = commState.getLong("topVer"); + preloadKeys = reader.readBitSet("preloadKeys"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 31: - subjId = commState.getUuid("subjId"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 32: - taskNameHash = commState.getInt("taskNameHash"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 33: - preloadKeys = commState.getBitSet("preloadKeys"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index fd6c0b4..3196399 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -232,111 +232,48 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 10: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 11: - if (invalidParts != null) { - if (commState.it == null) { - if (!commState.putInt(null, invalidParts.size())) - return false; - - commState.it = invalidParts.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("invalidParts", invalidParts, int.class)) + return false; - commState.idx++; + state++; case 12: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 13: - if (nearEvictedBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearEvictedBytes.size())) - return false; - - commState.it = nearEvictedBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearEvictedBytes", nearEvictedBytes, byte[].class)) + return false; - commState.idx++; + state++; case 14: - if (preloadEntriesBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, preloadEntriesBytes.size())) - return false; - - commState.it = preloadEntriesBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("preloadEntriesBytes", preloadEntriesBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -346,117 +283,51 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResp /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 10: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (invalidParts == null) - invalidParts = new ArrayList<>(commState.readSize); + invalidParts = reader.readCollection("invalidParts", int.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - invalidParts.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 12: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearEvictedBytes == null) - nearEvictedBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearEvictedBytes.add((byte[])_val); + nearEvictedBytes = reader.readCollection("nearEvictedBytes", byte[].class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 14: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (preloadEntriesBytes == null) - preloadEntriesBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); + preloadEntriesBytes = reader.readCollection("preloadEntriesBytes", byte[].class); - if (!commState.lastRead()) - return false; - - preloadEntriesBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index 19a9dce..7c381d6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -126,45 +126,24 @@ public class GridDhtUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest= 0) { - if (nearKeyBytes == null) - nearKeyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearKeyBytes.add((byte[])_val); - - commState.readItems++; - } - } + nearKeyBytes = reader.readCollection("nearKeyBytes", byte[].class); - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java index 07ba0bb..955bb4f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java @@ -94,45 +94,24 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (futVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, futVers.size())) - return false; + if (!writer.writeCollection("futVers", futVers, GridCacheVersion.class)) + return false; - commState.it = futVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } - - commState.idx++; + state++; } @@ -142,41 +121,19 @@ public class GridDhtAtomicDeferredUpdateResponse extends GridCacheMessage< /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (futVers == null) - futVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - futVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } + futVers = reader.readCollection("futVers", GridCacheVersion.class); - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index c69fc6e..6b59e82 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -728,306 +728,138 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putLongList("drExpireTimes", drExpireTimes)) + if (!writer.writeMessage("drExpireTimes", drExpireTimes != null ? drExpireTimes.clone() : null)) return false; - commState.idx++; + state++; case 4: - if (drVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, drVers.size())) - return false; - - commState.it = drVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("drVers", drVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 5: - if (!commState.putCacheVersion("futVer", futVer)) + if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, byte[].class)) return false; - commState.idx++; + state++; case 6: - if (invokeArgsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, invokeArgsBytes.length)) - return false; - - commState.it = arrayIterator(invokeArgsBytes); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups)) + return false; - commState.idx++; + state++; case 7: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; - - commState.it = keyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMessage("futVer", futVer != null ? futVer.clone() : null)) + return false; - commState.idx++; + state++; case 8: - if (!commState.putLongList("nearExpireTimes", nearExpireTimes)) + if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, byte[].class)) return false; - commState.idx++; + state++; case 9: - if (!commState.putLongList("nearTtls", nearTtls)) + if (!writer.writeCollection("keyBytes", keyBytes, byte[].class)) return false; - commState.idx++; + state++; case 10: - if (!commState.putUuid("nodeId", nodeId)) + if (!writer.writeCollection("nearEntryProcessorsBytes", nearEntryProcessorsBytes, byte[].class)) return false; - commState.idx++; + state++; case 11: - if (!commState.putEnum("syncMode", syncMode)) + if (!writer.writeMessage("nearExpireTimes", nearExpireTimes != null ? nearExpireTimes.clone() : null)) return false; - commState.idx++; + state++; case 12: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeCollection("nearKeyBytes", nearKeyBytes, byte[].class)) return false; - commState.idx++; + state++; case 13: - if (!commState.putLongList("ttls", ttls)) + if (!writer.writeMessage("nearTtls", nearTtls != null ? nearTtls.clone() : null)) return false; - commState.idx++; + state++; case 14: - if (valBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, valBytes.size())) - return false; - - commState.it = valBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearValBytes", nearValBytes, GridCacheValueBytes.class)) + return false; - commState.idx++; + state++; case 15: - if (!commState.putCacheVersion("writeVer", writeVer)) + if (!writer.writeUuid("nodeId", nodeId)) return false; - commState.idx++; + state++; case 16: - if (nearKeyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearKeyBytes.size())) - return false; - - commState.it = nearKeyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeUuid("subjId", subjId)) + return false; - commState.idx++; + state++; case 17: - if (nearValBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearValBytes.size())) - return false; - - commState.it = nearValBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeEnum("syncMode", syncMode)) + return false; - commState.idx++; + state++; case 18: - if (entryProcessorsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, entryProcessorsBytes.size())) - return false; - - commState.it = entryProcessorsBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeInt("taskNameHash", taskNameHash)) + return false; - commState.idx++; + state++; case 19: - if (!commState.putBoolean("forceTransformBackups", forceTransformBackups)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 20: - if (nearEntryProcessorsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearEntryProcessorsBytes.size())) - return false; - - commState.it = nearEntryProcessorsBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMessage("ttls", ttls != null ? ttls.clone() : null)) + return false; - commState.idx++; + state++; case 21: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeCollection("valBytes", valBytes, GridCacheValueBytes.class)) return false; - commState.idx++; + state++; case 22: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeMessage("writeVer", writeVer != null ? writeVer.clone() : null)) return false; - commState.idx++; + state++; } @@ -1037,349 +869,171 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage imp /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - drExpireTimes = commState.getLongList("drExpireTimes"); + drExpireTimes = reader.readMessage("drExpireTimes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (drVers == null) - drVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - drVers.add((GridCacheVersion)_val); + drVers = reader.readCollection("drVers", GridCacheVersion.class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - futVer = commState.getCacheVersion("futVer"); + entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (invokeArgsBytes == null) - invokeArgsBytes = new byte[commState.readSize][]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - invokeArgsBytes[i] = (byte[])_val; + forceTransformBackups = reader.readBoolean("forceTransformBackups"); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; + futVer = reader.readMessage("futVer"); - keyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 8: - nearExpireTimes = commState.getLongList("nearExpireTimes"); + invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - nearTtls = commState.getLongList("nearTtls"); + keyBytes = reader.readCollection("keyBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - nodeId = commState.getUuid("nodeId"); + nearEntryProcessorsBytes = reader.readCollection("nearEntryProcessorsBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - byte syncMode0 = commState.getByte("syncMode"); + nearExpireTimes = reader.readMessage("nearExpireTimes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncMode0); - - commState.idx++; + state++; case 12: - topVer = commState.getLong("topVer"); + nearKeyBytes = reader.readCollection("nearKeyBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - ttls = commState.getLongList("ttls"); + nearTtls = reader.readMessage("nearTtls"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (valBytes == null) - valBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(null); + nearValBytes = reader.readCollection("nearValBytes", GridCacheValueBytes.class); - if (!commState.lastRead()) - return false; - - valBytes.add((GridCacheValueBytes)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 15: - writeVer = commState.getCacheVersion("writeVer"); + nodeId = reader.readUuid("nodeId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 16: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearKeyBytes == null) - nearKeyBytes = new ArrayList<>(commState.readSize); + subjId = reader.readUuid("subjId"); - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearKeyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 17: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearValBytes == null) - nearValBytes = new ArrayList<>(commState.readSize); + syncMode = reader.readEnum("syncMode", CacheWriteSynchronizationMode.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(null); - - if (!commState.lastRead()) - return false; - - nearValBytes.add((GridCacheValueBytes)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 18: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + taskNameHash = reader.readInt("taskNameHash"); - if (commState.readSize >= 0) { - if (entryProcessorsBytes == null) - entryProcessorsBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - entryProcessorsBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 19: - forceTransformBackups = commState.getBoolean("forceTransformBackups"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + ttls = reader.readMessage("ttls"); - if (commState.readSize >= 0) { - if (nearEntryProcessorsBytes == null) - nearEntryProcessorsBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearEntryProcessorsBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 21: - subjId = commState.getUuid("subjId"); + valBytes = reader.readCollection("valBytes", GridCacheValueBytes.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 22: - taskNameHash = commState.getInt("taskNameHash"); + writeVer = reader.readMessage("writeVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index afd013c..256c4b6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -205,63 +205,42 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("failedKeysBytes", failedKeysBytes)) + if (!writer.writeByteArray("failedKeysBytes", failedKeysBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putCacheVersion("futVer", futVer)) + if (!writer.writeMessage("futVer", futVer != null ? futVer.clone() : null)) return false; - commState.idx++; + state++; case 6: - if (nearEvictedBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearEvictedBytes.size())) - return false; - - commState.it = nearEvictedBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearEvictedBytes", nearEvictedBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -271,65 +250,43 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - failedKeysBytes = commState.getByteArray("failedKeysBytes"); + failedKeysBytes = reader.readByteArray("failedKeysBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - futVer = commState.getCacheVersion("futVer"); + futVer = reader.readMessage("futVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + nearEvictedBytes = reader.readCollection("nearEvictedBytes", byte[].class); - if (commState.readSize >= 0) { - if (nearEvictedBytes == null) - nearEvictedBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - nearEvictedBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java index f700649..cf23451 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java @@ -587,237 +587,132 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putLongList("drExpireTimes", drExpireTimes)) + if (!writer.writeMessage("drExpireTimes", drExpireTimes != null ? drExpireTimes.clone() : null)) return false; - commState.idx++; + state++; case 4: - if (!commState.putLongList("drTtls", drTtls)) + if (!writer.writeMessage("drTtls", drTtls != null ? drTtls.clone() : null)) return false; - commState.idx++; + state++; case 5: - if (drVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, drVers.size())) - return false; - - commState.it = drVers.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("drVers", drVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 6: - if (!commState.putByteArray("expiryPlcBytes", expiryPlcBytes)) + if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes)) return false; - commState.idx++; + state++; case 7: - if (!commState.putBoolean("fastMap", fastMap)) + if (!writer.writeBoolean("fastMap", fastMap)) return false; - commState.idx++; + state++; case 8: - if (filterBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, filterBytes.length)) - return false; - - commState.it = arrayIterator(filterBytes); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("filterBytes", filterBytes, byte[].class)) + return false; - commState.idx++; + state++; case 9: - if (!commState.putCacheVersion("futVer", futVer)) + if (!writer.writeBoolean("forceTransformBackups", forceTransformBackups)) return false; - commState.idx++; + state++; case 10: - if (!commState.putBoolean("hasPrimary", hasPrimary)) + if (!writer.writeMessage("futVer", futVer != null ? futVer.clone() : null)) return false; - commState.idx++; + state++; case 11: - if (invokeArgsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, invokeArgsBytes.length)) - return false; - - commState.it = arrayIterator(invokeArgsBytes); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeBoolean("hasPrimary", hasPrimary)) + return false; - commState.idx++; + state++; case 12: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; - - commState.it = keyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, byte[].class)) + return false; - commState.idx++; + state++; case 13: - if (!commState.putEnum("op", op)) + if (!writer.writeCollection("keyBytes", keyBytes, byte[].class)) return false; - commState.idx++; + state++; case 14: - if (!commState.putBoolean("retval", retval)) + if (!writer.writeEnum("op", op)) return false; - commState.idx++; + state++; case 15: - if (!commState.putEnum("syncMode", syncMode)) + if (!writer.writeBoolean("retval", retval)) return false; - commState.idx++; + state++; case 16: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 17: - if (!commState.putCacheVersion("updateVer", updateVer)) + if (!writer.writeEnum("syncMode", syncMode)) return false; - commState.idx++; + state++; case 18: - if (valBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, valBytes.size())) - return false; - - commState.it = valBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeInt("taskNameHash", taskNameHash)) + return false; - commState.idx++; + state++; case 19: - if (!commState.putBoolean("forceTransformBackups", forceTransformBackups)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 20: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeMessage("updateVer", updateVer != null ? updateVer.clone() : null)) return false; - commState.idx++; + state++; case 21: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeCollection("valBytes", valBytes, GridCacheValueBytes.class)) return false; - commState.idx++; + state++; } @@ -827,277 +722,163 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage im /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - drExpireTimes = commState.getLongList("drExpireTimes"); + drExpireTimes = reader.readMessage("drExpireTimes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - drTtls = commState.getLongList("drTtls"); + drTtls = reader.readMessage("drTtls"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (drVers == null) - drVers = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; + drVers = reader.readCollection("drVers", GridCacheVersion.class); - drVers.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 6: - expiryPlcBytes = commState.getByteArray("expiryPlcBytes"); + expiryPlcBytes = reader.readByteArray("expiryPlcBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - fastMap = commState.getBoolean("fastMap"); + fastMap = reader.readBoolean("fastMap"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (filterBytes == null) - filterBytes = new byte[commState.readSize][]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - filterBytes[i] = (byte[])_val; - - commState.readItems++; - } - } + filterBytes = reader.readObjectArray("filterBytes", byte[].class); - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 9: - futVer = commState.getCacheVersion("futVer"); + forceTransformBackups = reader.readBoolean("forceTransformBackups"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - hasPrimary = commState.getBoolean("hasPrimary"); + futVer = reader.readMessage("futVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (invokeArgsBytes == null) - invokeArgsBytes = new byte[commState.readSize][]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); + hasPrimary = reader.readBoolean("hasPrimary"); - if (!commState.lastRead()) - return false; - - invokeArgsBytes[i] = (byte[])_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 12: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", byte[].class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - keyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 13: - byte op0 = commState.getByte("op"); + keyBytes = reader.readCollection("keyBytes", byte[].class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - op = GridCacheOperation.fromOrdinal(op0); - - commState.idx++; + state++; case 14: - retval = commState.getBoolean("retval"); + op = reader.readEnum("op", GridCacheOperation.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 15: - byte syncMode0 = commState.getByte("syncMode"); + retval = reader.readBoolean("retval"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncMode0); - - commState.idx++; + state++; case 16: - topVer = commState.getLong("topVer"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - updateVer = commState.getCacheVersion("updateVer"); + syncMode = reader.readEnum("syncMode", CacheWriteSynchronizationMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (valBytes == null) - valBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(null); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) - return false; - - valBytes.add((GridCacheValueBytes)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 19: - forceTransformBackups = commState.getBoolean("forceTransformBackups"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - subjId = commState.getUuid("subjId"); + updateVer = reader.readMessage("updateVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 21: - taskNameHash = commState.getInt("taskNameHash"); + valBytes = reader.readCollection("valBytes", GridCacheValueBytes.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index d91e800..23bca9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -455,147 +455,84 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("failedKeysBytes", failedKeysBytes)) + if (!writer.writeByteArray("failedKeysBytes", failedKeysBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putCacheVersion("futVer", futVer)) + if (!writer.writeMessage("futVer", futVer != null ? futVer.clone() : null)) return false; - commState.idx++; + state++; case 6: - if (!commState.putLongList("nearExpireTimes", nearExpireTimes)) + if (!writer.writeMessage("nearExpireTimes", nearExpireTimes != null ? nearExpireTimes.clone() : null)) return false; - commState.idx++; + state++; case 7: - if (!commState.putLongList("nearTtls", nearTtls)) + if (!writer.writeCollection("nearSkipIdxs", nearSkipIdxs, int.class)) return false; - commState.idx++; + state++; case 8: - if (!commState.putByteArray("remapKeysBytes", remapKeysBytes)) + if (!writer.writeMessage("nearTtls", nearTtls != null ? nearTtls.clone() : null)) return false; - commState.idx++; + state++; case 9: - if (!commState.putByteArray("retValBytes", retValBytes)) + if (!writer.writeCollection("nearValBytes", nearValBytes, GridCacheValueBytes.class)) return false; - commState.idx++; + state++; case 10: - if (nearSkipIdxs != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearSkipIdxs.size())) - return false; - - commState.it = nearSkipIdxs.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("nearValsIdxs", nearValsIdxs, int.class)) + return false; - commState.idx++; + state++; case 11: - if (nearValBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearValBytes.size())) - return false; - - commState.it = nearValBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMessage("nearVer", nearVer != null ? nearVer.clone() : null)) + return false; - commState.idx++; + state++; case 12: - if (nearValsIdxs != null) { - if (commState.it == null) { - if (!commState.putInt(null, nearValsIdxs.size())) - return false; - - commState.it = nearValsIdxs.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeByteArray("remapKeysBytes", remapKeysBytes)) + return false; - commState.idx++; + state++; case 13: - if (!commState.putCacheVersion("nearVer", nearVer)) + if (!writer.writeByteArray("retValBytes", retValBytes)) return false; - commState.idx++; + state++; } @@ -605,165 +542,99 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage i /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - failedKeysBytes = commState.getByteArray("failedKeysBytes"); + failedKeysBytes = reader.readByteArray("failedKeysBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - futVer = commState.getCacheVersion("futVer"); + futVer = reader.readMessage("futVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - nearExpireTimes = commState.getLongList("nearExpireTimes"); + nearExpireTimes = reader.readMessage("nearExpireTimes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - nearTtls = commState.getLongList("nearTtls"); + nearSkipIdxs = reader.readCollection("nearSkipIdxs", int.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - remapKeysBytes = commState.getByteArray("remapKeysBytes"); + nearTtls = reader.readMessage("nearTtls"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - retValBytes = commState.getByteArray("retValBytes"); + nearValBytes = reader.readCollection("nearValBytes", GridCacheValueBytes.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearSkipIdxs == null) - nearSkipIdxs = new ArrayList<>(commState.readSize); + nearValsIdxs = reader.readCollection("nearValsIdxs", int.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - nearSkipIdxs.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 11: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearValBytes == null) - nearValBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheValueBytes _val = commState.getValueBytes(null); - - if (!commState.lastRead()) - return false; - - nearValBytes.add((GridCacheValueBytes)_val); + nearVer = reader.readMessage("nearVer"); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 12: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (nearValsIdxs == null) - nearValsIdxs = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); + remapKeysBytes = reader.readByteArray("remapKeysBytes"); - if (!commState.lastRead()) - return false; - - nearValsIdxs.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 13: - nearVer = commState.getCacheVersion("nearVer"); + retValBytes = reader.readByteArray("retValBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java index 66a6ad1..60c4a9a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java @@ -187,63 +187,42 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 4: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; - - commState.it = keyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("keyBytes", keyBytes, byte[].class)) + return false; - commState.idx++; + state++; case 5: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 6: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -253,65 +232,43 @@ public class GridDhtForceKeysRequest extends GridCacheMessage implem /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + keyBytes = reader.readCollection("keyBytes", byte[].class); - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - keyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index 626cb1f..ff8cdca 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -191,63 +191,42 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("infosBytes", infosBytes)) + if (!writer.writeByteArray("infosBytes", infosBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 6: - if (missedKeyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, missedKeyBytes.size())) - return false; - - commState.it = missedKeyBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("missedKeyBytes", missedKeyBytes, byte[].class)) + return false; - commState.idx++; + state++; } @@ -257,65 +236,43 @@ public class GridDhtForceKeysResponse extends GridCacheMessage imple /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - infosBytes = commState.getByteArray("infosBytes"); + infosBytes = reader.readByteArray("infosBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + missedKeyBytes = reader.readCollection("missedKeyBytes", byte[].class); - if (commState.readSize >= 0) { - if (missedKeyBytes == null) - missedKeyBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - missedKeyBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index 59eb2bd..409522c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -217,75 +217,54 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (parts != null) { - if (commState.it == null) { - if (!commState.putInt(null, parts.size())) - return false; - - commState.it = parts.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("parts", parts, int.class)) + return false; - commState.idx++; + state++; case 4: - if (!commState.putLong("timeout", timeout)) + if (!writer.writeLong("timeout", timeout)) return false; - commState.idx++; + state++; case 5: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 6: - if (!commState.putByteArray("topicBytes", topicBytes)) + if (!writer.writeByteArray("topicBytes", topicBytes)) return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("updateSeq", updateSeq)) + if (!writer.writeLong("updateSeq", updateSeq)) return false; - commState.idx++; + state++; case 8: - if (!commState.putInt("workerId", workerId)) + if (!writer.writeInt("workerId", workerId)) return false; - commState.idx++; + state++; } @@ -295,81 +274,59 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + parts = reader.readCollection("parts", int.class); - if (commState.readSize >= 0) { - if (parts == null) - parts = new HashSet<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - parts.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 4: - timeout = commState.getLong("timeout"); + timeout = reader.readLong("timeout"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - topicBytes = commState.getByteArray("topicBytes"); + topicBytes = reader.readByteArray("topicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - updateSeq = commState.getLong("updateSeq"); + updateSeq = reader.readLong("updateSeq"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - workerId = commState.getInt("workerId"); + workerId = reader.readInt("workerId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java index dc9d26c..622f639 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java @@ -147,12 +147,71 @@ public class GridDhtPartitionExchangeId extends MessageAdapter implements Compar /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - return false; // TODO: implement. + writer.setBuffer(buf); + + if (!typeWritten) { + if (!writer.writeByte(null, directType())) + return false; + + typeWritten = true; + } + + switch (state) { + case 0: + if (!writer.writeInt("evt", evt)) + return false; + + state++; + + case 1: + if (!writer.writeUuid("nodeId", nodeId)) + return false; + + state++; + + case 2: + if (!writer.writeLong("topVer", topVer)) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - return false; // TODO: implement. + reader.setBuffer(buf); + + switch (state) { + case 0: + evt = reader.readInt("evt"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 1: + nodeId = reader.readUuid("nodeId"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 2: + topVer = reader.readLong("topVer"); + + if (!reader.isLastRead()) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @@ -162,12 +221,20 @@ public class GridDhtPartitionExchangeId extends MessageAdapter implements Compar /** {@inheritDoc} */ @Override public MessageAdapter clone() { - return null; // TODO: implement. + GridDhtPartitionExchangeId _clone = new GridDhtPartitionExchangeId(); + + clone0(_clone); + + return _clone; } /** {@inheritDoc} */ @Override protected void clone0(MessageAdapter _msg) { - // TODO: implement. + GridDhtPartitionExchangeId _clone = (GridDhtPartitionExchangeId)_msg; + + _clone.nodeId = nodeId; + _clone.evt = evt; + _clone.topVer = topVer; } /** {@inheritDoc} */ 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 8b953a9..4835e77 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 @@ -302,96 +302,54 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putBoolean("ack", ack)) + if (!writer.writeBoolean("ack", ack)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("infoBytes", infoBytes)) + if (!writer.writeByteArray("infoBytes", infoBytes)) return false; - commState.idx++; + state++; case 5: - if (last != null) { - if (commState.it == null) { - if (!commState.putInt(null, last.size())) - return false; - - commState.it = last.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("last", last, int.class)) + return false; - commState.idx++; + state++; case 6: - if (missed != null) { - if (commState.it == null) { - if (!commState.putInt(null, missed.size())) - return false; - - commState.it = missed.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("missed", missed, int.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("updateSeq", updateSeq)) + if (!writer.writeLong("updateSeq", updateSeq)) return false; - commState.idx++; + state++; case 8: - if (!commState.putInt("workerId", workerId)) + if (!writer.writeInt("workerId", workerId)) return false; - commState.idx++; + state++; } @@ -401,103 +359,59 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - ack = commState.getBoolean("ack"); + ack = reader.readBoolean("ack"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - infoBytes = commState.getByteArray("infoBytes"); + infoBytes = reader.readByteArray("infoBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + last = reader.readCollection("last", int.class); - if (commState.readSize >= 0) { - if (last == null) - last = new HashSet<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - last.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + missed = reader.readCollection("missed", int.class); - if (commState.readSize >= 0) { - if (missed == null) - missed = new HashSet<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - missed.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - updateSeq = commState.getLong("updateSeq"); + updateSeq = reader.readLong("updateSeq"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - workerId = commState.getInt("workerId"); + workerId = reader.readInt("workerId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 b8905f9c..961da85 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,30 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage extends GridCacheMessage extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 5: - if (!commState.putByteArray("affAssignmentBytes", affAssignmentBytes)) + if (!writer.writeByteArray("affAssignmentBytes", affAssignmentBytes)) return false; - commState.idx++; + state++; case 6: - if (!commState.putByteArray("partsBytes", partsBytes)) + if (!writer.writeByteArray("partsBytes", partsBytes)) return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -207,35 +207,35 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstrac /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 5: - affAssignmentBytes = commState.getByteArray("affAssignmentBytes"); + affAssignmentBytes = reader.readByteArray("affAssignmentBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - partsBytes = commState.getByteArray("partsBytes"); + partsBytes = reader.readByteArray("partsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 94efd43..d9c9e45 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 @@ -117,24 +117,24 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 5: - if (!commState.putByteArray("partsBytes", partsBytes)) + if (!writer.writeByteArray("partsBytes", partsBytes)) return false; - commState.idx++; + state++; } @@ -144,19 +144,19 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 5: - partsBytes = commState.getByteArray("partsBytes"); + partsBytes = reader.readByteArray("partsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 d7a091b..944fcc0 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 @@ -63,16 +63,16 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } return true; @@ -81,7 +81,7 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstr /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; 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 f8c5cc2..44088aa 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 @@ -281,137 +281,84 @@ public class GridNearGetRequest extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putLong("accessTtl", accessTtl)) + if (!writer.writeLong("accessTtl", accessTtl)) return false; - commState.idx++; + state++; case 4: - if (filterBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, filterBytes.length)) - return false; - - commState.it = arrayIterator(filterBytes); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("filterBytes", filterBytes, byte[].class)) + return false; - commState.idx++; + state++; case 5: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 6: - if (keyBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, keyBytes.size())) - return false; - - commState.it = keyBytes.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putByteArray(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putBoolean(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("keyBytes", keyBytes, byte[].class, boolean.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 8: - if (!commState.putBoolean("readThrough", readThrough)) + if (!writer.writeBoolean("readThrough", readThrough)) return false; - commState.idx++; + state++; case 9: - if (!commState.putBoolean("reload", reload)) + if (!writer.writeBoolean("reload", reload)) return false; - commState.idx++; + state++; case 10: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 11: - if (!commState.putCacheVersion("ver", ver)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 12: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 13: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeMessage("ver", ver != null ? ver.clone() : null)) return false; - commState.idx++; + state++; } @@ -421,156 +368,99 @@ public class GridNearGetRequest extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - accessTtl = commState.getLong("accessTtl"); + accessTtl = reader.readLong("accessTtl"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + filterBytes = reader.readObjectArray("filterBytes", byte[].class); - if (commState.readSize >= 0) { - if (filterBytes == null) - filterBytes = new byte[commState.readSize][]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - filterBytes[i] = (byte[])_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (keyBytes == null) - keyBytes = new LinkedHashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - byte[] _val = commState.getByteArray(null); + keyBytes = reader.readMap("keyBytes", byte[].class, boolean.class); - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - boolean _val = commState.getBoolean(null); - - if (!commState.lastRead()) - return false; - - keyBytes.put((byte[])commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - readThrough = commState.getBoolean("readThrough"); + readThrough = reader.readBoolean("readThrough"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - reload = commState.getBoolean("reload"); + reload = reader.readBoolean("reload"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - topVer = commState.getLong("topVer"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - ver = commState.getCacheVersion("ver"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - subjId = commState.getUuid("subjId"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - taskNameHash = commState.getInt("taskNameHash"); + ver = reader.readMessage("ver"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 cc2a48a..63c9e46 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 @@ -229,81 +229,60 @@ public class GridNearGetResponse extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putByteArray("entriesBytes", entriesBytes)) + if (!writer.writeByteArray("entriesBytes", entriesBytes)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 6: - if (invalidParts != null) { - if (commState.it == null) { - if (!commState.putInt(null, invalidParts.size())) - return false; - - commState.it = invalidParts.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("invalidParts", invalidParts, int.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 8: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; case 9: - if (!commState.putCacheVersion("ver", ver)) + if (!writer.writeMessage("ver", ver != null ? ver.clone() : null)) return false; - commState.idx++; + state++; } @@ -313,89 +292,67 @@ public class GridNearGetResponse extends GridCacheMessage implements /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - entriesBytes = commState.getByteArray("entriesBytes"); + entriesBytes = reader.readByteArray("entriesBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + invalidParts = reader.readCollection("invalidParts", int.class); - if (commState.readSize >= 0) { - if (invalidParts == null) - invalidParts = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - invalidParts.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - topVer = commState.getLong("topVer"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - ver = commState.getCacheVersion("ver"); + ver = reader.readMessage("ver"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 da008ac..5997007 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 @@ -364,132 +364,90 @@ public class GridNearLockRequest extends GridDistributedLockRequest /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 24: - if (!commState.putLong("accessTtl", accessTtl)) + if (!writer.writeLong("accessTtl", accessTtl)) return false; - commState.idx++; + state++; case 25: - if (dhtVers != null) { - if (commState.it == null) { - if (!commState.putInt(null, dhtVers.length)) - return false; - - commState.it = arrayIterator(dhtVers); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("dhtVers", dhtVers, GridCacheVersion.class)) + return false; - commState.idx++; + state++; case 26: - if (filterBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, filterBytes.length)) - return false; - - commState.it = arrayIterator(filterBytes); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeObjectArray("filterBytes", filterBytes, byte[].class)) + return false; - commState.idx++; + state++; case 27: - if (!commState.putBoolean("implicitSingleTx", implicitSingleTx)) + if (!writer.writeBoolean("hasTransforms", hasTransforms)) return false; - commState.idx++; + state++; case 28: - if (!commState.putBoolean("implicitTx", implicitTx)) + if (!writer.writeBoolean("implicitSingleTx", implicitSingleTx)) return false; - commState.idx++; + state++; case 29: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeBoolean("implicitTx", implicitTx)) return false; - commState.idx++; + state++; case 30: - if (!commState.putBoolean("onePhaseCommit", onePhaseCommit)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 31: - if (!commState.putBoolean("syncCommit", syncCommit)) + if (!writer.writeBoolean("onePhaseCommit", onePhaseCommit)) return false; - commState.idx++; + state++; case 32: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 33: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeBoolean("syncCommit", syncCommit)) return false; - commState.idx++; + state++; case 34: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 35: - if (!commState.putBoolean("hasTransforms", hasTransforms)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -499,151 +457,107 @@ public class GridNearLockRequest extends GridDistributedLockRequest /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 24: - accessTtl = commState.getLong("accessTtl"); + accessTtl = reader.readLong("accessTtl"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 25: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + dhtVers = reader.readObjectArray("dhtVers", GridCacheVersion.class); - if (commState.readSize >= 0) { - if (dhtVers == null) - dhtVers = new GridCacheVersion[commState.readSize]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - dhtVers[i] = (GridCacheVersion)_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 26: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + filterBytes = reader.readObjectArray("filterBytes", byte[].class); - if (commState.readSize >= 0) { - if (filterBytes == null) - filterBytes = new byte[commState.readSize][]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - filterBytes[i] = (byte[])_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 27: - implicitSingleTx = commState.getBoolean("implicitSingleTx"); + hasTransforms = reader.readBoolean("hasTransforms"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 28: - implicitTx = commState.getBoolean("implicitTx"); + implicitSingleTx = reader.readBoolean("implicitSingleTx"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 29: - miniId = commState.getGridUuid("miniId"); + implicitTx = reader.readBoolean("implicitTx"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 30: - onePhaseCommit = commState.getBoolean("onePhaseCommit"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 31: - syncCommit = commState.getBoolean("syncCommit"); + onePhaseCommit = reader.readBoolean("onePhaseCommit"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 32: - topVer = commState.getLong("topVer"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 33: - subjId = commState.getUuid("subjId"); + syncCommit = reader.readBoolean("syncCommit"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 34: - taskNameHash = commState.getInt("taskNameHash"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 35: - hasTransforms = commState.getBoolean("hasTransforms"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 9a62b02..2769f7a 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 @@ -206,111 +206,48 @@ public class GridNearLockResponse extends GridDistributedLockResponse extends GridDistributedLockResponse= 0) { - if (dhtVers == null) - dhtVers = new GridCacheVersion[commState.readSize]; + dhtVers = reader.readObjectArray("dhtVers", GridCacheVersion.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - dhtVers[i] = (GridCacheVersion)_val; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 12: - filterRes = commState.getBooleanArray("filterRes"); + filterRes = reader.readBooleanArray("filterRes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (mappedVers == null) - mappedVers = new GridCacheVersion[commState.readSize]; - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - mappedVers[i] = (GridCacheVersion)_val; + mappedVers = reader.readObjectArray("mappedVers", GridCacheVersion.class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 14: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 15: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (pending == null) - pending = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); + pending = reader.readCollection("pending", GridCacheVersion.class); - if (!commState.lastRead()) - return false; - - pending.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } 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 a462751..cfa797a 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 @@ -184,54 +184,54 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 21: - if (!commState.putBoolean("explicitLock", explicitLock)) + if (!writer.writeBoolean("explicitLock", explicitLock)) return false; - commState.idx++; + state++; case 22: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 23: - if (!commState.putBoolean("storeEnabled", storeEnabled)) + if (!writer.writeBoolean("storeEnabled", storeEnabled)) return false; - commState.idx++; + state++; case 24: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 25: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 26: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -241,59 +241,59 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishReques /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 21: - explicitLock = commState.getBoolean("explicitLock"); + explicitLock = reader.readBoolean("explicitLock"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 22: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 23: - storeEnabled = commState.getBoolean("storeEnabled"); + storeEnabled = reader.readBoolean("storeEnabled"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 24: - topVer = commState.getLong("topVer"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 25: - subjId = commState.getUuid("subjId"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 26: - taskNameHash = commState.getInt("taskNameHash"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 5532b88..5e19079 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 @@ -138,36 +138,36 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 5: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 6: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("nearThreadId", nearThreadId)) + if (!writer.writeLong("nearThreadId", nearThreadId)) return false; - commState.idx++; + state++; } @@ -177,35 +177,35 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishRespo /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 5: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - nearThreadId = commState.getLong("nearThreadId"); + nearThreadId = reader.readLong("nearThreadId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 1cd7ce0..9d5f73d 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 @@ -244,87 +244,66 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 22: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 23: - if (!commState.putBoolean("last", last)) + if (!writer.writeBoolean("last", last)) return false; - commState.idx++; + state++; case 24: - if (lastBackups != null) { - if (commState.it == null) { - if (!commState.putInt(null, lastBackups.size())) - return false; - - commState.it = lastBackups.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putUuid(null, (UUID)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("lastBackups", lastBackups, UUID.class)) + return false; - commState.idx++; + state++; case 25: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 26: - if (!commState.putBoolean("near", near)) + if (!writer.writeBoolean("near", near)) return false; - commState.idx++; + state++; case 27: - if (!commState.putLong("topVer", topVer)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 28: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeInt("taskNameHash", taskNameHash)) return false; - commState.idx++; + state++; case 29: - if (!commState.putInt("taskNameHash", taskNameHash)) + if (!writer.writeLong("topVer", topVer)) return false; - commState.idx++; + state++; } @@ -334,97 +313,75 @@ public class GridNearTxPrepareRequest extends GridDistributedTxPrepareRequ /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 22: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 23: - last = commState.getBoolean("last"); + last = reader.readBoolean("last"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 24: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + lastBackups = reader.readCollection("lastBackups", UUID.class); - if (commState.readSize >= 0) { - if (lastBackups == null) - lastBackups = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - lastBackups.add((UUID)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 25: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 26: - near = commState.getBoolean("near"); + near = reader.readBoolean("near"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 27: - topVer = commState.getLong("topVer"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 28: - subjId = commState.getUuid("subjId"); + taskNameHash = reader.readInt("taskNameHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 29: - taskNameHash = commState.getInt("taskNameHash"); + topVer = reader.readLong("topVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 f6e6975..8eb63b1 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 @@ -251,117 +251,54 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 10: - if (!commState.putCacheVersion("dhtVer", dhtVer)) + if (!writer.writeMessage("dhtVer", dhtVer != null ? dhtVer.clone() : null)) return false; - commState.idx++; + state++; case 11: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 12: - if (invalidParts != null) { - if (commState.it == null) { - if (!commState.putInt(null, invalidParts.size())) - return false; - - commState.it = invalidParts.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putInt(null, (int)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("invalidParts", invalidParts, int.class)) + return false; - commState.idx++; + state++; case 13: - if (!commState.putGridUuid("miniId", miniId)) + if (!writer.writeIgniteUuid("miniId", miniId)) return false; - commState.idx++; + state++; case 14: - if (ownedValsBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, ownedValsBytes.size())) - return false; - - commState.it = ownedValsBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("ownedValsBytes", ownedValsBytes, byte[].class)) + return false; - commState.idx++; + state++; case 15: - if (pending != null) { - if (commState.it == null) { - if (!commState.putInt(null, pending.size())) - return false; - - commState.it = pending.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("pending", pending, GridCacheVersion.class)) + return false; - commState.idx++; + state++; } @@ -371,125 +308,59 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareRes /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 10: - dhtVer = commState.getCacheVersion("dhtVer"); + dhtVer = reader.readMessage("dhtVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + invalidParts = reader.readCollection("invalidParts", int.class); - if (commState.readSize >= 0) { - if (invalidParts == null) - invalidParts = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - - invalidParts.add((Integer)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 13: - miniId = commState.getGridUuid("miniId"); + miniId = reader.readIgniteUuid("miniId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (ownedValsBytes == null) - ownedValsBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - ownedValsBytes.add((byte[])_val); + ownedValsBytes = reader.readCollection("ownedValsBytes", byte[].class); - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 15: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (pending == null) - pending = new ArrayList<>(commState.readSize); + pending = reader.readCollection("pending", GridCacheVersion.class); - for (int i = commState.readItems; i < commState.readSize; i++) { - GridCacheVersion _val = commState.getCacheVersion(null); - - if (!commState.lastRead()) - return false; - - pending.add((GridCacheVersion)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } 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 86f839b..267d798 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 @@ -65,16 +65,16 @@ public class GridNearUnlockRequest extends GridDistributedUnlockRequest extends GridDistributedUnlockRequest extends GridCacheMessage implemen /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (!commState.putBoolean("all", all)) + if (!writer.writeBoolean("all", all)) return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("argsBytes", argsBytes)) + if (!writer.writeByteArray("argsBytes", argsBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putString("cacheName", cacheName)) + if (!writer.writeString("cacheName", cacheName)) return false; - commState.idx++; + state++; case 6: - if (!commState.putBoolean("cancel", cancel)) + if (!writer.writeBoolean("cancel", cancel)) return false; - commState.idx++; + state++; case 7: - if (!commState.putString("clause", clause)) + if (!writer.writeString("clause", clause)) return false; - commState.idx++; + state++; case 8: - if (!commState.putString("clsName", clsName)) + if (!writer.writeString("clsName", clsName)) return false; - commState.idx++; + state++; case 9: - if (!commState.putBoolean("fields", fields)) + if (!writer.writeBoolean("fields", fields)) return false; - commState.idx++; + state++; case 10: - if (!commState.putLong("id", id)) + if (!writer.writeLong("id", id)) return false; - commState.idx++; + state++; case 11: - if (!commState.putBoolean("incBackups", incBackups)) + if (!writer.writeBoolean("incBackups", incBackups)) return false; - commState.idx++; + state++; case 12: - if (!commState.putBoolean("incMeta", incMeta)) + if (!writer.writeBoolean("incMeta", incMeta)) return false; - commState.idx++; + state++; case 13: - if (!commState.putByteArray("keyValFilterBytes", keyValFilterBytes)) + if (!writer.writeBoolean("keepPortable", keepPortable)) return false; - commState.idx++; + state++; case 14: - if (!commState.putInt("pageSize", pageSize)) + if (!writer.writeByteArray("keyValFilterBytes", keyValFilterBytes)) return false; - commState.idx++; + state++; case 15: - if (!commState.putByteArray("prjFilterBytes", prjFilterBytes)) + if (!writer.writeInt("pageSize", pageSize)) return false; - commState.idx++; + state++; case 16: - if (!commState.putByteArray("rdcBytes", rdcBytes)) + if (!writer.writeByteArray("prjFilterBytes", prjFilterBytes)) return false; - commState.idx++; + state++; case 17: - if (!commState.putByteArray("transBytes", transBytes)) + if (!writer.writeByteArray("rdcBytes", rdcBytes)) return false; - commState.idx++; + state++; case 18: - if (!commState.putEnum("type", type)) + if (!writer.writeUuid("subjId", subjId)) return false; - commState.idx++; + state++; case 19: - if (!commState.putBoolean("keepPortable", keepPortable)) + if (!writer.writeInt("taskHash", taskHash)) return false; - commState.idx++; + state++; case 20: - if (!commState.putUuid("subjId", subjId)) + if (!writer.writeByteArray("transBytes", transBytes)) return false; - commState.idx++; + state++; case 21: - if (!commState.putInt("taskHash", taskHash)) + if (!writer.writeEnum("type", type)) return false; - commState.idx++; + state++; } @@ -620,165 +620,163 @@ public class GridCacheQueryRequest extends GridCacheMessage implemen /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - all = commState.getBoolean("all"); + all = reader.readBoolean("all"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - argsBytes = commState.getByteArray("argsBytes"); + argsBytes = reader.readByteArray("argsBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - cacheName = commState.getString("cacheName"); + cacheName = reader.readString("cacheName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - cancel = commState.getBoolean("cancel"); + cancel = reader.readBoolean("cancel"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - clause = commState.getString("clause"); + clause = reader.readString("clause"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - clsName = commState.getString("clsName"); + clsName = reader.readString("clsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - fields = commState.getBoolean("fields"); + fields = reader.readBoolean("fields"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - id = commState.getLong("id"); + id = reader.readLong("id"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - incBackups = commState.getBoolean("incBackups"); + incBackups = reader.readBoolean("incBackups"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - incMeta = commState.getBoolean("incMeta"); + incMeta = reader.readBoolean("incMeta"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 13: - keyValFilterBytes = commState.getByteArray("keyValFilterBytes"); + keepPortable = reader.readBoolean("keepPortable"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 14: - pageSize = commState.getInt("pageSize"); + keyValFilterBytes = reader.readByteArray("keyValFilterBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 15: - prjFilterBytes = commState.getByteArray("prjFilterBytes"); + pageSize = reader.readInt("pageSize"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 16: - rdcBytes = commState.getByteArray("rdcBytes"); + prjFilterBytes = reader.readByteArray("prjFilterBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 17: - transBytes = commState.getByteArray("transBytes"); + rdcBytes = reader.readByteArray("rdcBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 18: - byte type0 = commState.getByte("type"); + subjId = reader.readUuid("subjId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - type = GridCacheQueryType.fromOrdinal(type0); - - commState.idx++; + state++; case 19: - keepPortable = commState.getBoolean("keepPortable"); + taskHash = reader.readInt("taskHash"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 20: - subjId = commState.getUuid("subjId"); + transBytes = reader.readByteArray("transBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 21: - taskHash = commState.getInt("taskHash"); + type = reader.readEnum("type", GridCacheQueryType.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 fe18c8c..acba6f6 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 @@ -231,96 +231,54 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 3: - if (dataBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, dataBytes.size())) - return false; - - commState.it = dataBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("dataBytes", dataBytes, byte[].class)) + return false; - commState.idx++; + state++; case 4: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 5: - if (!commState.putBoolean("fields", fields)) + if (!writer.writeBoolean("fields", fields)) return false; - commState.idx++; + state++; case 6: - if (!commState.putBoolean("finished", finished)) + if (!writer.writeBoolean("finished", finished)) return false; - commState.idx++; + state++; case 7: - if (metaDataBytes != null) { - if (commState.it == null) { - if (!commState.putInt(null, metaDataBytes.size())) - return false; - - commState.it = metaDataBytes.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putByteArray(null, (byte[])commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("metaDataBytes", metaDataBytes, byte[].class)) + return false; - commState.idx++; + state++; case 8: - if (!commState.putLong("reqId", reqId)) + if (!writer.writeLong("reqId", reqId)) return false; - commState.idx++; + state++; } @@ -330,103 +288,59 @@ public class GridCacheQueryResponse extends GridCacheMessage impleme /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 3: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + dataBytes = reader.readCollection("dataBytes", byte[].class); - if (commState.readSize >= 0) { - if (dataBytes == null) - dataBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - dataBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 4: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - fields = commState.getBoolean("fields"); + fields = reader.readBoolean("fields"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - finished = commState.getBoolean("finished"); + finished = reader.readBoolean("finished"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 7: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (metaDataBytes == null) - metaDataBytes = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; + metaDataBytes = reader.readCollection("metaDataBytes", byte[].class); - metaDataBytes.add((byte[])_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 8: - reqId = commState.getLong("reqId"); + reqId = reader.readLong("reqId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } 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 15e84ac..77fdf2d 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,12 +254,85 @@ public class GridCacheVersion extends MessageAdapter implements Comparable e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putLong(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("deltas", deltas, UUID.class, long.class)) + return false; - commState.idx++; + state++; case 1: - if (!commState.putClockDeltaVersion("snapVer", snapVer)) + if (!writer.writeMessage("snapVer", snapVer != null ? snapVer.clone() : null)) return false; - commState.idx++; + state++; } @@ -154,59 +122,24 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + deltas = reader.readMap("deltas", UUID.class, long.class); - if (commState.readSize >= 0) { - if (deltas == null) - deltas = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - long _val = commState.getLong(null); - - if (!commState.lastRead()) - return false; - - deltas.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 1: - snapVer = commState.getClockDeltaVersion("snapVer"); + snapVer = reader.readMessage("snapVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java index 852f9f0..06e8730 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java @@ -114,12 +114,57 @@ public class GridClockDeltaVersion extends MessageAdapter implements Comparable< /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - return false; // TODO: implement. + writer.setBuffer(buf); + + if (!typeWritten) { + if (!writer.writeByte(null, directType())) + return false; + + typeWritten = true; + } + + switch (state) { + case 0: + if (!writer.writeLong("topVer", topVer)) + return false; + + state++; + + case 1: + if (!writer.writeLong("ver", ver)) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - return false; // TODO: implement. + reader.setBuffer(buf); + + switch (state) { + case 0: + topVer = reader.readLong("topVer"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 1: + ver = reader.readLong("ver"); + + if (!reader.isLastRead()) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @@ -129,12 +174,19 @@ public class GridClockDeltaVersion extends MessageAdapter implements Comparable< /** {@inheritDoc} */ @Override public MessageAdapter clone() { - return null; // TODO: implement. + GridClockDeltaVersion _clone = new GridClockDeltaVersion(); + + clone0(_clone); + + return _clone; } /** {@inheritDoc} */ @Override protected void clone0(MessageAdapter _msg) { - // TODO: implement. + GridClockDeltaVersion _clone = (GridClockDeltaVersion)_msg; + + _clone.ver = ver; + _clone.topVer = topVer; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java index a6a62d7..e005a9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java @@ -154,39 +154,39 @@ public class GridContinuousMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("dataBytes", dataBytes)) + if (!writer.writeByteArray("dataBytes", dataBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putUuid("routineId", routineId)) + if (!writer.writeUuid("routineId", routineId)) return false; - commState.idx++; + state++; case 3: - if (!commState.putEnum("type", type)) + if (!writer.writeEnum("type", type)) return false; - commState.idx++; + state++; } @@ -196,42 +196,40 @@ public class GridContinuousMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - dataBytes = commState.getByteArray("dataBytes"); + dataBytes = reader.readByteArray("dataBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - routineId = commState.getUuid("routineId"); + routineId = reader.readUuid("routineId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - byte type0 = commState.getByte("type"); + type = reader.readEnum("type", GridContinuousMessageType.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - type = GridContinuousMessageType.fromOrdinal(type0); - - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java index 4690f82..15721f9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java @@ -224,125 +224,93 @@ public class GridDataLoadRequest extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putString("cacheName", cacheName)) + if (!writer.writeString("cacheName", cacheName)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putByteArray("colBytes", colBytes)) + if (!writer.writeByteArray("colBytes", colBytes)) return false; - commState.idx++; + state++; case 3: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 4: - if (!commState.putBoolean("forceLocDep", forceLocDep)) + if (!writer.writeBoolean("forceLocDep", forceLocDep)) return false; - commState.idx++; + state++; case 5: - if (!commState.putBoolean("ignoreDepOwnership", ignoreDepOwnership)) + if (!writer.writeBoolean("ignoreDepOwnership", ignoreDepOwnership)) return false; - commState.idx++; + state++; case 6: - if (ldrParticipants != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParticipants.size())) - return false; - - commState.it = ldrParticipants.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("ldrParticipants", ldrParticipants, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 7: - if (!commState.putLong("reqId", reqId)) + if (!writer.writeLong("reqId", reqId)) return false; - commState.idx++; + state++; case 8: - if (!commState.putByteArray("resTopicBytes", resTopicBytes)) + if (!writer.writeByteArray("resTopicBytes", resTopicBytes)) return false; - commState.idx++; + state++; case 9: - if (!commState.putString("sampleClsName", sampleClsName)) + if (!writer.writeString("sampleClsName", sampleClsName)) return false; - commState.idx++; + state++; case 10: - if (!commState.putBoolean("skipStore", skipStore)) + if (!writer.writeBoolean("skipStore", skipStore)) return false; - commState.idx++; + state++; case 11: - if (!commState.putByteArray("updaterBytes", updaterBytes)) + if (!writer.writeByteArray("updaterBytes", updaterBytes)) return false; - commState.idx++; + state++; case 12: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -351,149 +319,112 @@ public class GridDataLoadRequest extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - cacheName = commState.getString("cacheName"); + cacheName = reader.readString("cacheName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - colBytes = commState.getByteArray("colBytes"); + colBytes = reader.readByteArray("colBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 4: - forceLocDep = commState.getBoolean("forceLocDep"); + forceLocDep = reader.readBoolean("forceLocDep"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 5: - ignoreDepOwnership = commState.getBoolean("ignoreDepOwnership"); + ignoreDepOwnership = reader.readBoolean("ignoreDepOwnership"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + ldrParticipants = reader.readMap("ldrParticipants", UUID.class, IgniteUuid.class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (ldrParticipants == null) - ldrParticipants = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParticipants.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 7: - reqId = commState.getLong("reqId"); + reqId = reader.readLong("reqId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 8: - resTopicBytes = commState.getByteArray("resTopicBytes"); + resTopicBytes = reader.readByteArray("resTopicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 9: - sampleClsName = commState.getString("sampleClsName"); + sampleClsName = reader.readString("sampleClsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 10: - skipStore = commState.getBoolean("skipStore"); + skipStore = reader.readBoolean("skipStore"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 11: - updaterBytes = commState.getByteArray("updaterBytes"); + updaterBytes = reader.readByteArray("updaterBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 12: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java index 2b8c0ee..8676e7e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java @@ -104,33 +104,33 @@ public class GridDataLoadResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("forceLocDep", forceLocDep)) + if (!writer.writeBoolean("forceLocDep", forceLocDep)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong("reqId", reqId)) + if (!writer.writeLong("reqId", reqId)) return false; - commState.idx++; + state++; } @@ -140,32 +140,32 @@ public class GridDataLoadResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - forceLocDep = commState.getBoolean("forceLocDep"); + forceLocDep = reader.readBoolean("forceLocDep"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - reqId = commState.getLong("reqId"); + reqId = reader.readLong("reqId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java index 496a114..6bbb8e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java @@ -127,36 +127,36 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("fileId", fileId)) + if (!writer.writeIgniteUuid("fileId", fileId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong("id", id)) + if (!writer.writeLong("id", id)) return false; - commState.idx++; + state++; } @@ -166,35 +166,35 @@ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - fileId = commState.getGridUuid("fileId"); + fileId = reader.readIgniteUuid("fileId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - id = commState.getLong("id"); + id = reader.readLong("id"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java index bbcbf42..6fc3776 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java @@ -181,39 +181,39 @@ public final class GridGgfsBlockKey extends MessageAdapter /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("affKey", affKey)) + if (!writer.writeIgniteUuid("affKey", affKey)) return false; - commState.idx++; + state++; case 1: - if (!commState.putLong("blockId", blockId)) + if (!writer.writeLong("blockId", blockId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putBoolean("evictExclude", evictExclude)) + if (!writer.writeBoolean("evictExclude", evictExclude)) return false; - commState.idx++; + state++; case 3: - if (!commState.putGridUuid("fileId", fileId)) + if (!writer.writeIgniteUuid("fileId", fileId)) return false; - commState.idx++; + state++; } @@ -223,40 +223,40 @@ public final class GridGgfsBlockKey extends MessageAdapter /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - affKey = commState.getGridUuid("affKey"); + affKey = reader.readIgniteUuid("affKey"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - blockId = commState.getLong("blockId"); + blockId = reader.readLong("blockId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - evictExclude = commState.getBoolean("evictExclude"); + evictExclude = reader.readBoolean("evictExclude"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - fileId = commState.getGridUuid("fileId"); + fileId = reader.readIgniteUuid("fileId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java index 6321042..7740066 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java @@ -107,68 +107,36 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (blocks != null) { - if (commState.it == null) { - if (!commState.putInt(null, blocks.size())) - return false; - - commState.it = blocks.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putMessage(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putByteArray(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("blocks", blocks, GridGgfsBlockKey.class, byte[].class)) + return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("fileId", fileId)) + if (!writer.writeIgniteUuid("fileId", fileId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong("id", id)) + if (!writer.writeLong("id", id)) return false; - commState.idx++; + state++; } @@ -178,70 +146,35 @@ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + blocks = reader.readMap("blocks", GridGgfsBlockKey.class, byte[].class); - if (commState.readSize >= 0) { - if (blocks == null) - blocks = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - GridGgfsBlockKey _val = (GridGgfsBlockKey)commState.getMessage(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - byte[] _val = commState.getByteArray(null); - - if (!commState.lastRead()) - return false; - - blocks.put((GridGgfsBlockKey)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 1: - fileId = commState.getGridUuid("fileId"); + fileId = reader.readIgniteUuid("fileId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - id = commState.getLong("id"); + id = reader.readLong("id"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java index b08d64a..860eb4c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java @@ -54,13 +54,13 @@ public abstract class GridGgfsCommunicationMessage extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } return true; @@ -68,7 +68,7 @@ public abstract class GridGgfsCommunicationMessage extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); return true; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java index 6be821a..18ae5b5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java @@ -130,30 +130,30 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("id", id)) + if (!writer.writeIgniteUuid("id", id)) return false; - commState.idx++; + state++; } @@ -163,27 +163,27 @@ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - id = commState.getGridUuid("id"); + id = reader.readIgniteUuid("id"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java index 04c822e..edd9d6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java @@ -286,45 +286,45 @@ public class GridGgfsFileAffinityRange extends MessageAdapter implements Externa /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("affKey", affKey)) + if (!writer.writeIgniteUuid("affKey", affKey)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("done", done)) + if (!writer.writeBoolean("done", done)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong("endOff", endOff)) + if (!writer.writeLong("endOff", endOff)) return false; - commState.idx++; + state++; case 3: - if (!commState.putLong("startOff", startOff)) + if (!writer.writeLong("startOff", startOff)) return false; - commState.idx++; + state++; case 4: - if (!commState.putInt("status", status)) + if (!writer.writeInt("status", status)) return false; - commState.idx++; + state++; } @@ -334,48 +334,48 @@ public class GridGgfsFileAffinityRange extends MessageAdapter implements Externa /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - affKey = commState.getGridUuid("affKey"); + affKey = reader.readIgniteUuid("affKey"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - done = commState.getBoolean("done"); + done = reader.readBoolean("done"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - endOff = commState.getLong("endOff"); + endOff = reader.readLong("endOff"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - startOff = commState.getLong("startOff"); + startOff = reader.readLong("startOff"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - status = commState.getInt("status"); + status = reader.readInt("status"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java index 3ecac2f..978a2d6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java @@ -101,51 +101,30 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("fileId", fileId)) + if (!writer.writeIgniteUuid("fileId", fileId)) return false; - commState.idx++; + state++; case 1: - if (fragmentRanges != null) { - if (commState.it == null) { - if (!commState.putInt(null, fragmentRanges.size())) - return false; - - commState.it = fragmentRanges.iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - if (!commState.putMessage(null, (GridGgfsFileAffinityRange)commState.cur)) - return false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeCollection("fragmentRanges", fragmentRanges, GridGgfsFileAffinityRange.class)) + return false; - commState.idx++; + state++; } @@ -155,49 +134,27 @@ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - fileId = commState.getGridUuid("fileId"); + fileId = reader.readIgniteUuid("fileId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - if (commState.readSize == -1) { - int _val = commState.getInt(null); - - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } + fragmentRanges = reader.readCollection("fragmentRanges", GridGgfsFileAffinityRange.class); - if (commState.readSize >= 0) { - if (fragmentRanges == null) - fragmentRanges = new ArrayList<>(commState.readSize); - - for (int i = commState.readItems; i < commState.readSize; i++) { - GridGgfsFileAffinityRange _val = (GridGgfsFileAffinityRange)commState.getMessage(null); - - if (!commState.lastRead()) - return false; - - fragmentRanges.add((GridGgfsFileAffinityRange)_val); - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java index a842e9c..5a90b3c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java @@ -76,24 +76,24 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("fileId", fileId)) + if (!writer.writeIgniteUuid("fileId", fileId)) return false; - commState.idx++; + state++; } @@ -103,19 +103,19 @@ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - fileId = commState.getGridUuid("fileId"); + fileId = reader.readIgniteUuid("fileId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java index a632e02..c7c1e77 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java @@ -94,30 +94,30 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); if (!super.writeTo(buf)) return false; - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putLong("order", order)) + if (!writer.writeLong("order", order)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("res", res)) + if (!writer.writeBoolean("res", res)) return false; - commState.idx++; + state++; } @@ -127,27 +127,27 @@ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); if (!super.readFrom(buf)) return false; - switch (commState.idx) { + switch (state) { case 0: - order = commState.getLong("order"); + order = reader.readLong("order"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - res = commState.getBoolean("res"); + res = reader.readBoolean("res"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java index 6223639..71dfcf9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java @@ -65,13 +65,13 @@ public class GridClientHandshakeRequestWrapper extends MessageAdapter { @Override public boolean writeTo(ByteBuffer buf) { stream.setBuffer(buf); - if (!commState.typeWritten) { + if (!typeWritten) { if (!buf.hasRemaining()) return false; stream.writeByte(directType()); - commState.typeWritten = true; + typeWritten = true; } stream.writeByteArray(bytes, 0, bytes.length); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java index 57f2bd1..e598f66 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java @@ -48,13 +48,13 @@ public class GridClientHandshakeResponseWrapper extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } return true; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java index 4d40c3e..746a40f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java @@ -136,23 +136,23 @@ public class GridClientMessageWrapper extends MessageAdapter { @Override public boolean writeTo(ByteBuffer buf) { stream.setBuffer(buf); - if (!commState.typeWritten) { + if (!typeWritten) { if (stream.remaining() < 1) return false; stream.writeByte(directType()); - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: if (stream.remaining() < 4) return false; stream.writeInt(msgSize); - commState.idx++; + state++; case 1: if (stream.remaining() < 8) @@ -160,7 +160,7 @@ public class GridClientMessageWrapper extends MessageAdapter { stream.writeLong(reqId); - commState.idx++; + state++; case 2: if (stream.remaining() < 16) @@ -168,7 +168,7 @@ public class GridClientMessageWrapper extends MessageAdapter { stream.writeByteArray(U.uuidToBytes(clientId), 0, 16); - commState.idx++; + state++; case 3: if (stream.remaining() < 16) @@ -176,12 +176,12 @@ public class GridClientMessageWrapper extends MessageAdapter { stream.writeByteArray(U.uuidToBytes(destId), 0, 16); - commState.idx++; + state++; case 4: stream.writeByteArray(msg.array(), msg.position(), msg.remaining()); - commState.idx++; + state++; } @@ -192,7 +192,7 @@ public class GridClientMessageWrapper extends MessageAdapter { @Override public boolean readFrom(ByteBuffer buf) { stream.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: if (stream.remaining() < 4) return false; @@ -202,7 +202,7 @@ public class GridClientMessageWrapper extends MessageAdapter { if (msgSize == 0) // Ping message. return true; - commState.idx++; + state++; case 1: if (stream.remaining() < 8) @@ -210,7 +210,7 @@ public class GridClientMessageWrapper extends MessageAdapter { reqId = stream.readLong(); - commState.idx++; + state++; case 2: if (stream.remaining() < 16) @@ -218,7 +218,7 @@ public class GridClientMessageWrapper extends MessageAdapter { clientId = U.bytesToUuid(stream.readByteArray(16), 0); - commState.idx++; + state++; case 3: if (stream.remaining() < 16) @@ -226,7 +226,7 @@ public class GridClientMessageWrapper extends MessageAdapter { destId = U.bytesToUuid(stream.readByteArray(16), 0); - commState.idx++; + state++; case 4: byte[] msg0 = stream.readByteArray(msgSize); @@ -236,7 +236,7 @@ public class GridClientMessageWrapper extends MessageAdapter { msg = ByteBuffer.wrap(msg0); - commState.idx++; + state++; } return true; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java index be95367..ca8e804 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java @@ -34,21 +34,21 @@ public class GridClientPingPacketWrapper extends MessageAdapter { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putInt("size", size)) + if (!writer.writeInt("size", size)) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java index 8df3008..637fa80 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java @@ -120,27 +120,27 @@ public class GridTaskResultRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("taskId", taskId)) + if (!writer.writeIgniteUuid("taskId", taskId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putByteArray("topicBytes", topicBytes)) + if (!writer.writeByteArray("topicBytes", topicBytes)) return false; - commState.idx++; + state++; } @@ -150,24 +150,24 @@ public class GridTaskResultRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - taskId = commState.getGridUuid("taskId"); + taskId = reader.readIgniteUuid("taskId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - topicBytes = commState.getByteArray("topicBytes"); + topicBytes = reader.readByteArray("topicBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java index 6808f1a..384cfb3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java @@ -140,39 +140,39 @@ public class GridTaskResultResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putString("err", err)) + if (!writer.writeString("err", err)) return false; - commState.idx++; + state++; case 1: - if (!commState.putBoolean("finished", finished)) + if (!writer.writeBoolean("finished", finished)) return false; - commState.idx++; + state++; case 2: - if (!commState.putBoolean("found", found)) + if (!writer.writeBoolean("found", found)) return false; - commState.idx++; + state++; case 3: - if (!commState.putByteArray("resBytes", resBytes)) + if (!writer.writeByteArray("resBytes", resBytes)) return false; - commState.idx++; + state++; } @@ -182,40 +182,40 @@ public class GridTaskResultResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - err = commState.getString("err"); + err = reader.readString("err"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - finished = commState.getBoolean("finished"); + finished = reader.readBoolean("finished"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - found = commState.getBoolean("found"); + found = reader.readBoolean("found"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 3: - resBytes = commState.getByteArray("resBytes"); + resBytes = reader.readByteArray("resBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java index ae0d638..d086efe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java @@ -69,13 +69,13 @@ public class GridMemcachedMessageWrapper extends MessageAdapter { @Override public boolean writeTo(ByteBuffer buf) { stream.setBuffer(buf); - if (!commState.typeWritten) { + if (!typeWritten) { if (!buf.hasRemaining()) return false; stream.writeByte(directType()); - commState.typeWritten = true; + typeWritten = true; } stream.writeByteArray(bytes, 0, bytes.length); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java index aba17f3..4f67c3a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java @@ -74,21 +74,21 @@ public class GridStreamerCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putGridUuid("cancelledFutId", cancelledFutId)) + if (!writer.writeIgniteUuid("cancelledFutId", cancelledFutId)) return false; - commState.idx++; + state++; } @@ -98,16 +98,16 @@ public class GridStreamerCancelRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - cancelledFutId = commState.getGridUuid("cancelledFutId"); + cancelledFutId = reader.readIgniteUuid("cancelledFutId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java index e10ef04..90e7163 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java @@ -175,89 +175,57 @@ public class GridStreamerExecutionRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("batchBytes", batchBytes)) + if (!writer.writeByteArray("batchBytes", batchBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("clsLdrId", clsLdrId)) + if (!writer.writeIgniteUuid("clsLdrId", clsLdrId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putEnum("depMode", depMode)) + if (!writer.writeEnum("depMode", depMode)) return false; - commState.idx++; + state++; case 3: - if (!commState.putBoolean("forceLocDep", forceLocDep)) + if (!writer.writeBoolean("forceLocDep", forceLocDep)) return false; - commState.idx++; + state++; case 4: - if (ldrParticipants != null) { - if (commState.it == null) { - if (!commState.putInt(null, ldrParticipants.size())) - return false; - - commState.it = ldrParticipants.entrySet().iterator(); - } - - while (commState.it.hasNext() || commState.cur != NULL) { - if (commState.cur == NULL) - commState.cur = commState.it.next(); - - Map.Entry e = (Map.Entry)commState.cur; - - if (!commState.keyDone) { - if (!commState.putUuid(null, e.getKey())) - return false; - - commState.keyDone = true; - } - - if (!commState.putGridUuid(null, e.getValue())) - return false; - - commState.keyDone = false; - - commState.cur = NULL; - } - - commState.it = null; - } else { - if (!commState.putInt(null, -1)) - return false; - } + if (!writer.writeMap("ldrParticipants", ldrParticipants, UUID.class, IgniteUuid.class)) + return false; - commState.idx++; + state++; case 5: - if (!commState.putString("sampleClsName", sampleClsName)) + if (!writer.writeString("sampleClsName", sampleClsName)) return false; - commState.idx++; + state++; case 6: - if (!commState.putString("userVer", userVer)) + if (!writer.writeString("userVer", userVer)) return false; - commState.idx++; + state++; } @@ -267,101 +235,64 @@ public class GridStreamerExecutionRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - batchBytes = commState.getByteArray("batchBytes"); + batchBytes = reader.readByteArray("batchBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - clsLdrId = commState.getGridUuid("clsLdrId"); + clsLdrId = reader.readIgniteUuid("clsLdrId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 2: - byte depMode0 = commState.getByte("depMode"); + depMode = reader.readEnum("depMode", DeploymentMode.class); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - depMode = DeploymentMode.fromOrdinal(depMode0); - - commState.idx++; + state++; case 3: - forceLocDep = commState.getBoolean("forceLocDep"); + forceLocDep = reader.readBoolean("forceLocDep"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 4: - if (commState.readSize == -1) { - int _val = commState.getInt(null); + ldrParticipants = reader.readMap("ldrParticipants", UUID.class, IgniteUuid.class); - if (!commState.lastRead()) - return false; - commState.readSize = _val; - } - - if (commState.readSize >= 0) { - if (ldrParticipants == null) - ldrParticipants = new HashMap<>(commState.readSize, 1.0f); - - for (int i = commState.readItems; i < commState.readSize; i++) { - if (!commState.keyDone) { - UUID _val = commState.getUuid(null); - - if (!commState.lastRead()) - return false; - - commState.cur = _val; - commState.keyDone = true; - } - - IgniteUuid _val = commState.getGridUuid(null); - - if (!commState.lastRead()) - return false; - - ldrParticipants.put((UUID)commState.cur, _val); - - commState.keyDone = false; - - commState.readItems++; - } - } - - commState.readSize = -1; - commState.readItems = 0; - commState.cur = null; + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 5: - sampleClsName = commState.getString("sampleClsName"); + sampleClsName = reader.readString("sampleClsName"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 6: - userVer = commState.getString("userVer"); + userVer = reader.readString("userVer"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java index a9c05c5..fc6da7f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java @@ -95,27 +95,27 @@ public class GridStreamerResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putByteArray("errBytes", errBytes)) + if (!writer.writeByteArray("errBytes", errBytes)) return false; - commState.idx++; + state++; case 1: - if (!commState.putGridUuid("futId", futId)) + if (!writer.writeIgniteUuid("futId", futId)) return false; - commState.idx++; + state++; } @@ -125,24 +125,24 @@ public class GridStreamerResponse extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - errBytes = commState.getByteArray("errBytes"); + errBytes = reader.readByteArray("errBytes"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - futId = commState.getGridUuid("futId"); + futId = reader.readIgniteUuid("futId"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java deleted file mode 100644 index 9895f43..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/version/GridVersionConverter.java +++ /dev/null @@ -1,46 +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.version; - -import org.apache.ignite.internal.direct.*; - -import java.nio.*; - -/** - * Version converter. - */ -public abstract class GridVersionConverter { - /** State. */ - protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); - - /** - * Writes delta between two versions. - * - * @param buf Buffer to write to. - * @return Whether delta was fully written. - */ - public abstract boolean writeTo(ByteBuffer buf); - - /** - * Reads delta between two versions. - * - * @param buf Buffer to read from. - * @return Whether delta was fully read. - */ - public abstract boolean readFrom(ByteBuffer buf); -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java index 9cff49c..8ec78d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java @@ -408,12 +408,57 @@ public class GridByteArrayList extends MessageAdapter implements Externalizable /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - return false; // TODO: implement. + writer.setBuffer(buf); + + if (!typeWritten) { + if (!writer.writeByte(null, directType())) + return false; + + typeWritten = true; + } + + switch (state) { + case 0: + if (!writer.writeByteArray("data", data)) + return false; + + state++; + + case 1: + if (!writer.writeInt("size", size)) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - return false; // TODO: implement. + reader.setBuffer(buf); + + switch (state) { + case 0: + data = reader.readByteArray("data"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 1: + size = reader.readInt("size"); + + if (!reader.isLastRead()) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @@ -423,12 +468,19 @@ public class GridByteArrayList extends MessageAdapter implements Externalizable /** {@inheritDoc} */ @Override public MessageAdapter clone() { - return null; // TODO: implement. + GridByteArrayList _clone = new GridByteArrayList(); + + clone0(_clone); + + return _clone; } /** {@inheritDoc} */ @Override protected void clone0(MessageAdapter _msg) { - // TODO: implement. + GridByteArrayList _clone = (GridByteArrayList)_msg; + + _clone.data = data; + _clone.size = size; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java index 2525467..5dce4e9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java @@ -506,12 +506,57 @@ public class GridLongList extends MessageAdapter implements Externalizable { /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - return false; // TODO: implement. + writer.setBuffer(buf); + + if (!typeWritten) { + if (!writer.writeByte(null, directType())) + return false; + + typeWritten = true; + } + + switch (state) { + case 0: + if (!writer.writeLongArray("arr", arr)) + return false; + + state++; + + case 1: + if (!writer.writeInt("idx", idx)) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @Override public boolean readFrom(ByteBuffer buf) { - return false; // TODO: implement. + reader.setBuffer(buf); + + switch (state) { + case 0: + arr = reader.readLongArray("arr"); + + if (!reader.isLastRead()) + return false; + + state++; + + case 1: + idx = reader.readInt("idx"); + + if (!reader.isLastRead()) + return false; + + state++; + + } + + return true; } /** {@inheritDoc} */ @@ -521,11 +566,18 @@ public class GridLongList extends MessageAdapter implements Externalizable { /** {@inheritDoc} */ @Override public MessageAdapter clone() { - return null; // TODO: implement. + GridLongList _clone = new GridLongList(); + + clone0(_clone); + + return _clone; } /** {@inheritDoc} */ @Override protected void clone0(MessageAdapter _msg) { - // TODO: implement. + GridLongList _clone = (GridLongList)_msg; + + _clone.arr = arr; + _clone.idx = idx; } } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java index 2234698..d393e16 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java @@ -17,24 +17,13 @@ package org.apache.ignite.plugin.extensions.communication; -import org.apache.ignite.internal.direct.*; - import java.io.*; import java.nio.*; -import java.util.*; /** * Communication message adapter. */ public abstract class MessageAdapter implements Serializable, Cloneable { - /** */ - // TODO: remove - protected static final Object NULL = new Object(); - - /** */ - // TODO: remove - protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState(); - /** Writer. */ protected MessageWriter writer; @@ -64,17 +53,6 @@ public abstract class MessageAdapter implements Serializable, Cloneable { } /** - * @param buf Buffer. - */ - public final void setBuffer(ByteBuffer buf) { - if (writer != null) - writer.setBuffer(buf); - - if (reader != null) - reader.setBuffer(buf); - } - - /** * @param buf Byte buffer. * @return Whether message was fully written. */ @@ -108,29 +86,4 @@ public abstract class MessageAdapter implements Serializable, Cloneable { public boolean skipRecovery() { return false; } - - /** - * @param arr Array. - * @return Array iterator. - */ - protected final Iterator arrayIterator(final Object[] arr) { - return new Iterator() { - private int idx; - - @Override public boolean hasNext() { - return idx < arr.length; - } - - @Override public Object next() { - if (!hasNext()) - throw new NoSuchElementException(); - - return arr[idx++]; - } - - @Override public void remove() { - throw new UnsupportedOperationException(); - } - }; - } } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java index eca6afb..db4d856 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java @@ -68,7 +68,7 @@ public interface MessageReader { public , T> C readCollection(String name, Class itemCls); - public Map readMap(String name, Class keyCls, Class valCls); + public , K, V> M readMap(String name, Class keyCls, Class valCls); public boolean isLastRead(); } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java index d468c28..9a3a0f0 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java @@ -74,21 +74,21 @@ public class JobStealingRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putInt("delta", delta)) + if (!writer.writeInt("delta", delta)) return false; - commState.idx++; + state++; } @@ -98,16 +98,16 @@ public class JobStealingRequest extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("all") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - delta = commState.getInt("delta"); + delta = reader.readInt("delta"); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java index ce1d765..d99cdfd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java @@ -156,9 +156,9 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - return commState.putByte(null, directType()); + return writer.writeByte(null, directType()); } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index e1244a0..9089e7c 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -116,39 +116,39 @@ public class GridTestMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean writeTo(ByteBuffer buf) { - commState.setBuffer(buf); + writer.setBuffer(buf); - if (!commState.typeWritten) { - if (!commState.putByte(null, directType())) + if (!typeWritten) { + if (!writer.writeByte(null, directType())) return false; - commState.typeWritten = true; + typeWritten = true; } - switch (commState.idx) { + switch (state) { case 0: - if (!commState.putUuid(null, srcNodeId)) + if (!writer.writeUuid(null, srcNodeId)) return false; - commState.idx++; + state++; case 1: - if (!commState.putLong(null, msgId)) + if (!writer.writeLong(null, msgId)) return false; - commState.idx++; + state++; case 2: - if (!commState.putLong(null, resId)) + if (!writer.writeLong(null, resId)) return false; - commState.idx++; + state++; case 3: - if (!commState.putByteArray(null, payload)) + if (!writer.writeByteArray(null, payload)) return false; - commState.idx++; + state++; } return true; @@ -157,40 +157,40 @@ public class GridTestMessage extends MessageAdapter { /** {@inheritDoc} */ @SuppressWarnings("fallthrough") @Override public boolean readFrom(ByteBuffer buf) { - commState.setBuffer(buf); + reader.setBuffer(buf); - switch (commState.idx) { + switch (state) { case 0: - srcNodeId = commState.getUuid(null); + srcNodeId = reader.readUuid(null); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; case 1: - if (buf.remaining() < 8) - return false; + msgId = reader.readLong(null); - msgId = commState.getLong(null); + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 2: - if (buf.remaining() < 8) - return false; + resId = reader.readLong(null); - resId = commState.getLong(null); + if (!reader.isLastRead()) + return false; - commState.idx++; + state++; case 3: - payload = commState.getByteArray(null); + payload = reader.readByteArray(null); - if (!commState.lastRead()) + if (!reader.isLastRead()) return false; - commState.idx++; + state++; } return true; -- 1.9.3 (Apple Git-50) From 01b20a695ce7b5207888bf2dca998942d4224440 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 23:07:34 -0800 Subject: [PATCH 38/71] IGNITE-61 - Direct marshalling --- .../codegen/CommunicationMessageCodeGenerator.java | 21 +- .../apache/ignite/internal/direct/DirectUtils.java | 346 --------------------- .../managers/communication/GridIoMessage.java | 4 +- 3 files changed, 20 insertions(+), 351 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 45a383c..4a81a92 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -10,6 +10,7 @@ package org.apache.ignite.codegen; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; @@ -76,6 +77,9 @@ public class CommunicationMessageCodeGenerator { private final Map, Integer> fieldCnt = new HashMap<>(); /** */ + private Class curCls; + + /** */ private List fields; /** */ @@ -233,6 +237,8 @@ public class CommunicationMessageCodeGenerator { public void generate(Class cls) throws Exception { assert cls != null; + curCls = cls; + write.clear(); read.clear(); clone.clear(); @@ -282,8 +288,14 @@ public class CommunicationMessageCodeGenerator { for (Field field : cloningFields) { String name = field.getName(); + Class type = field.getType(); + + String res = name; - clone0.add(builder().a("_clone.").a(name).a(" = ").a(name).a(";").toString()); + if (curCls.equals(GridIoMessage.class) && BASE_CLS.isAssignableFrom(type)) + res = name + " != null ? (" + type.getSimpleName() + ")" + name + ".clone() : null"; + + clone0.add(builder().a("_clone.").a(name).a(" = ").a(res).a(";").toString()); } } @@ -515,8 +527,11 @@ public class CommunicationMessageCodeGenerator { returnFalseIfFailed(write, "writer.writeIgniteUuid", field, name); else if (type.isEnum()) returnFalseIfFailed(write, "writer.writeEnum", field, name); - else if (BASE_CLS.isAssignableFrom(type)) - returnFalseIfFailed(write, "writer.writeMessage", field, name + " != null ? " + name + ".clone() : null"); + else if (BASE_CLS.isAssignableFrom(type)) { + String arg = curCls.equals(GridIoMessage.class) ? name : name + " != null ? " + name + ".clone() : null"; + + returnFalseIfFailed(write, "writer.writeMessage", field, arg); + } else if (type.isArray()) { returnFalseIfFailed(write, "writer.writeObjectArray", field, name, type.getComponentType().getSimpleName() + ".class"); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java deleted file mode 100644 index d0d966f..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectUtils.java +++ /dev/null @@ -1,346 +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.direct; - -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.processors.clock.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import sun.misc.*; - -import java.util.*; - -/** - * Direct marshalling utility methods. - */ -public class DirectUtils { - /** */ - private static final Unsafe UNSAFE = GridUnsafe.unsafe(); - - /** */ - private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class); - - /** - * Do not instantiate. - */ - private DirectUtils() { - // No-op. - } - - /** - * @param uuid {@link UUID}. - * @return Array. - */ - public static byte[] uuidToArray(UUID uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits()); - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link UUID}. - */ - public static UUID arrayToUuid(byte[] arr) { - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new UUID(most, least); - } - } - - /** - * @param uuid {@link IgniteUuid}. - * @return Array. - */ - public static byte[] gridUuidToArray(IgniteUuid uuid) { - byte[] arr = null; - - if (uuid != null) { - arr = new byte[24]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId()); - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link IgniteUuid}. - */ - public static IgniteUuid arrayToIgniteUuid(byte[] arr) { - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new IgniteUuid(new UUID(most, least), loc); - } - } - - /** - * @param ver {@link GridClockDeltaVersion}. - * @return Array. - */ - public static byte[] clockDeltaVersionToArray(GridClockDeltaVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[16]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion()); - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link GridClockDeltaVersion}. - */ - public static GridClockDeltaVersion arrayToClockDeltaVersion(byte[] arr) { - if (arr == null) - return null; - else { - long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - - return new GridClockDeltaVersion(ver, topVer); - } - } - - /** - * @param list {@link GridByteArrayList}. - * @return Array. - */ - public static byte[] byteArrayListToArray(GridByteArrayList list) { - return list != null ? list.array() : null; - } - - /** - * @param arr Array. - * @return {@link GridByteArrayList}. - */ - public static GridByteArrayList arrayToByteArrayList(byte[] arr) { - return arr != null ? new GridByteArrayList(arr) : null; - } - - /** - * @param list {@link GridLongList}. - * @return Array. - */ - public static long[] longListToArray(GridLongList list) { - return list != null ? list.array() : null; - } - - /** - * @param arr Array. - * @return {@link GridLongList}. - */ - public static GridLongList arrayToLongList(long[] arr) { - return arr != null ? new GridLongList(arr) : null; - } - - /** - * @param ver {@link GridCacheVersion}. - * @return Array. - */ - public static byte[] cacheVersionToArray(GridCacheVersion ver) { - byte[] arr = null; - - if (ver != null) { - arr = new byte[24]; - - UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order()); - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link GridCacheVersion}. - */ - public static GridCacheVersion arrayToCacheVersion(byte[] arr) { - if (arr == null) - return null; - else { - int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF); - int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4); - long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16); - - return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order); - } - } - - /** - * @param id {@link GridDhtPartitionExchangeId}. - * @return Array. - */ - public static byte[] dhtPartitionExchangeIdToArray(GridDhtPartitionExchangeId id) { - byte[] arr = null; - - if (id != null) { - arr = new byte[28]; - - UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits()); - UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event()); - UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion()); - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link GridDhtPartitionExchangeId}. - */ - public static GridDhtPartitionExchangeId arrayToDhtPartitionExchangeId(byte[] arr) { - if (arr == null) - return null; - else { - long most = UNSAFE.getLong(arr, BYTE_ARR_OFF); - long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8); - int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16); - long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20); - - return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer); - } - } - - /** - * @param bytes {@link GridCacheValueBytes}. - * @return Array. - */ - public static byte[] valueBytesToArray(GridCacheValueBytes bytes) { - byte[] arr = null; - - if (bytes != null) { - byte[] bytes0 = bytes.get(); - - if (bytes0 != null) { - int len = bytes0.length; - - arr = new byte[len + 2]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true); - UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len); - UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain()); - } - else { - arr = new byte[1]; - - UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false); - } - } - - return arr; - } - - /** - * @param arr Array. - * @return {@link GridCacheValueBytes}. - */ - public static GridCacheValueBytes arrayToValueBytes(byte[] arr) { - if (arr == null) - return null; - else { - boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF); - - if (notNull) { - int len = arr.length - 2; - - assert len >= 0 : len; - - byte[] bytesArr = new byte[len]; - - UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len); - - boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len); - - return new GridCacheValueBytes(bytesArr, isPlain); - } - else - return new GridCacheValueBytes(); - } - } - - /** - * @param str {@link String}. - * @return Array. - */ - public static byte[] stringToArray(String str) { - return str != null ? str.getBytes() : null; - } - - /** - * @param arr Array. - * @return {@link String}. - */ - public static String arrayToString(byte[] arr) { - return arr != null ? new String(arr) : null; - } - - /** - * @param bits {@link BitSet}. - * @return Array. - */ - public static long[] bitSetToArray(BitSet bits) { - return bits != null ? bits.toLongArray() : null; - } - - /** - * @param arr Array. - * @return {@link BitSet}. - */ - public static BitSet arrayToBitSet(long[] arr) { - return arr != null ? BitSet.valueOf(arr) : null; - } - -// /** -// * @param name Field name. -// * @param e Enum. -// * @return Whether value was fully written. -// */ -// protected boolean putEnum(String name, @Nullable Enum e) { -// return writer.writeByte(name, e != null ? (byte)e.ordinal() : -1); -// } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java index 27d64be..c77f174 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java @@ -200,7 +200,7 @@ public class GridIoMessage extends MessageAdapter { _clone.ordered = ordered; _clone.timeout = timeout; _clone.skipOnTimeout = skipOnTimeout; - _clone.msg = msg; + _clone.msg = msg != null ? (MessageAdapter)msg.clone() : null; } /** {@inheritDoc} */ @@ -217,7 +217,7 @@ public class GridIoMessage extends MessageAdapter { switch (state) { case 0: - if (!writer.writeMessage("msg", msg != null ? msg.clone() : null)) + if (!writer.writeMessage("msg", msg)) return false; state++; -- 1.9.3 (Apple Git-50) From 70c8f23d1a1da505ec35e57564c59c51f82901fc Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 23:15:37 -0800 Subject: [PATCH 39/71] IGNITE-61 - Direct marshalling --- .../direct/GridTcpCommunicationMessageFactory.java | 51 ++++++++++++++++++++-- .../processors/cache/GridCacheValueBytes.java | 3 +- .../dht/preloader/GridDhtPartitionExchangeId.java | 3 +- .../processors/cache/version/GridCacheVersion.java | 3 +- .../processors/clock/GridClockDeltaVersion.java | 3 +- .../internal/processors/fs/IgniteFsProcessor.java | 39 ----------------- .../ignite/internal/util/GridByteArrayList.java | 3 +- .../apache/ignite/internal/util/GridLongList.java | 3 +- 8 files changed, 59 insertions(+), 49 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java index d3091e6..b1cbe7e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java @@ -29,13 +29,16 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.processors.cache.query.*; +import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.processors.continuous.*; import org.apache.ignite.internal.processors.dataload.*; +import org.apache.ignite.internal.processors.fs.*; import org.apache.ignite.internal.processors.rest.client.message.*; import org.apache.ignite.internal.processors.rest.handlers.task.*; import org.apache.ignite.internal.processors.rest.protocols.tcp.*; import org.apache.ignite.internal.processors.streamer.*; +import org.apache.ignite.internal.util.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.collision.jobstealing.*; import org.apache.ignite.spi.communication.tcp.*; @@ -56,7 +59,7 @@ public class GridTcpCommunicationMessageFactory { private static final Map CUSTOM = new ConcurrentHashMap8<>(); /** */ - public static final int MAX_COMMON_TYPE = 82; + public static final int MAX_COMMON_TYPE = 88; static { registerCommon(new GridTcpCommunicationMessageProducer() { @@ -254,7 +257,29 @@ public class GridTcpCommunicationMessageFactory { case 63: return new GridDataLoadResponse(); - // 64-71: IgniteFS messages. + case 64: + return new GridGgfsAckMessage(); + + case 65: + return new GridGgfsBlockKey(); + + case 66: + return new GridGgfsBlocksMessage(); + + case 67: + return new GridGgfsDeleteMessage(); + + case 68: + return new GridGgfsFileAffinityRange(); + + case 69: + return new GridGgfsFragmentizerRequest(); + + case 70: + return new GridGgfsFragmentizerResponse(); + + case 71: + return new GridGgfsSyncMessage(); case 72: return new GridClientHandshakeRequestWrapper(); @@ -289,6 +314,24 @@ public class GridTcpCommunicationMessageFactory { case 82: return new JobStealingRequest(); + case 83: + return new GridClockDeltaVersion(); + + case 84: + return new GridByteArrayList(); + + case 85: + return new GridLongList(); + + case 86: + return new GridCacheVersion(); + + case 87: + return new GridDhtPartitionExchangeId(); + + case 88: + return new GridCacheValueBytes(); + default: assert false : "Invalid message type."; @@ -298,8 +341,8 @@ public class GridTcpCommunicationMessageFactory { }, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, /* 64-71: IgniteFS messages. */ 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82); + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java index 289db2e..cf12c71 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java @@ -173,10 +173,11 @@ public class GridCacheValueBytes extends MessageAdapter { /** {@inheritDoc} */ @Override public byte directType() { - return 0; // TODO: implement. + return 88; } /** {@inheritDoc} */ + @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { GridCacheValueBytes _clone = new GridCacheValueBytes(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java index 622f639..c46b4c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionExchangeId.java @@ -216,10 +216,11 @@ public class GridDhtPartitionExchangeId extends MessageAdapter implements Compar /** {@inheritDoc} */ @Override public byte directType() { - return 0; // TODO: implement. + return 87; } /** {@inheritDoc} */ + @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { GridDhtPartitionExchangeId _clone = new GridDhtPartitionExchangeId(); 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 77fdf2d..1990bb1 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 @@ -337,10 +337,11 @@ public class GridCacheVersion extends MessageAdapter implements Comparable 0; - // Register GGFS messages. - GridTcpCommunicationMessageFactory.registerCommon(new GridTcpCommunicationMessageProducer() { - @Override - public MessageAdapter create(byte type) { - switch (type) { - case 64: - return new GridGgfsAckMessage(); - - case 65: - return new GridGgfsBlockKey(); - - case 66: - return new GridGgfsBlocksMessage(); - - case 67: - return new GridGgfsDeleteMessage(); - - case 68: - return new GridGgfsFileAffinityRange(); - - case 69: - return new GridGgfsFragmentizerRequest(); - - case 70: - return new GridGgfsFragmentizerResponse(); - - case 71: - return new GridGgfsSyncMessage(); - - default: - assert false : "Invalid GGFS message type."; - - return null; - } - } - }, 64, 65, 66, 67, 68, 69, 70, 71); - // Register HDFS edition usage with license manager. GridLicenseUseRegistry.onUsage(HADOOP, getClass()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java index 8ec78d5..d9252a1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridByteArrayList.java @@ -463,10 +463,11 @@ public class GridByteArrayList extends MessageAdapter implements Externalizable /** {@inheritDoc} */ @Override public byte directType() { - return 0; // TODO: implement. + return 84; } /** {@inheritDoc} */ + @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { GridByteArrayList _clone = new GridByteArrayList(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java index 5dce4e9..731dd5e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java @@ -561,10 +561,11 @@ public class GridLongList extends MessageAdapter implements Externalizable { /** {@inheritDoc} */ @Override public byte directType() { - return 0; // TODO: implement. + return 85; } /** {@inheritDoc} */ + @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { GridLongList _clone = new GridLongList(); -- 1.9.3 (Apple Git-50) From 88f5b9d49db9e90d44bd9796aa91e14b53caf769 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sat, 7 Feb 2015 23:54:39 -0800 Subject: [PATCH 40/71] IGNITE-61 - Direct marshalling --- .../apache/ignite/codegen/CommunicationMessageCodeGenerator.java | 4 ++-- .../internal/direct/GridTcpCommunicationMessageFactory.java | 2 +- .../processors/cache/distributed/dht/GridDhtLockFuture.java | 2 +- .../processors/cache/distributed/dht/GridDhtLockResponse.java | 4 ++-- .../distributed/dht/preloader/GridDhtPartitionDemandMessage.java | 4 ++-- .../distributed/dht/preloader/GridDhtPartitionSupplyMessage.java | 8 ++++---- .../ignite/plugin/extensions/communication/MessageAdapter.java | 8 +++++--- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java index 4a81a92..429b154 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java @@ -536,7 +536,7 @@ public class CommunicationMessageCodeGenerator { returnFalseIfFailed(write, "writer.writeObjectArray", field, name, type.getComponentType().getSimpleName() + ".class"); } - else if (Collection.class.isAssignableFrom(type)) { + else if (Collection.class.isAssignableFrom(type) && !Set.class.isAssignableFrom(type)) { assert colItemType != null; returnFalseIfFailed(write, "writer.writeCollection", field, name, colItemType.getSimpleName() + ".class"); @@ -613,7 +613,7 @@ public class CommunicationMessageCodeGenerator { returnFalseIfReadFailed(name, "reader.readObjectArray", field, type.getComponentType().getSimpleName() + ".class"); } - else if (Collection.class.isAssignableFrom(type)) { + else if (Collection.class.isAssignableFrom(type) && !Set.class.isAssignableFrom(type)) { assert colItemType != null; returnFalseIfReadFailed(name, "reader.readCollection", field, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java index b1cbe7e..600bd31 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/GridTcpCommunicationMessageFactory.java @@ -51,7 +51,7 @@ import java.util.*; */ public class GridTcpCommunicationMessageFactory { /** Common message producers. */ - private static final GridTcpCommunicationMessageProducer[] COMMON = new GridTcpCommunicationMessageProducer[83]; + private static final GridTcpCommunicationMessageProducer[] COMMON = new GridTcpCommunicationMessageProducer[89]; /** * Custom messages registry. Used for test purposes. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java index 5cc6e76..7521af7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java @@ -1136,7 +1136,7 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture invalidParts = res.invalidPartitions(); + Collection invalidParts = res.invalidPartitions(); // Removing mappings for invalid partitions. if (!F.isEmpty(invalidParts)) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index 2f28b89..48ef34d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -55,7 +55,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** Invalid partitions. */ @GridToStringInclude @GridDirectCollection(int.class) - private Set invalidParts = new GridLeanSet<>(); + private Collection invalidParts = new GridLeanSet<>(); @GridDirectTransient /** Preload entries. */ @@ -138,7 +138,7 @@ public class GridDhtLockResponse extends GridDistributedLockResponse /** * @return Invalid partitions. */ - public Set invalidPartitions() { + public Collection invalidPartitions() { return invalidParts; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java index 409522c..29760f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java @@ -41,7 +41,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** Partition. */ @GridToStringInclude @GridDirectCollection(int.class) - private Set parts; + private Collection parts; /** Topic. */ @GridDirectTransient @@ -112,7 +112,7 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage /** * @return Partition. */ - Set partitions() { + Collection partitions() { return parts; } 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 4835e77..ee1a930 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 @@ -46,12 +46,12 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** Partitions that have been fully sent. */ @GridDirectCollection(int.class) - private Set last; + private Collection last; /** Partitions which were not found. */ @GridToStringInclude @GridDirectCollection(int.class) - private Set missed; + private Collection missed; /** Entries. */ @GridDirectTransient @@ -130,7 +130,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** * @return Flag to indicate last message for partition. */ - Set last() { + Collection last() { return last == null ? Collections.emptySet() : last; } @@ -166,7 +166,7 @@ public class GridDhtPartitionSupplyMessage extends GridCacheMessage /** * @return Missed partitions. */ - Set missed() { + Collection missed() { return missed == null ? Collections.emptySet() : missed; } diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java index d393e16..c2b4d96 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java @@ -17,6 +17,8 @@ package org.apache.ignite.plugin.extensions.communication; +import org.apache.ignite.internal.direct.*; + import java.io.*; import java.nio.*; @@ -25,7 +27,7 @@ import java.nio.*; */ public abstract class MessageAdapter implements Serializable, Cloneable { /** Writer. */ - protected MessageWriter writer; + protected final MessageWriter writer = new DirectMessageWriter(); /** Reader. */ protected MessageReader reader; @@ -40,8 +42,8 @@ public abstract class MessageAdapter implements Serializable, Cloneable { * @param writer Writer. */ public final void setWriter(MessageWriter writer) { - if (this.writer == null) - this.writer = writer; +// if (this.writer == null) +// this.writer = writer; } /** -- 1.9.3 (Apple Git-50) From 8dad83299fe52dcfaf5980a534e9bbaef7cdb3bf Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sun, 8 Feb 2015 11:13:41 -0800 Subject: [PATCH 41/71] IGNITE-61 - Direct marshalling --- modules/codegen/pom.xml | 2 +- .../codegen/CommunicationMessageCodeGenerator.java | 24 ++++++++++++++-------- .../extensions/communication/MessageReader.java | 22 +++++++++++++------- .../communication/MessageReaderFactory.java | 22 +++++++++++++------- .../extensions/communication/MessageWriter.java | 22 +++++++++++++------- .../communication/MessageWriterFactory.java | 22 +++++++++++++------- pom.xml | 1 + 7 files changed, 78 insertions(+), 37 deletions(-) diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml index 66a4eab..5b9e1db 100644 --- a/modules/codegen/pom.xml +++ b/modules/codegen/pom.xml @@ -15,7 +15,7 @@ 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. - --> +--> + + + + + + Contains extendable components for communication. + + -- 1.9.3 (Apple Git-50) From d64fefb9d3459ca7b0cdb7183514e46c2d995b1d Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Sun, 8 Feb 2015 20:43:31 -0800 Subject: [PATCH 53/71] # IGNITE-61 - Minor fixes --- .../main/java/org/apache/ignite/internal/util/nio/GridNioServer.java | 1 + .../managers/communication/GridCommunicationSendMessageSelfTest.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java index b0c34ef..4a2e2e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java @@ -139,6 +139,7 @@ public class GridNioServer { private GridNioSslFilter sslFilter; /** */ + @GridToStringExclude private IgniteSpiAdapter spi; /** */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java index 7f39141..a26b617 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.managers.communication; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.direct.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.communication.tcp.*; @@ -147,7 +146,7 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest /** {@inheritDoc} */ @SuppressWarnings("CloneDoesntCallSuperClone") @Override public MessageAdapter clone() { - throw new UnsupportedOperationException(); + return this; } /** {@inheritDoc} */ -- 1.9.3 (Apple Git-50) From b9cb15731239bb086895fcf1b7190317f90a483d Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 00:28:35 -0800 Subject: [PATCH 54/71] # IGNITE-61 - Fixing client --- .../GridClientConnectionManagerAdapter.java | 84 +--- .../connection/GridClientNioTcpConnection.java | 135 +----- .../communication/GridIoMessageFactory.java | 21 - .../message/GridClientHandshakeRequestWrapper.java | 117 ----- .../GridClientHandshakeResponseWrapper.java | 94 ---- .../client/message/GridClientMessageWrapper.java | 275 ----------- .../message/GridClientPingPacketWrapper.java | 89 ---- .../rest/protocols/tcp/GridClientPacketType.java | 3 + .../rest/protocols/tcp/GridMemcachedMessage.java | 3 + .../protocols/tcp/GridTcpRestDirectParser.java | 523 --------------------- .../rest/protocols/tcp/GridTcpRestNioListener.java | 29 +- .../rest/protocols/tcp/GridTcpRestParser.java | 26 + .../rest/protocols/tcp/GridTcpRestProtocol.java | 8 +- 13 files changed, 72 insertions(+), 1335 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java index 476d9c5..6cecef0 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -18,18 +18,17 @@ package org.apache.ignite.client.impl.connection; import org.apache.ignite.*; -import org.apache.ignite.internal.direct.*; -import org.apache.ignite.logger.java.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.plugin.security.*; import org.apache.ignite.client.*; import org.apache.ignite.client.impl.*; import org.apache.ignite.client.util.*; import org.apache.ignite.internal.processors.rest.client.message.*; +import org.apache.ignite.internal.processors.rest.protocols.tcp.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.nio.ssl.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.logger.java.*; +import org.apache.ignite.plugin.security.*; import org.jetbrains.annotations.*; import javax.net.ssl.*; @@ -143,12 +142,12 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio GridNioFilter[] filters; - GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(), gridLog, true); + GridNioFilter codecFilter = new GridNioCodecFilter(new GridTcpRestParser(), gridLog, false); if (sslCtx != null) { GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog); - sslFilter.directMode(true); + sslFilter.directMode(false); sslFilter.clientMode(true); filters = new GridNioFilter[]{codecFilter, sslFilter}; @@ -166,7 +165,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio .byteOrder(ByteOrder.nativeOrder()) .tcpNoDelay(cfg.isTcpNoDelay()) .directBuffer(true) - .directMode(true) + .directMode(false) .socketReceiveBufferSize(0) .socketSendBufferSize(0) .idleTimeout(Long.MAX_VALUE) @@ -594,22 +593,10 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio assert conn != null; - if (msg instanceof GridClientMessageWrapper) { - GridClientMessageWrapper req = (GridClientMessageWrapper)msg; - - if (req.messageSize() != 0) { - assert req.message() != null; - - conn.handleResponse(req); - } - else - conn.handlePingResponse(); - } - else { - assert msg instanceof GridClientPingPacket : msg; - + if (msg instanceof GridClientPingPacket) conn.handlePingResponse(); - } + else + conn.handleResponse((GridClientMessage)msg); } } @@ -647,57 +634,4 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio ses.close(); } } - - /** - * - */ - private static class NioParser implements GridNioParser { - /** Message metadata key. */ - private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - - /** {@inheritDoc} */ - @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) - throws IOException, IgniteCheckedException { - GridClientFutureAdapter handshakeFut = ses.meta(GridClientNioTcpConnection.SES_META_HANDSHAKE); - - if (handshakeFut != null) { - byte code = buf.get(); - - return new GridClientHandshakeResponse(code); - } - - MessageAdapter msg = ses.removeMeta(MSG_META_KEY); - - if (msg == null && buf.hasRemaining()) { - byte type = buf.get(); - - if (type == GridClientMessageWrapper.REQ_HEADER) { - msg = new GridClientMessageWrapper(); - - msg.setReader(new DirectMessageReader(null)); - } - else - throw new IOException("Invalid message type: " + type); - } - - boolean finished = false; - - if (buf.hasRemaining()) - finished = msg.readFrom(buf); - - if (finished) - return msg; - else { - ses.addMeta(MSG_META_KEY, msg); - - return null; - } - } - - /** {@inheritDoc} */ - @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException { - // No encoding needed for direct messages. - throw new UnsupportedEncodingException(); - } - } } diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java index 51da3d7..3cead45 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java @@ -33,7 +33,6 @@ import org.jetbrains.annotations.*; import javax.net.ssl.*; import java.io.*; import java.net.*; -import java.nio.*; import java.nio.channels.*; import java.util.*; import java.util.concurrent.*; @@ -43,6 +42,7 @@ import java.util.logging.*; import static org.apache.ignite.client.GridClientCacheFlag.*; import static org.apache.ignite.client.impl.connection.GridClientConnectionCloseReason.*; import static org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.*; +import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*; /** * This class performs request to grid over tcp protocol. Serialization is performed with marshaller @@ -194,9 +194,9 @@ public class GridClientNioTcpConnection extends GridClientConnection { else if (marsh instanceof GridClientJdkMarshaller) req.marshallerId(GridClientJdkMarshaller.ID); - GridClientHandshakeRequestWrapper wrapper = new GridClientHandshakeRequestWrapper(req); + ses.addMeta(MARSHALLER.ordinal(), marsh); - ses.send(wrapper); + ses.send(req); handshakeFut.get(); @@ -392,7 +392,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { else if (now - lastPingSndTime > pingInterval && lastPingRcvTime != Long.MAX_VALUE) { lastPingRcvTime = Long.MAX_VALUE; - ses.send(new GridClientPingPacketWrapper()); + ses.send(GridClientPingPacket.PING_MESSAGE); lastPingSndTime = now; } @@ -415,22 +415,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { assert old == null; - GridClientMessageWrapper wrapper; - - try { - wrapper = messageWrapper(msg); - } - catch (IOException e) { - log.log(Level.SEVERE, "Failed to marshal message: " + msg, e); - - removePending(reqId); - - fut.onDone(e); - - return fut; - } - - GridNioFuture sndFut = ses.send(wrapper); + GridNioFuture sndFut = ses.send(msg); lastMsgSndTime = U.currentTimeMillis(); @@ -473,59 +458,38 @@ public class GridClientNioTcpConnection extends GridClientConnection { * Handles incoming response message. If this connection is closed this method would signal empty event * if there is no more pending requests. * - * @param req Incoming response data. + * @param res Incoming response data. */ @SuppressWarnings({"unchecked", "TooBroadScope"}) - void handleResponse(GridClientMessageWrapper req) { + void handleResponse(GridClientMessage res) { lastMsgRcvTime = U.currentTimeMillis(); - TcpClientFuture fut = pendingReqs.get(req.requestId()); + TcpClientFuture fut = pendingReqs.get(res.requestId()); if (fut == null) { log.warning("Response for an unknown request is received, ignoring. " + - "[req=" + req + ", ses=" + ses + ']'); + "[res=" + res + ", ses=" + ses + ']'); return; } if (fut.forward()) { - GridRouterResponse msg = new GridRouterResponse( - req.messageArray(), - req.requestId(), - clientId, - req.destinationId()); - - removePending(msg.requestId()); - - fut.onDone(msg); + // TODO: IGNITE-61 +// GridRouterResponse msg = new GridRouterResponse( +// res.messageArray(), +// res.requestId(), +// clientId, +// res.destinationId()); +// +// removePending(msg.requestId()); +// +// fut.onDone(msg); } else { - GridClientMessage msg; - - if (keepPortablesMode != null) - keepPortablesMode.set(fut.keepPortables()); - - try { - msg = marsh.unmarshal(req.messageArray()); - } - catch (IOException e) { - fut.onDone(new GridClientException("Failed to unmarshal message.", e)); - - return; - } - - finally { - if (keepPortablesMode != null) - keepPortablesMode.set(true); - } - msg.requestId(req.requestId()); - msg.clientId(req.clientId()); - msg.destinationId(req.destinationId()); - - if (msg instanceof GridClientResponse) - handleClientResponse(fut, (GridClientResponse)msg); + if (res instanceof GridClientResponse) + handleClientResponse(fut, (GridClientResponse)res); else - log.warning("Unsupported response type received: " + msg); + log.warning("Unsupported response type received: " + res); } } @@ -559,22 +523,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { req.requestId(resp.requestId()); - GridClientMessageWrapper wrapper; - - try { - wrapper = messageWrapper(req); - } - catch (IOException e) { - log.log(Level.SEVERE, "Failed to marshal message: " + req, e); - - removePending(resp.requestId()); - - fut.onDone(e); - - return; - } - - ses.send(wrapper); + ses.send(req); return; } @@ -588,22 +537,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { src.sessionToken(sesTok); - GridClientMessageWrapper wrapper; - - try { - wrapper = messageWrapper(src); - } - catch (IOException e) { - log.log(Level.SEVERE, "Failed to marshal message: " + src, e); - - removePending(resp.requestId()); - - fut.onDone(e); - - return; - } - - ses.send(wrapper); + ses.send(src); return; } @@ -624,27 +558,6 @@ public class GridClientNioTcpConnection extends GridClientConnection { } /** - * @param msg Client message. - * @return Message wrapper for direct marshalling. - * @throws IOException If failed to marshal message. - */ - private GridClientMessageWrapper messageWrapper(GridClientMessage msg) throws IOException { - GridClientMessageWrapper wrapper = new GridClientMessageWrapper(); - - wrapper.requestId(msg.requestId()); - wrapper.clientId(clientId); - wrapper.destinationId(msg.destinationId()); - - ByteBuffer data = (msg instanceof GridRouterRequest) ? ByteBuffer.wrap(((GridRouterRequest)msg).body()) : - marsh.marshal(msg, 0); - - wrapper.message(data); - wrapper.messageSize(data.remaining() + 40); - - return wrapper; - } - - /** * Removes pending request and signals to {@link #closedLatch} if necessary. * * @param reqId Request Id. 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 0634b1f..0f46e3d 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 @@ -34,7 +34,6 @@ import org.apache.ignite.internal.processors.clock.*; import org.apache.ignite.internal.processors.continuous.*; import org.apache.ignite.internal.processors.dataload.*; import org.apache.ignite.internal.processors.fs.*; -import org.apache.ignite.internal.processors.rest.client.message.*; import org.apache.ignite.internal.processors.rest.handlers.task.*; import org.apache.ignite.internal.processors.rest.protocols.tcp.*; import org.apache.ignite.internal.processors.streamer.*; @@ -445,26 +444,6 @@ public class GridIoMessageFactory implements MessageFactory { break; - case 72: - msg = new GridClientHandshakeRequestWrapper(); - - break; - - case 73: - msg = new GridClientHandshakeResponseWrapper(); - - break; - - case 74: - msg = new GridClientMessageWrapper(); - - break; - - case 75: - msg = new GridClientPingPacketWrapper(); - - break; - case 76: msg = new GridTaskResultRequest(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java deleted file mode 100644 index 71dfcf9..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java +++ /dev/null @@ -1,117 +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.rest.client.message; - -import org.apache.ignite.internal.direct.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.extensions.communication.*; - -import java.nio.*; - -/** - * Client handshake wrapper for direct marshalling. - */ -public class GridClientHandshakeRequestWrapper extends MessageAdapter { - /** */ - private static final long serialVersionUID = -5705048094821942662L; - - /** Signal char. */ - public static final byte HANDSHAKE_HEADER = (byte)0x91; - - /** Stream. */ - private final DirectByteBufferStream stream = new DirectByteBufferStream(null); - - /** Handshake bytes. */ - private byte[] bytes; - - /** - * - */ - public GridClientHandshakeRequestWrapper() { - // No-op. - } - - /** - * - * @param req Handshake request. - */ - public GridClientHandshakeRequestWrapper(GridClientHandshakeRequest req) { - bytes = req.rawBytes(); - } - - /** - * @return Handshake bytes. - */ - public byte[] bytes() { - return bytes; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf) { - stream.setBuffer(buf); - - if (!typeWritten) { - if (!buf.hasRemaining()) - return false; - - stream.writeByte(directType()); - - typeWritten = true; - } - - stream.writeByteArray(bytes, 0, bytes.length); - - return stream.lastFinished(); - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf) { - stream.setBuffer(buf); - - bytes = stream.readByteArray(GridClientHandshakeRequest.PACKET_SIZE); - - return stream.lastFinished(); - } - - /** {@inheritDoc} */ - @Override public byte directType() { - return HANDSHAKE_HEADER; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public MessageAdapter clone() { - GridClientHandshakeRequestWrapper _clone = new GridClientHandshakeRequestWrapper(); - - clone0(_clone); - - return _clone; - } - - /** {@inheritDoc} */ - @Override protected void clone0(MessageAdapter _msg) { - GridClientHandshakeRequestWrapper _clone = (GridClientHandshakeRequestWrapper)_msg; - - _clone.bytes = bytes; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClientHandshakeRequestWrapper.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java deleted file mode 100644 index e598f66..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java +++ /dev/null @@ -1,94 +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.rest.client.message; - -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.extensions.communication.*; - -import java.nio.*; - -/** - * Client handshake wrapper for direct marshalling. - */ -public class GridClientHandshakeResponseWrapper extends MessageAdapter { - /** */ - private static final long serialVersionUID = -1529807975073967381L; - - /** */ - private byte code; - - /** - * - */ - public GridClientHandshakeResponseWrapper() { - // No-op. - } - - /** - * @param code Response code. - */ - public GridClientHandshakeResponseWrapper(byte code) { - this.code = code; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf) { - writer.setBuffer(buf); - - if (!typeWritten) { - if (!writer.writeByte(null, directType())) - return false; - - typeWritten = true; - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf) { - return true; - } - - /** {@inheritDoc} */ - @Override public byte directType() { - return code; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public MessageAdapter clone() { - GridClientHandshakeResponseWrapper _clone = new GridClientHandshakeResponseWrapper(); - - clone0(_clone); - - return _clone; - } - - /** {@inheritDoc} */ - @Override protected void clone0(MessageAdapter _msg) { - GridClientHandshakeResponseWrapper _clone = (GridClientHandshakeResponseWrapper)_msg; - - _clone.code = code; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClientHandshakeResponseWrapper.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java deleted file mode 100644 index 746a40f..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java +++ /dev/null @@ -1,275 +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.rest.client.message; - -import org.apache.ignite.internal.direct.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.extensions.communication.*; - -import java.nio.*; -import java.util.*; - -/** - * Client message wrapper for direct marshalling. - */ -public class GridClientMessageWrapper extends MessageAdapter { - /** */ - private static final long serialVersionUID = 5284375300887454697L; - - /** Client request header. */ - public static final byte REQ_HEADER = (byte)0x90; - - /** Stream. */ - private final DirectByteBufferStream stream = new DirectByteBufferStream(null); - - /** */ - private int msgSize; - - /** */ - private long reqId; - - /** */ - private UUID clientId; - - /** */ - private UUID destId; - - /** */ - private ByteBuffer msg; - - /** - * @return Request ID. - */ - public long requestId() { - return reqId; - } - - /** - * @param reqId Request ID. - */ - public void requestId(long reqId) { - this.reqId = reqId; - } - - /** - * @return Message size. - */ - public int messageSize() { - return msgSize; - } - - /** - * @param msgSize Message size. - */ - public void messageSize(int msgSize) { - this.msgSize = msgSize; - } - - /** - * @return Client ID. - */ - public UUID clientId() { - return clientId; - } - - /** - * @param clientId Client ID. - */ - public void clientId(UUID clientId) { - this.clientId = clientId; - } - - /** - * @return Destination ID. - */ - public UUID destinationId() { - return destId; - } - - /** - * @param destId Destination ID. - */ - public void destinationId(UUID destId) { - this.destId = destId; - } - - /** - * @return Message buffer. - */ - public ByteBuffer message() { - return msg; - } - - /** - * @return Message bytes. - */ - public byte[] messageArray() { - assert msg.hasArray(); - assert msg.position() == 0 && msg.remaining() == msg.capacity(); - - return msg.array(); - } - - /** - * @param msg Message bytes. - */ - public void message(ByteBuffer msg) { - this.msg = msg; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf) { - stream.setBuffer(buf); - - if (!typeWritten) { - if (stream.remaining() < 1) - return false; - - stream.writeByte(directType()); - - typeWritten = true; - } - - switch (state) { - case 0: - if (stream.remaining() < 4) - return false; - - stream.writeInt(msgSize); - - state++; - - case 1: - if (stream.remaining() < 8) - return false; - - stream.writeLong(reqId); - - state++; - - case 2: - if (stream.remaining() < 16) - return false; - - stream.writeByteArray(U.uuidToBytes(clientId), 0, 16); - - state++; - - case 3: - if (stream.remaining() < 16) - return false; - - stream.writeByteArray(U.uuidToBytes(destId), 0, 16); - - state++; - - case 4: - stream.writeByteArray(msg.array(), msg.position(), msg.remaining()); - - state++; - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf) { - stream.setBuffer(buf); - - switch (state) { - case 0: - if (stream.remaining() < 4) - return false; - - msgSize = stream.readInt(); - - if (msgSize == 0) // Ping message. - return true; - - state++; - - case 1: - if (stream.remaining() < 8) - return false; - - reqId = stream.readLong(); - - state++; - - case 2: - if (stream.remaining() < 16) - return false; - - clientId = U.bytesToUuid(stream.readByteArray(16), 0); - - state++; - - case 3: - if (stream.remaining() < 16) - return false; - - destId = U.bytesToUuid(stream.readByteArray(16), 0); - - state++; - - case 4: - byte[] msg0 = stream.readByteArray(msgSize); - - if (!stream.lastFinished()) - return false; - - msg = ByteBuffer.wrap(msg0); - - state++; - } - - return true; - } - - /** {@inheritDoc} */ - @Override public byte directType() { - return REQ_HEADER; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public MessageAdapter clone() { - GridClientMessageWrapper _clone = new GridClientMessageWrapper(); - - clone0(_clone); - - return _clone; - } - - /** {@inheritDoc} */ - @Override protected void clone0(MessageAdapter _msg) { - GridClientMessageWrapper _clone = (GridClientMessageWrapper)_msg; - - _clone.reqId = reqId; - _clone.msgSize = msgSize; - _clone.clientId = clientId; - _clone.destId = destId; - _clone.msg = msg; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClientMessageWrapper.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java deleted file mode 100644 index ca8e804..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java +++ /dev/null @@ -1,89 +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.rest.client.message; - -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.extensions.communication.*; - -import java.nio.*; - -/** - * Ping packet wrapper for direct marshalling. - */ -public class GridClientPingPacketWrapper extends MessageAdapter { - /** */ - private static final long serialVersionUID = -3956036611004055629L; - - /** Ping message size (always zero). */ - private int size; - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf) { - writer.setBuffer(buf); - - if (!typeWritten) { - if (!writer.writeByte(null, directType())) - return false; - - typeWritten = true; - } - - switch (state) { - case 0: - if (!writer.writeInt("size", size)) - return false; - - state++; - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf) { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override public byte directType() { - return GridClientMessageWrapper.REQ_HEADER; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) - @Override public MessageAdapter clone() { - GridClientPingPacketWrapper _clone = new GridClientPingPacketWrapper(); - - clone0(_clone); - - return _clone; - } - - /** {@inheritDoc} */ - @Override protected void clone0(MessageAdapter _msg) { - GridClientPingPacketWrapper _clone = (GridClientPingPacketWrapper)_msg; - - _clone.size = size; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridClientPingPacketWrapper.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridClientPacketType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridClientPacketType.java index 0bc8099..e47e825 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridClientPacketType.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridClientPacketType.java @@ -27,6 +27,9 @@ public enum GridClientPacketType { /** Ignite handshake. */ IGNITE_HANDSHAKE, + /** Ignite handshake response. */ + IGNITE_HANDSHAKE_RES, + /** Ignite message. */ IGNITE } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessage.java index 707383f..a42fb57 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessage.java @@ -51,6 +51,9 @@ public class GridMemcachedMessage implements GridClientMessage { /** Client handshake flag. */ public static final byte IGNITE_HANDSHAKE_FLAG = (byte)0x91; + /** Client handshake flag. */ + public static final byte IGNITE_HANDSHAKE_RES_FLAG = (byte)0x92; + /** Success status. */ public static final int SUCCESS = 0x0000; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java deleted file mode 100644 index b743e66..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java +++ /dev/null @@ -1,523 +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.rest.protocols.tcp; - -import org.apache.ignite.*; -import org.apache.ignite.client.marshaller.*; -import org.apache.ignite.internal.direct.*; -import org.apache.ignite.internal.processors.rest.client.message.*; -import org.apache.ignite.internal.util.nio.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.extensions.communication.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.nio.*; -import java.nio.charset.*; -import java.util.*; - -import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage.*; -import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*; - -/** - * - */ -public class GridTcpRestDirectParser implements GridNioParser { - /** UTF-8 charset. */ - private static final Charset UTF_8 = Charset.forName("UTF-8"); - - /** Message metadata key. */ - private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); - - /** Message reader. */ - private final MessageReader rdr = new DirectMessageReader(null); - - /** Protocol handler. */ - private final GridTcpRestProtocol proto; - - /** - * @param proto Protocol handler. - */ - public GridTcpRestDirectParser(GridTcpRestProtocol proto) { - this.proto = proto; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) - throws IOException, IgniteCheckedException { - ParserState state = ses.removeMeta(PARSER_STATE.ordinal()); - - if (state != null) { - assert state.packetType() == GridClientPacketType.MEMCACHE; - - Object memcacheMsg = parseMemcachePacket(ses, buf, state); - - if (memcacheMsg == null) - ses.addMeta(PARSER_STATE.ordinal(), state); - - return memcacheMsg; - } - - MessageAdapter msg = ses.removeMeta(MSG_META_KEY); - - if (msg == null && buf.hasRemaining()) { - byte type = buf.get(buf.position()); - - if (type == GridClientMessageWrapper.REQ_HEADER) { - buf.get(); - - msg = new GridClientMessageWrapper(); - - msg.setReader(rdr); - } - else if (type == GridClientHandshakeRequestWrapper.HANDSHAKE_HEADER) { - buf.get(); - - msg = new GridClientHandshakeRequestWrapper(); - - msg.setReader(rdr); - } - else if (type == MEMCACHE_REQ_FLAG) { - state = new ParserState(); - - state.packet(new GridMemcachedMessage()); - state.packetType(GridClientPacketType.MEMCACHE); - - Object memcacheMsg = parseMemcachePacket(ses, buf, state); - - if (memcacheMsg == null) - ses.addMeta(PARSER_STATE.ordinal(), state); - - return memcacheMsg; - } - else - throw new IOException("Invalid message type: " + type); - } - - boolean finished = false; - - if (buf.hasRemaining()) - finished = msg.readFrom(buf); - - if (finished) { - if (msg instanceof GridClientMessageWrapper) { - GridClientMessageWrapper clientMsg = (GridClientMessageWrapper)msg; - - if (clientMsg.messageSize() == 0) - return GridClientPingPacket.PING_MESSAGE; - - GridClientMarshaller marsh = proto.marshaller(ses); - - GridClientMessage ret = marsh.unmarshal(clientMsg.messageArray()); - - ret.requestId(clientMsg.requestId()); - ret.clientId(clientMsg.clientId()); - ret.destinationId(clientMsg.destinationId()); - - return ret; - } - else { - assert msg instanceof GridClientHandshakeRequestWrapper; - - GridClientHandshakeRequestWrapper req = (GridClientHandshakeRequestWrapper)msg; - - GridClientHandshakeRequest ret = new GridClientHandshakeRequest(); - - ret.putBytes(req.bytes(), 0, 4); - - return ret; - } - } - else { - ses.addMeta(MSG_META_KEY, msg); - - return null; - } - } - - /** {@inheritDoc} */ - @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException { - // No encoding needed for direct messages. - throw new UnsupportedEncodingException(); - } - - /** - * Parses memcache protocol message. - * - * @param ses Session. - * @param buf Buffer containing not parsed bytes. - * @param state Current parser state. - * @return Parsed packet.s - * @throws IOException If packet cannot be parsed. - * @throws IgniteCheckedException If deserialization error occurred. - */ - @Nullable private GridClientMessage parseMemcachePacket(GridNioSession ses, ByteBuffer buf, ParserState state) - throws IOException, IgniteCheckedException { - assert state.packetType() == GridClientPacketType.MEMCACHE; - assert state.packet() != null; - assert state.packet() instanceof GridMemcachedMessage; - - GridMemcachedMessage req = (GridMemcachedMessage)state.packet(); - ByteArrayOutputStream tmp = state.buffer(); - int i = state.index(); - - while (buf.remaining() > 0) { - byte b = buf.get(); - - if (i == 0) - req.requestFlag(b); - else if (i == 1) - req.operationCode(b); - else if (i == 2 || i == 3) { - tmp.write(b); - - if (i == 3) { - req.keyLength(U.bytesToShort(tmp.toByteArray(), 0)); - - tmp.reset(); - } - } - else if (i == 4) - req.extrasLength(b); - else if (i >= 8 && i <= 11) { - tmp.write(b); - - if (i == 11) { - req.totalLength(U.bytesToInt(tmp.toByteArray(), 0)); - - tmp.reset(); - } - } - else if (i >= 12 && i <= 15) { - tmp.write(b); - - if (i == 15) { - req.opaque(tmp.toByteArray()); - - tmp.reset(); - } - } - else if (i >= HDR_LEN && i < HDR_LEN + req.extrasLength()) { - tmp.write(b); - - if (i == HDR_LEN + req.extrasLength() - 1) { - req.extras(tmp.toByteArray()); - - tmp.reset(); - } - } - else if (i >= HDR_LEN + req.extrasLength() && - i < HDR_LEN + req.extrasLength() + req.keyLength()) { - tmp.write(b); - - if (i == HDR_LEN + req.extrasLength() + req.keyLength() - 1) { - req.key(tmp.toByteArray()); - - tmp.reset(); - } - } - else if (i >= HDR_LEN + req.extrasLength() + req.keyLength() && - i < HDR_LEN + req.totalLength()) { - tmp.write(b); - - if (i == HDR_LEN + req.totalLength() - 1) { - req.value(tmp.toByteArray()); - - tmp.reset(); - } - } - - if (i == HDR_LEN + req.totalLength() - 1) - // Assembled the packet. - return assemble(ses, req); - - i++; - } - - state.index(i); - - return null; - } - - /** - * Validates incoming packet and deserializes all fields that need to be deserialized. - * - * @param ses Session on which packet is being parsed. - * @param req Raw packet. - * @return Same packet with fields deserialized. - * @throws IOException If parsing failed. - * @throws IgniteCheckedException If deserialization failed. - */ - private GridClientMessage assemble(GridNioSession ses, GridMemcachedMessage req) throws IOException, IgniteCheckedException { - byte[] extras = req.extras(); - - // First, decode key and value, if any - if (req.key() != null || req.value() != null) { - short keyFlags = 0; - short valFlags = 0; - - if (req.hasFlags()) { - if (extras == null || extras.length < FLAGS_LENGTH) - throw new IOException("Failed to parse incoming packet (flags required for command) [ses=" + - ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']'); - - keyFlags = U.bytesToShort(extras, 0); - valFlags = U.bytesToShort(extras, 2); - } - - if (req.key() != null) { - assert req.key() instanceof byte[]; - - byte[] rawKey = (byte[])req.key(); - - // Only values can be hessian-encoded. - req.key(decodeObj(keyFlags, rawKey)); - } - - if (req.value() != null) { - assert req.value() instanceof byte[]; - - byte[] rawVal = (byte[])req.value(); - - req.value(decodeObj(valFlags, rawVal)); - } - } - - if (req.hasExpiration()) { - if (extras == null || extras.length < 8) - throw new IOException("Failed to parse incoming packet (expiration value required for command) [ses=" + - ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']'); - - req.expiration(U.bytesToInt(extras, 4) & 0xFFFFFFFFL); - } - - if (req.hasInitial()) { - if (extras == null || extras.length < 16) - throw new IOException("Failed to parse incoming packet (initial value required for command) [ses=" + - ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']'); - - req.initial(U.bytesToLong(extras, 8)); - } - - if (req.hasDelta()) { - if (extras == null || extras.length < 8) - throw new IOException("Failed to parse incoming packet (delta value required for command) [ses=" + - ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']'); - - req.delta(U.bytesToLong(extras, 0)); - } - - if (extras != null) { - // Clients that include cache name must always include flags. - int len = 4; - - if (req.hasExpiration()) - len += 4; - - if (req.hasDelta()) - len += 8; - - if (req.hasInitial()) - len += 8; - - if (extras.length - len > 0) { - byte[] cacheName = new byte[extras.length - len]; - - U.arrayCopy(extras, len, cacheName, 0, extras.length - len); - - req.cacheName(new String(cacheName, UTF_8)); - } - } - - return req; - } - - /** - * Decodes value from a given byte array to the object according to the flags given. - * - * @param flags Flags. - * @param bytes Byte array to decode. - * @return Decoded value. - * @throws IgniteCheckedException If deserialization failed. - */ - private Object decodeObj(short flags, byte[] bytes) throws IgniteCheckedException { - assert bytes != null; - - if ((flags & SERIALIZED_FLAG) != 0) - return proto.jdkMarshaller().unmarshal(bytes, null); - - int masked = flags & 0xff00; - - switch (masked) { - case BOOLEAN_FLAG: - return bytes[0] == '1'; - case INT_FLAG: - return U.bytesToInt(bytes, 0); - case LONG_FLAG: - return U.bytesToLong(bytes, 0); - case DATE_FLAG: - return new Date(U.bytesToLong(bytes, 0)); - case BYTE_FLAG: - return bytes[0]; - case FLOAT_FLAG: - return Float.intBitsToFloat(U.bytesToInt(bytes, 0)); - case DOUBLE_FLAG: - return Double.longBitsToDouble(U.bytesToLong(bytes, 0)); - case BYTE_ARR_FLAG: - return bytes; - default: - return new String(bytes, UTF_8); - } - } - - /** - * Holder for parser state and temporary buffer. - */ - protected static class ParserState { - /** Parser index. */ - private int idx; - - /** Temporary data buffer. */ - private ByteArrayOutputStream buf = new ByteArrayOutputStream(); - - /** Packet being assembled. */ - private GridClientMessage packet; - - /** Packet type. */ - private GridClientPacketType packetType; - - /** Header data. */ - private HeaderData hdr; - - /** - * @return Stored parser index. - */ - public int index() { - return idx; - } - - /** - * @param idx Index to store. - */ - public void index(int idx) { - this.idx = idx; - } - - /** - * @return Temporary data buffer. - */ - public ByteArrayOutputStream buffer() { - return buf; - } - - /** - * @return Pending packet. - */ - @Nullable public GridClientMessage packet() { - return packet; - } - - /** - * @param packet Pending packet. - */ - public void packet(GridClientMessage packet) { - assert this.packet == null; - - this.packet = packet; - } - - /** - * @return Pending packet type. - */ - public GridClientPacketType packetType() { - return packetType; - } - - /** - * @param packetType Pending packet type. - */ - public void packetType(GridClientPacketType packetType) { - this.packetType = packetType; - } - - /** - * @return Header. - */ - public HeaderData header() { - return hdr; - } - - /** - * @param hdr Header. - */ - public void header(HeaderData hdr) { - this.hdr = hdr; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(ParserState.class, this); - } - } - - /** - * Header. - */ - protected static class HeaderData { - /** Request Id. */ - private final long reqId; - - /** Request Id. */ - private final UUID clientId; - - /** Request Id. */ - private final UUID destId; - - /** - * @param reqId Request Id. - * @param clientId Client Id. - * @param destId Destination Id. - */ - private HeaderData(long reqId, UUID clientId, UUID destId) { - this.reqId = reqId; - this.clientId = clientId; - this.destId = destId; - } - - /** - * @return Request Id. - */ - public long reqId() { - return reqId; - } - - /** - * @return Client Id. - */ - public UUID clientId() { - return clientId; - } - - /** - * @return Destination Id. - */ - public UUID destinationId() { - return destId; - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java index 12dc711..159f178 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java @@ -29,14 +29,11 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; -import java.io.*; -import java.nio.*; import java.util.*; import java.util.concurrent.*; import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; import static org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.*; -import static org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeResponse.*; import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*; /** @@ -138,7 +135,7 @@ public class GridTcpRestNioListener extends GridNioServerListenerAdapter 0) { - res.add((short) keyFlags); - res.add((short) valFlags); - } - - assert msg.key() == null || msg.key() instanceof byte[]; - assert msg.value() == null || msg.value() instanceof byte[]; - - if (keyLen > 0) - res.add((byte[])msg.key(), 0, ((byte[])msg.key()).length); - - if (dataLen > 0) - res.add((byte[])msg.value(), 0, ((byte[])msg.value()).length); - - return res.entireArray(); - } - - /** - * Encodes given object to a byte array and returns flags that describe the type of serialized object. - * - * @param obj Object to serialize. - * @param out Output stream to which object should be written. - * @param jdkMarshaller JDK marshaller. - * @return Serialization flags. - * @throws IgniteCheckedException If JDK serialization failed. - */ - private int encodeObj(Object obj, ByteArrayOutputStream out, Marshaller jdkMarshaller) throws IgniteCheckedException { - int flags = 0; - - byte[] data = null; - - if (obj instanceof String) - data = ((String)obj).getBytes(UTF_8); - else if (obj instanceof Boolean) { - data = new byte[] {(byte)((Boolean)obj ? '1' : '0')}; - - flags |= BOOLEAN_FLAG; - } - else if (obj instanceof Integer) { - data = U.intToBytes((Integer) obj); - - flags |= INT_FLAG; - } - else if (obj instanceof Long) { - data = U.longToBytes((Long)obj); - - flags |= LONG_FLAG; - } - else if (obj instanceof Date) { - data = U.longToBytes(((Date)obj).getTime()); - - flags |= DATE_FLAG; - } - else if (obj instanceof Byte) { - data = new byte[] {(Byte)obj}; - - flags |= BYTE_FLAG; - } - else if (obj instanceof Float) { - data = U.intToBytes(Float.floatToIntBits((Float)obj)); - - flags |= FLOAT_FLAG; - } - else if (obj instanceof Double) { - data = U.longToBytes(Double.doubleToLongBits((Double)obj)); - - flags |= DOUBLE_FLAG; - } - else if (obj instanceof byte[]) { - data = (byte[])obj; - - flags |= BYTE_ARR_FLAG; - } - else { - jdkMarshaller.marshal(obj, out); - - flags |= SERIALIZED_FLAG; - } - - if (data != null) - out.write(data, 0, data.length); - - return flags; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridMemcachedMessageWrapper.class, this); - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java index 070546e..43e47cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java @@ -244,18 +244,7 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter sendResponse(GridNioSession ses, GridMemcachedMessage res) { - try { - GridMemcachedMessageWrapper wrapper = new GridMemcachedMessageWrapper(res, jdkMarshaller); - - return ses.send(wrapper); - } - catch (IgniteCheckedException e) { - U.error(log, "Failed to marshal response: " + res, e); - - ses.close(); - - return new GridNioFinishedFuture<>(e); - } + return ses.send(res); } /** -- 1.9.3 (Apple Git-50) From 40715c9eb9e1da727564b1a48f74e3aedae01677 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 08:47:18 -0800 Subject: [PATCH 57/71] Merge branch 'ignite-sprint-1' of github.com:ggprivate/ggprivate into ignite-61 Conflicts: modules/core/src/test/java/org/gridgain/grid/kernal/version/GridVersionConvertersSelfTest.java --- .../java/org/apache/ignite/internal/GridKernalContext.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java index 8f11e8d..152cfa6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java @@ -502,17 +502,6 @@ public interface GridKernalContext extends Iterable { public T createComponent(Class cls); /** - * @return Message factory. - */ - public GridTcpMessageFactory messageFactory(); - - /** - * @param producer Message producer. - * @return Message type code. - */ - public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer); - - /** * @return Thread pool implementation to be used in grid to process job execution * requests and user messages sent to the node. */ -- 1.9.3 (Apple Git-50) From 63025059a24045b4b4f315ad02748e385a29029f Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 10:43:09 -0800 Subject: [PATCH 58/71] IGNITE-61 - Direct marshalling --- .../apache/ignite/internal/processors/cache/GridCacheValueBytes.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java index cf12c71..03f20c6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java @@ -27,6 +27,9 @@ import java.nio.*; * Wrapped value bytes of cache entry. */ public class GridCacheValueBytes extends MessageAdapter { + /** */ + private static final long serialVersionUID = 0L; + /** Null instance. */ private static final GridCacheValueBytes NULL = new GridCacheValueBytes(); -- 1.9.3 (Apple Git-50) From 2a6aa9fb4af19efdbea0884355a2f81491fb1659 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 11:00:55 -0800 Subject: [PATCH 59/71] IGNITE-61 - Direct marshalling --- .../examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java index fdd369b..cf9aee2 100644 --- a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java +++ b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExampleNodeStartup.java @@ -61,6 +61,8 @@ public class MemcacheRestExampleNodeStartup { cfg.setDeploymentMode(SHARED); cfg.setPeerClassLoadingEnabled(true); + cfg.setClientConnectionConfiguration(new ClientConnectionConfiguration()); + OptimizedMarshaller marsh = new OptimizedMarshaller(); marsh.setRequireSerializable(false); -- 1.9.3 (Apple Git-50) From 4e434848b9fd26ef78b0210f622ffd0ffd332f64 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 11:05:55 -0800 Subject: [PATCH 60/71] IGNITE-61 - Direct marshalling --- .../apache/ignite/internal/processors/rest/TestBinaryClient.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java index fd7cbd7..d34f421 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java @@ -92,14 +92,15 @@ final class TestBinaryClient { sock.getOutputStream().write(GridMemcachedMessage.IGNITE_HANDSHAKE_FLAG); sock.getOutputStream().write(req.rawBytes()); - byte[] buf = new byte[1]; + byte[] buf = new byte[2]; // Wait for handshake response. int read = input.read(buf); - assert read == 1 : read; + assert read == 2 : read; - assert buf[0] == GridClientHandshakeResponse.OK.resultCode() : + assert buf[0] == GridMemcachedMessage.IGNITE_HANDSHAKE_RES_FLAG; + assert buf[1] == GridClientHandshakeResponse.OK.resultCode() : "Client handshake failed [code=" + buf[0] + ']'; } catch (IOException e) { @@ -275,8 +276,6 @@ final class TestBinaryClient { ByteBuffer slice = res.slice(); - slice.order(ByteOrder.LITTLE_ENDIAN); - slice.put((byte)0x90); slice.putInt(res.remaining() - 5); slice.putLong(msg.requestId()); -- 1.9.3 (Apple Git-50) From 865c42867e60ab9b8abb703911bd9ff8ca351195 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 13:01:02 -0800 Subject: [PATCH 61/71] IGNITE-61 - Direct marshalling --- .../apache/ignite/client/ClientTestRestServer.java | 6 +++ .../rest/protocols/tcp/TcpRestParserSelfTest.java | 12 +++--- .../apache/ignite/client/GridClientFactory.java | 2 +- .../apache/ignite/client/impl/GridClientImpl.java | 17 ++++---- .../GridClientConnectionManagerAdapter.java | 15 +++++-- .../GridClientConnectionManagerOsImpl.java | 5 ++- .../connection/GridClientNioTcpConnection.java | 31 +++++++------- .../client/router/impl/GridRouterClientImpl.java | 4 +- .../client/router/impl/GridTcpRouterNioParser.java | 6 +++ .../rest/client/message/GridRouterRequest.java | 1 + .../rest/protocols/tcp/GridTcpRestParser.java | 47 +++++++++++++++++++--- .../rest/protocols/tcp/GridTcpRestProtocol.java | 2 +- 12 files changed, 106 insertions(+), 42 deletions(-) diff --git a/modules/clients/src/test/java/org/apache/ignite/client/ClientTestRestServer.java b/modules/clients/src/test/java/org/apache/ignite/client/ClientTestRestServer.java index fbe3dda..017888f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/client/ClientTestRestServer.java +++ b/modules/clients/src/test/java/org/apache/ignite/client/ClientTestRestServer.java @@ -267,6 +267,12 @@ public class ClientTestRestServer { /** */ private final GridClientMarshaller marsh = new GridClientOptimizedMarshaller(); + /** + */ + public TestParser() { + super(false); + } + /** {@inheritDoc} */ @Override protected GridClientMarshaller marshaller(GridNioSession ses) { return marsh; diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/TcpRestParserSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/TcpRestParserSelfTest.java index 070441d..2a7263f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/TcpRestParserSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/TcpRestParserSelfTest.java @@ -56,7 +56,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { public void testSimplePacketParsing() throws Exception { GridNioSession ses = new MockNioSession(); - GridTcpRestParser parser = new GridTcpRestParser(); + GridTcpRestParser parser = new GridTcpRestParser(false); byte hdr = MEMCACHE_REQ_FLAG; @@ -91,7 +91,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { public void testIncorrectPackets() throws Exception { final GridNioSession ses = new MockNioSession(); - final GridTcpRestParser parser = new GridTcpRestParser(); + final GridTcpRestParser parser = new GridTcpRestParser(false); final byte[] opaque = new byte[] {0x01, 0x02, 0x03, (byte)0xFF}; @@ -151,7 +151,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); - GridTcpRestParser parser = new GridTcpRestParser(); + GridTcpRestParser parser = new GridTcpRestParser(false); GridClientMessage msg = parser.decode(ses, raw); @@ -180,7 +180,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { ses1.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses2.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); - GridTcpRestParser parser = new GridTcpRestParser(); + GridTcpRestParser parser = new GridTcpRestParser(false); GridClientCacheRequest req = new GridClientCacheRequest(CAS); @@ -266,7 +266,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); - GridTcpRestParser parser = new GridTcpRestParser(); + GridTcpRestParser parser = new GridTcpRestParser(false); Collection lst = new ArrayList<>(5); @@ -308,7 +308,7 @@ public class TcpRestParserSelfTest extends GridCommonAbstractTest { ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); - GridTcpRestParser parser = new GridTcpRestParser(); + GridTcpRestParser parser = new GridTcpRestParser(false); Collection lst = new ArrayList<>(1); diff --git a/modules/core/src/main/java/org/apache/ignite/client/GridClientFactory.java b/modules/core/src/main/java/org/apache/ignite/client/GridClientFactory.java index 647155e..339a9f7 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/GridClientFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/client/GridClientFactory.java @@ -54,7 +54,7 @@ public class GridClientFactory { try { UUID clientId = UUID.randomUUID(); - GridClientImpl client = new GridClientImpl(clientId, cfg); + GridClientImpl client = new GridClientImpl(clientId, cfg, false); GridClientImpl old = openClients.putIfAbsent(clientId, client); diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientImpl.java b/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientImpl.java index 8f64a79..43b8d20 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/GridClientImpl.java @@ -103,12 +103,13 @@ public class GridClientImpl implements GridClient { * * @param id Client identifier. * @param cfg0 Client configuration. + * @param routerClient Router client flag. * @throws GridClientException If client configuration is incorrect. * @throws GridServerUnreachableException If none of the servers specified in configuration can * be reached. */ @SuppressWarnings("CallToThreadStartDuringObjectConstruction") - public GridClientImpl(UUID id, GridClientConfiguration cfg0) throws GridClientException { + public GridClientImpl(UUID id, GridClientConfiguration cfg0, boolean routerClient) throws GridClientException { this.id = id; cfg = new GridClientConfiguration(cfg0); @@ -158,7 +159,7 @@ public class GridClientImpl implements GridClient { throw new GridClientException("Servers addresses and routers addresses cannot both be provided " + "for client (please fix configuration and restart): " + this); - connMgr = createConnectionManager(id, sslCtx, cfg, routers, top, null); + connMgr = createConnectionManager(id, sslCtx, cfg, routers, top, null, routerClient); try { // Init connection manager, it should cause topology update. @@ -385,8 +386,9 @@ public class GridClientImpl implements GridClient { * @return New connection manager based on current client settings. * @throws GridClientException If failed to start connection server. */ - public GridClientConnectionManager newConnectionManager(@Nullable Byte marshId) throws GridClientException { - return createConnectionManager(id, sslCtx, cfg, routers, top, marshId); + public GridClientConnectionManager newConnectionManager(@Nullable Byte marshId, boolean routerClient) + throws GridClientException { + return createConnectionManager(id, sslCtx, cfg, routers, top, marshId, routerClient); } /** @@ -399,7 +401,7 @@ public class GridClientImpl implements GridClient { */ private GridClientConnectionManager createConnectionManager(UUID clientId, SSLContext sslCtx, GridClientConfiguration cfg, Collection routers, GridClientTopology top, - @Nullable Byte marshId) + @Nullable Byte marshId, boolean routerClient) throws GridClientException { GridClientConnectionManager mgr; @@ -409,10 +411,11 @@ public class GridClientImpl implements GridClient { Constructor cons = cls.getConstructor(UUID.class, SSLContext.class, GridClientConfiguration.class, Collection.class, GridClientTopology.class, Byte.class); - mgr = (GridClientConnectionManager)cons.newInstance(clientId, sslCtx, cfg, routers, top, marshId); + mgr = (GridClientConnectionManager)cons.newInstance(clientId, sslCtx, cfg, routers, top, marshId, + routerClient); } catch (ClassNotFoundException ignored) { - mgr = new GridClientConnectionManagerOsImpl(clientId, sslCtx, cfg, routers, top, marshId); + mgr = new GridClientConnectionManagerOsImpl(clientId, sslCtx, cfg, routers, top, marshId, routerClient); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new GridClientException("Failed to create client connection manager.", e); diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java index 6cecef0..ff9bdf7 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -110,7 +110,8 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio GridClientConfiguration cfg, Collection routers, GridClientTopology top, - @Nullable Byte marshId) + @Nullable Byte marshId, + boolean routerClient) throws GridClientException { assert clientId != null : "clientId != null"; assert cfg != null : "cfg != null"; @@ -142,7 +143,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio GridNioFilter[] filters; - GridNioFilter codecFilter = new GridNioCodecFilter(new GridTcpRestParser(), gridLog, false); + GridNioFilter codecFilter = new GridNioCodecFilter(new GridTcpRestParser(routerClient), gridLog, false); if (sslCtx != null) { GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog); @@ -595,8 +596,14 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio if (msg instanceof GridClientPingPacket) conn.handlePingResponse(); - else - conn.handleResponse((GridClientMessage)msg); + else { + try { + conn.handleResponse((GridClientMessage)msg); + } + catch (IOException e) { + log.log(Level.SEVERE, "Failed to parse response.", e); + } + } } } diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java index f2d4506..a9bd80e 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerOsImpl.java @@ -36,8 +36,9 @@ public class GridClientConnectionManagerOsImpl extends GridClientConnectionManag * @throws GridClientException In case of error. */ public GridClientConnectionManagerOsImpl(UUID clientId, SSLContext sslCtx, GridClientConfiguration cfg, - Collection routers, GridClientTopology top, Byte marshId) throws GridClientException { - super(clientId, sslCtx, cfg, routers, top, marshId); + Collection routers, GridClientTopology top, Byte marshId, boolean routerClient) + throws GridClientException { + super(clientId, sslCtx, cfg, routers, top, marshId, routerClient); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java index 3cead45..03fa95d 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientNioTcpConnection.java @@ -461,7 +461,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { * @param res Incoming response data. */ @SuppressWarnings({"unchecked", "TooBroadScope"}) - void handleResponse(GridClientMessage res) { + void handleResponse(GridClientMessage res) throws IOException { lastMsgRcvTime = U.currentTimeMillis(); TcpClientFuture fut = pendingReqs.get(res.requestId()); @@ -474,22 +474,25 @@ public class GridClientNioTcpConnection extends GridClientConnection { } if (fut.forward()) { - // TODO: IGNITE-61 -// GridRouterResponse msg = new GridRouterResponse( -// res.messageArray(), -// res.requestId(), -// clientId, -// res.destinationId()); -// -// removePending(msg.requestId()); -// -// fut.onDone(msg); + removePending(res.requestId()); + + fut.onDone(res); } else { - if (res instanceof GridClientResponse) - handleClientResponse(fut, (GridClientResponse)res); + GridClientMessage res0 = res; + + if (res instanceof GridRouterResponse) { + res0 = marsh.unmarshal(((GridRouterResponse)res).body()); + + res0.requestId(res.requestId()); + res0.clientId(res.clientId()); + res0.destinationId(res.destinationId()); + } + + if (res0 instanceof GridClientResponse) + handleClientResponse(fut, (GridClientResponse)res0); else - log.warning("Unsupported response type received: " + res); + log.warning("Unsupported response type received: " + res0); } } diff --git a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterClientImpl.java b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterClientImpl.java index 0d7f74d..1b34346 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterClientImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterClientImpl.java @@ -60,7 +60,7 @@ class GridRouterClientImpl implements GridClient { this.cliCfg = cliCfg; - clientImpl = new GridClientImpl(id, cliCfg); + clientImpl = new GridClientImpl(id, cliCfg, true); if (cliCfg.getProtocol() != GridClientProtocol.TCP) throw new AssertionError("Unknown protocol: " + cliCfg.getProtocol()); @@ -136,7 +136,7 @@ class GridRouterClientImpl implements GridClient { if (mgr == null) { GridClientConnectionManager old = connMgrMap.putIfAbsent(marshId, mgr = - clientImpl.newConnectionManager(marshId)); + clientImpl.newConnectionManager(marshId, true)); if (old != null) mgr = old; diff --git a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterNioParser.java b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterNioParser.java index 231b0f5..129406d 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterNioParser.java +++ b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterNioParser.java @@ -39,6 +39,12 @@ class GridTcpRouterNioParser extends GridTcpRestParser { /** Number of sent messages. */ private volatile long sndCnt; + /** + */ + public GridTcpRouterNioParser() { + super(false); + } + /** {@inheritDoc} */ @Override protected GridClientMessage parseClientMessage(GridNioSession ses, ParserState state) { rcvCnt++; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterRequest.java index 34efcf6..6dcbf92 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterRequest.java @@ -37,6 +37,7 @@ public class GridRouterRequest extends GridClientAbstractMessage { */ public GridRouterRequest(byte[] body, Long reqId, UUID clientId, UUID destId) { this.body = body; + destinationId(destId); clientId(clientId); requestId(reqId); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java index 978ae61..03322d1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java @@ -45,6 +45,16 @@ public class GridTcpRestParser implements GridNioParser { /** JDK marshaller. */ private final Marshaller jdkMarshaller = new JdkMarshaller(); + /** Router client flag. */ + private final boolean routerClient; + + /** + * @param routerClient Router client flag. + */ + public GridTcpRestParser(boolean routerClient) { + this.routerClient = routerClient; + } + /** {@inheritDoc} */ @Nullable @Override public GridClientMessage decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException { @@ -153,6 +163,22 @@ public class GridTcpRestParser implements GridNioParser { IGNITE_HANDSHAKE_RES_FLAG, ((GridClientHandshakeResponse)msg).resultCode() }); + else if (msg instanceof GridRouterRequest) { + byte[] body = ((GridRouterRequest)msg).body(); + + ByteBuffer buf = ByteBuffer.allocate(45 + body.length); + + buf.put(IGNITE_REQ_FLAG); + buf.putInt(40 + body.length); + buf.putLong(msg.requestId()); + buf.put(U.uuidToBytes(msg.clientId())); + buf.put(U.uuidToBytes(msg.destinationId())); + buf.put(body); + + buf.flip(); + + return buf; + } else { GridClientMarshaller marsh = marshaller(ses); @@ -455,13 +481,24 @@ public class GridTcpRestParser implements GridNioParser { * @throws IgniteCheckedException If no marshaller was defined for the session. */ protected GridClientMessage parseClientMessage(GridNioSession ses, ParserState state) throws IOException, IgniteCheckedException { - GridClientMarshaller marsh = marshaller(ses); + GridClientMessage msg; + + if (routerClient) { + msg = new GridRouterResponse( + state.buffer().toByteArray(), + state.header().reqId(), + state.header().clientId(), + state.header().destinationId()); + } + else { + GridClientMarshaller marsh = marshaller(ses); - GridClientMessage msg = marsh.unmarshal(state.buffer().toByteArray()); + msg = marsh.unmarshal(state.buffer().toByteArray()); - msg.requestId(state.header().reqId()); - msg.clientId(state.header().clientId()); - msg.destinationId(state.header().destinationId()); + msg.requestId(state.header().reqId()); + msg.clientId(state.header().clientId()); + msg.destinationId(state.header().destinationId()); + } return msg; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java index 19971e1..7482a79 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java @@ -106,7 +106,7 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter { lsnr = new GridTcpRestNioListener(log, this, hnd, ctx); - GridNioParser parser = new GridTcpRestParser(); + GridNioParser parser = new GridTcpRestParser(false); try { host = resolveRestTcpHost(ctx.config()); -- 1.9.3 (Apple Git-50) From 4ef1baea4c95a42ab6744516a18919ee29b4fee0 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 15:06:51 -0800 Subject: [PATCH 62/71] IGNITE-61 - Direct marshalling --- .../client/impl/connection/GridClientConnectionManagerAdapter.java | 2 +- .../internal/processors/rest/client/message/GridClientPingPacket.java | 4 +++- .../internal/processors/rest/client/message/GridRouterResponse.java | 2 +- .../processors/rest/protocols/tcp/GridTcpRestNioListener.java | 4 ++-- .../internal/processors/rest/protocols/tcp/GridTcpRestParser.java | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java index ff9bdf7..b689b9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -170,7 +170,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio .socketReceiveBufferSize(0) .socketSendBufferSize(0) .idleTimeout(Long.MAX_VALUE) - .gridName("gridClient") + .gridName(routerClient ? "routerClient" : "gridClient") .daemon(cfg.isDaemon()) .build(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacket.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacket.java index fef8a8d..90235df 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacket.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacket.java @@ -17,6 +17,8 @@ package org.apache.ignite.internal.processors.rest.client.message; +import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage.*; + /** * Fictive ping packet. */ @@ -28,7 +30,7 @@ public class GridClientPingPacket extends GridClientAbstractMessage { public static final GridClientMessage PING_MESSAGE = new GridClientPingPacket(); /** Ping packet. */ - public static final byte[] PING_PACKET = new byte[] {(byte)0x90, 0x00, 0x00, 0x00, 0x00}; + public static final byte[] PING_PACKET = new byte[] {IGNITE_REQ_FLAG, 0x00, 0x00, 0x00, 0x00}; /** {@inheritDoc} */ @Override public String toString() { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterResponse.java index ce5104c..2ff3e21 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridRouterResponse.java @@ -74,7 +74,7 @@ public class GridRouterResponse extends GridClientAbstractMessage { /** {@inheritDoc} */ @Override public String toString() { - return "GridRoutedResponse [" + + return "GridRouterResponse [" + "clientId=" + clientId() + ", reqId=" + requestId() + ", destId=" + destinationId() + diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java index 159f178..ba4a2ac 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestNioListener.java @@ -134,8 +134,8 @@ public class GridTcpRestNioListener extends GridNioServerListenerAdapter Date: Mon, 9 Feb 2015 15:11:54 -0800 Subject: [PATCH 63/71] IGNITE-209 - Fixed tests. --- .../cache/GridCacheAbstractFullApiSelfTest.java | 41 +++-- ...heAtomicClientOnlyMultiNodeFullApiSelfTest.java | 10 ++ .../GridCacheNearOnlyMultiNodeFullApiSelfTest.java | 185 +++++++++++++++++++++ 3 files changed, 222 insertions(+), 14 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 7d26d87..c468b13 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -2957,8 +2957,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** * @throws Exception If failed. */ - // TODO: IGNITE-209: Enable when fixed. - public void _testTtlTx() throws Exception { + public void testTtlTx() throws Exception { if (txEnabled()) checkTtl(true, false); } @@ -2966,8 +2965,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** * @throws Exception If failed. */ - // TODO: IGNITE-209: Enable when fixed. - public void _testTtlNoTx() throws Exception { + public void testTtlNoTx() throws Exception { checkTtl(false, false); } @@ -3009,7 +3007,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract IgniteTx tx = transactions().txStart(); try { - grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1); + jcache().withExpiryPolicy(expiry).put(key, 1); } finally { tx.rollback(); @@ -3023,11 +3021,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract IgniteTx tx = inTx ? transactions().txStart() : null; try { - grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1); + jcache().withExpiryPolicy(expiry).put(key, 1); + + if (tx != null) + tx.commit(); } finally { if (tx != null) - tx.commit(); + tx.close(); } long[] expireTimes = new long[gridCount()]; @@ -3050,11 +3051,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx = inTx ? transactions().txStart() : null; try { - grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 2); + jcache().withExpiryPolicy(expiry).put(key, 2); + + if (tx != null) + tx.commit(); } finally { if (tx != null) - tx.commit(); + tx.close(); } for (int i = 0; i < gridCount(); i++) { @@ -3075,11 +3079,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx = inTx ? transactions().txStart() : null; try { - grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 3); + jcache().withExpiryPolicy(expiry).put(key, 3); + + if (tx != null) + tx.commit(); } finally { if (tx != null) - tx.commit(); + tx.close(); } for (int i = 0; i < gridCount(); i++) { @@ -3102,11 +3109,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx = inTx ? transactions().txStart() : null; try { - c.put(key, 4); + jcache().put(key, 4); + + if (tx != null) + tx.commit(); } finally { if (tx != null) - tx.commit(); + tx.close(); } log.info("Put 4 done"); @@ -3166,10 +3176,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract try { entry.set(10); + + if (tx != null) + tx.commit(); } finally { if (tx != null) - tx.commit(); + tx.close(); } U.sleep(2000); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java index 17aa98c..8c18258 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java @@ -72,6 +72,16 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache } /** {@inheritDoc} */ + @Override public void testReaderTtlNoTx() throws Exception { + // No-op. + } + + /** {@inheritDoc} */ + @Override public void testReaderTtlTx() throws Exception { + // No-op. + } + + /** {@inheritDoc} */ @Override public void testSize() throws Exception { IgniteCache cache = jcache(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java index bc83d15..99d27d6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java @@ -24,15 +24,20 @@ import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.transactions.*; +import javax.cache.expiry.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; @@ -183,6 +188,186 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio // TODO fix this test for client mode. } + /** + * @throws Exception If failed. + */ + public void testReaderTtlTx() throws Exception { + checkReaderTtl(true); + } + + /** + * @throws Exception If failed. + */ + public void testReaderTtlNoTx() throws Exception { + checkReaderTtl(false); + } + + /** + * + * @throws Exception + */ + private void checkReaderTtl(boolean inTx) throws Exception { + int ttl = 1000; + + final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl)); + + final GridCache c = cache(); + + final String key = primaryKeysForCache(jcache(), 1).get(0); + + c.put(key, 1); + + CacheEntry entry = c.entry(key); + + assert entry != null; + + assertEquals(0, entry.timeToLive()); + assertEquals(0, entry.expirationTime()); + + long startTime = System.currentTimeMillis(); + + int fullIdx = nearIdx == 0 ? 1 : 0; + + // Now commit transaction and check that ttl and expire time have been saved. + IgniteTx tx = inTx ? grid(fullIdx).transactions().txStart() : null; + + try { + jcache(fullIdx).withExpiryPolicy(expiry).put(key, 1); + + if (tx != null) + tx.commit(); + } + finally { + if (tx != null) + tx.close(); + } + + long[] expireTimes = new long[gridCount()]; + + for (int i = 0; i < gridCount(); i++) { + CacheEntry curEntry = cache(i).entry(key); + + if (curEntry.primary() || curEntry.backup() || i == nearIdx) { + assertEquals(ttl, curEntry.timeToLive()); + + assert curEntry.expirationTime() > startTime; + + expireTimes[i] = curEntry.expirationTime(); + } + } + + // One more update from the same cache entry to ensure that expire time is shifted forward. + U.sleep(100); + + tx = inTx ? grid(fullIdx).transactions().txStart() : null; + + try { + jcache(fullIdx).withExpiryPolicy(expiry).put(key, 2); + + if (tx != null) + tx.commit(); + } + finally { + if (tx != null) + tx.close(); + } + + for (int i = 0; i < gridCount(); i++) { + CacheEntry curEntry = cache(i).entry(key); + + if (curEntry.primary() || curEntry.backup() || i == nearIdx) { + assertEquals(ttl, curEntry.timeToLive()); + + assert curEntry.expirationTime() > expireTimes[i]; + + expireTimes[i] = curEntry.expirationTime(); + } + } + + // And one more update to ensure that ttl is not changed and expire time is not shifted forward. + U.sleep(100); + + tx = inTx ? grid(fullIdx).transactions().txStart() : null; + + try { + jcache(fullIdx).put(key, 4); + } + finally { + if (tx != null) + tx.commit(); + } + + for (int i = 0; i < gridCount(); i++) { + CacheEntry curEntry = cache(i).entry(key); + + if (curEntry.primary() || curEntry.backup() || i == nearIdx) { + assertEquals(ttl, curEntry.timeToLive()); + assertEquals(expireTimes[i], curEntry.expirationTime()); + } + } + + // Avoid reloading from store. + map.remove(key); + + assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicateX() { + @SuppressWarnings("unchecked") + @Override public boolean applyx() throws IgniteCheckedException { + try { + Integer val = c.get(key); + + if (val != null) { + info("Value is in cache [key=" + key + ", val=" + val + ']'); + + return false; + } + + // Get "cache" field from GridCacheProxyImpl. + GridCacheAdapter c0 = GridTestUtils.getFieldValue(c, "cache"); + + if (!c0.context().deferredDelete()) { + GridCacheEntryEx e0 = c0.peekEx(key); + + return e0 == null || (e0.rawGet() == null && e0.valueBytes() == null); + } + else + return true; + } + catch (GridCacheEntryRemovedException e) { + throw new RuntimeException(e); + } + } + }, Math.min(ttl * 10, getTestTimeout()))); + + // Ensure that old TTL and expire time are not longer "visible". + entry = c.entry(key); + + assert entry.get() == null; + + assertEquals(0, entry.timeToLive()); + assertEquals(0, entry.expirationTime()); + + // Ensure that next update will not pick old expire time. + + tx = inTx ? c.txStart() : null; + + try { + entry.set(10); + } + finally { + if (tx != null) + tx.commit(); + } + + U.sleep(2000); + + entry = c.entry(key); + + assertEquals((Integer)10, entry.get()); + + assertEquals(0, entry.timeToLive()); + assertEquals(0, entry.expirationTime()); + } + /** {@inheritDoc} */ @Override public void testClear() throws Exception { IgniteCache nearCache = jcache(); -- 1.9.3 (Apple Git-50) From 6f27726d8e0a5f48189ee8dafc0e26367df9c8aa Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 15:21:18 -0800 Subject: [PATCH 64/71] IGNITE-61 - Direct marshalling --- .../org/apache/ignite/client/integration/ClientAbstractSelfTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractSelfTest.java index de5b0e9..eb53821 100644 --- a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientAbstractSelfTest.java @@ -434,7 +434,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest { info(">>> First task executed successfully, running batch."); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 10; i++) futs.add(compute.executeAsync(taskName, taskArg)); // Stop client. -- 1.9.3 (Apple Git-50) From 6c11ac03393043ed5278392473dbbfb1825f3762 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 16:24:19 -0800 Subject: [PATCH 65/71] # IGNITE-61 - Fixed future for removeAllAsync --- .../processors/cache/distributed/GridDistributedCacheAdapter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java index 3f020b1..eea1df1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java @@ -22,7 +22,6 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; -import org.apache.ignite.internal.compute.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; @@ -161,7 +160,7 @@ public abstract class GridDistributedCacheAdapter extends GridCacheAdapter /** {@inheritDoc} */ @Override public IgniteInternalFuture removeAllAsync() { - GridFutureAdapter opFut = new GridFutureAdapter<>(); + GridFutureAdapter opFut = new GridFutureAdapter<>(ctx.kernalContext()); long topVer = ctx.affinity().affinityTopologyVersion(); -- 1.9.3 (Apple Git-50) From 1023cd1425aff3b91d7c74bfa6d268ee7f8c4dce Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 17:59:36 -0800 Subject: [PATCH 66/71] IGNITE-61 - Direct marshalling (fixes after review) --- .../internal/managers/GridManagerAdapter.java | 4 +- .../managers/communication/GridIoManager.java | 33 +++++++--------- .../communication/GridIoMessageFactory.java | 12 +++--- .../ignite/internal/util/ipc/IpcToNioAdapter.java | 10 ++--- .../ignite/internal/util/nio/GridDirectParser.java | 17 +++----- .../ignite/internal/util/nio/GridNioServer.java | 33 ++++++---------- .../util/nio/GridShmemCommunicationClient.java | 10 ++--- .../util/nio/GridTcpCommunicationClient.java | 10 ++--- .../extensions/communication/MessageFormatter.java | 39 +++++++++++++++++++ .../communication/MessageReaderFactory.java | 35 ----------------- .../communication/MessageWriterFactory.java | 35 ----------------- .../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 8 ++-- .../spi/communication/tcp/TcpCommunicationSpi.java | 45 +++++++++++++++++++--- .../ignite/testframework/GridSpiTestContext.java | 14 +++---- .../IgniteProjectionStartStopRestartSelfTest.java | 4 +- 16 files changed, 149 insertions(+), 162 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java delete mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java index f321386..771b352 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java @@ -527,8 +527,8 @@ public abstract class GridManagerAdapter implements GridMan } } - @Override public MessageWriterFactory messageWriterFactory() { - return ctx.io().messageWriterFactory(); + @Override public MessageFormatter messageFormatter() { + return ctx.io().formatter(); } @Override public MessageFactory messageFactory() { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 60bc12a..e53691d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -135,7 +135,7 @@ public class GridIoManager extends GridManagerAdapter 0) - writerFactory = writerExt[0]; + if (formatterExt != null && formatterExt.length > 0) { + if (formatterExt.length > 1) + throw new IgniteCheckedException("More than one MessageFormatter extension is defined. Check your " + + "plugins configuration and make sure that only one of them provides custom message format."); + + formatter = formatterExt[0]; + } else { - writerFactory = new MessageWriterFactory() { + formatter = new MessageFormatter() { @Override public MessageWriter writer() { return new DirectMessageWriter(); } - }; - } - MessageReaderFactory readerFactory; - - MessageReaderFactory[] readerExt = ctx.plugins().extensions(MessageReaderFactory.class); - - if (readerExt != null && readerExt.length > 0) - readerFactory = readerExt[0]; - else { - readerFactory = new MessageReaderFactory() { @Override public MessageReader reader() { return new DirectMessageReader(msgFactory); } }; } - msgFactory = new GridIoMessageFactory(readerFactory, ctx.plugins().extensions(MessageFactory.class)); + msgFactory = new GridIoMessageFactory(formatter, ctx.plugins().extensions(MessageFactory.class)); if (log.isDebugEnabled()) log.debug(startInfo()); 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 c1c2c54..e8481f1 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 @@ -53,19 +53,19 @@ public class GridIoMessageFactory implements MessageFactory { private static final Map> CUSTOM = new ConcurrentHashMap8<>(); /** Message reader factory. */ - private final MessageReaderFactory readerFactory; + private final MessageFormatter formatter; /** Extensions. */ private final MessageFactory[] ext; /** - * @param readerFactory Message reader factory. + * @param formatter Message formatter. * @param ext Extensions. */ - public GridIoMessageFactory(MessageReaderFactory readerFactory, MessageFactory[] ext) { - assert readerFactory != null; + public GridIoMessageFactory(MessageFormatter formatter, MessageFactory[] ext) { + assert formatter != null; - this.readerFactory = readerFactory; + this.formatter = formatter; this.ext = ext; } @@ -524,7 +524,7 @@ public class GridIoMessageFactory implements MessageFactory { if (msg == null) throw new IgniteException("Invalid message type: " + type); - msg.setReader(readerFactory.reader()); + msg.setReader(formatter.reader()); return msg; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java index 67c2eae..388c38f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java @@ -54,23 +54,23 @@ public class IpcToNioAdapter { private final GridNioMetricsListener metricsLsnr; /** */ - private final MessageWriterFactory writerFactory; + private final MessageFormatter formatter; /** * @param metricsLsnr Metrics listener. * @param log Log. * @param endp Endpoint. * @param lsnr Listener. - * @param writerFactory Message writer factory. + * @param formatter Message formatter. * @param filters Filters. */ public IpcToNioAdapter(GridNioMetricsListener metricsLsnr, IgniteLogger log, IpcEndpoint endp, - GridNioServerListener lsnr, MessageWriterFactory writerFactory, GridNioFilter... filters) { + GridNioServerListener lsnr, MessageFormatter formatter, GridNioFilter... filters) { assert metricsLsnr != null; this.metricsLsnr = metricsLsnr; this.endp = endp; - this.writerFactory = writerFactory; + this.formatter = formatter; chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters); ses = new GridNioSessionImpl(chain, null, null, true); @@ -152,7 +152,7 @@ public class IpcToNioAdapter { assert writeBuf.hasArray(); try { - msg.setWriter(writerFactory.writer()); + msg.setWriter(formatter.writer()); int cnt = U.writeMessageFully(msg, endp.outputStream(), writeBuf); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java index 021aa91..3b00bd9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.spi.*; import org.jetbrains.annotations.*; import java.io.*; @@ -33,23 +32,19 @@ public class GridDirectParser implements GridNioParser { private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); /** */ - private IgniteSpiAdapter spi; - - /** */ - private MessageFactory msgFactory; + private final MessageFactory msgFactory; /** - * @param spi Spi. + * @param msgFactory Message factory. */ - public GridDirectParser(IgniteSpiAdapter spi) { - this.spi = spi; + public GridDirectParser(MessageFactory msgFactory) { + assert msgFactory != null; + + this.msgFactory = msgFactory; } /** {@inheritDoc} */ @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException { - if (msgFactory == null) - msgFactory = spi.getSpiContext().messageFactory(); - MessageAdapter msg = ses.removeMeta(MSG_META_KEY); if (msg == null && buf.hasRemaining()) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java index 4a2e2e4..ffa345d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java @@ -28,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; -import org.apache.ignite.spi.*; import org.apache.ignite.thread.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -140,10 +139,7 @@ public class GridNioServer { /** */ @GridToStringExclude - private IgniteSpiAdapter spi; - - /** */ - private MessageWriterFactory messageWriterFactory; + private MessageFormatter formatter; /** Static initializer ensures single-threaded execution of workaround. */ static { @@ -172,6 +168,7 @@ public class GridNioServer { * @param directMode Whether direct mode is used. * @param daemon Daemon flag to create threads. * @param metricsLsnr Metrics listener. + * @param formatter Message formatter. * @param filters Filters for this server. * @throws IgniteCheckedException If failed. */ @@ -191,7 +188,7 @@ public class GridNioServer { boolean directMode, boolean daemon, GridNioMetricsListener metricsLsnr, - IgniteSpiAdapter spi, + MessageFormatter formatter, GridNioFilter... filters ) throws IgniteCheckedException { A.notNull(addr, "addr"); @@ -256,7 +253,7 @@ public class GridNioServer { this.directMode = directMode; this.metricsLsnr = metricsLsnr; - this.spi = spi; + this.formatter = formatter; } /** @@ -1023,10 +1020,7 @@ public class GridNioServer { assert msg != null; - if (messageWriterFactory == null) - messageWriterFactory = spi.getSpiContext().messageWriterFactory(); - - msg.setWriter(messageWriterFactory.writer()); + msg.setWriter(formatter.writer()); finished = msg.writeTo(buf); } @@ -1047,10 +1041,7 @@ public class GridNioServer { assert msg != null; - if (messageWriterFactory == null) - messageWriterFactory = spi.getSpiContext().messageWriterFactory(); - - msg.setWriter(messageWriterFactory.writer()); + msg.setWriter(formatter.writer()); finished = msg.writeTo(buf); } @@ -2078,8 +2069,8 @@ public class GridNioServer { /** Daemon flag. */ private boolean daemon; - /** SPI. */ - private IgniteSpiAdapter spi; + /** Message formatter. */ + private MessageFormatter formatter; /** * Finishes building the instance. @@ -2104,7 +2095,7 @@ public class GridNioServer { directMode, daemon, metricsLsnr, - spi, + formatter, filters != null ? Arrays.copyOf(filters, filters.length) : EMPTY_FILTERS ); @@ -2299,11 +2290,11 @@ public class GridNioServer { } /** - * @param spi SPI. + * @param formatter Message formatter. * @return This for chaining. */ - public Builder spi(IgniteSpiAdapter spi) { - this.spi = spi; + public Builder messageFormatter(MessageFormatter formatter) { + this.formatter = formatter; return this; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java index c3c9a92..2add325 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java @@ -39,18 +39,18 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien private final ByteBuffer writeBuf; /** */ - private final MessageWriterFactory writerFactory; + private final MessageFormatter formatter; /** * @param metricsLsnr Metrics listener. * @param port Shared memory IPC server port. * @param connTimeout Connection timeout. * @param log Logger. - * @param writerFactory Message writer factory. + * @param formatter Message formatter. * @throws IgniteCheckedException If failed. */ public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout, - IgniteLogger log, MessageWriterFactory writerFactory) throws IgniteCheckedException { + IgniteLogger log, MessageFormatter formatter) throws IgniteCheckedException { super(metricsLsnr); assert metricsLsnr != null; @@ -63,7 +63,7 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien writeBuf.order(ByteOrder.nativeOrder()); - this.writerFactory = writerFactory; + this.formatter = formatter; } /** {@inheritDoc} */ @@ -116,7 +116,7 @@ public class GridShmemCommunicationClient extends GridAbstractCommunicationClien assert writeBuf.hasArray(); try { - msg.setWriter(writerFactory.writer()); + msg.setWriter(formatter.writer()); int cnt = U.writeMessageFully(msg, shmem.outputStream(), writeBuf); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java index 561547d..fd2aeb9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java @@ -49,7 +49,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient private final ByteBuffer writeBuf; /** */ - private final MessageWriterFactory writerFactory; + private final MessageFormatter formatter; /** * @param metricsLsnr Metrics listener. @@ -62,7 +62,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient * @param bufSize Buffer size (or {@code 0} to disable buffer). * @param minBufferedMsgCnt Minimum buffered message count. * @param bufSizeRatio Communication buffer size ratio. - * @param writerFactory Message writer factory. + * @param formatter Message formatter. * @throws IgniteCheckedException If failed. */ public GridTcpCommunicationClient( @@ -76,7 +76,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient int bufSize, int minBufferedMsgCnt, double bufSizeRatio, - MessageWriterFactory writerFactory + MessageFormatter formatter ) throws IgniteCheckedException { super(metricsLsnr); @@ -93,7 +93,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient this.minBufferedMsgCnt = minBufferedMsgCnt; this.bufSizeRatio = bufSizeRatio; - this.writerFactory = writerFactory; + this.formatter = formatter; writeBuf = ByteBuffer.allocate(8 << 10); @@ -197,7 +197,7 @@ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient assert writeBuf.hasArray(); try { - msg.setWriter(writerFactory.writer()); + msg.setWriter(formatter.writer()); int cnt = U.writeMessageFully(msg, out, writeBuf); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java new file mode 100644 index 0000000..01c0c61 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java @@ -0,0 +1,39 @@ +/* + * 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.plugin.extensions.communication; + +import org.apache.ignite.plugin.*; + +/** + * TODO + */ +public interface MessageFormatter extends Extension { + /** + * Creates new message writer instance. + * + * @return Message writer. + */ + public MessageWriter writer(); + + /** + * Creates new message reader instance. + * + * @return Message reader. + */ + public MessageReader reader(); +} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java deleted file mode 100644 index 4729551..0000000 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReaderFactory.java +++ /dev/null @@ -1,35 +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.plugin.extensions.communication; - -import org.apache.ignite.plugin.*; - -/** - * Factory for message readers. - *

- * A plugin can provide his own message reader factory as - * an extension to define a custom binary format. - */ -public interface MessageReaderFactory extends Extension { - /** - * Creates new message reader instance. - * - * @return Message reader. - */ - public MessageReader reader(); -} diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java deleted file mode 100644 index 1ab04e3..0000000 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriterFactory.java +++ /dev/null @@ -1,35 +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.plugin.extensions.communication; - -import org.apache.ignite.plugin.*; - -/** - * Factory for message writers. - *

- * A plugin can provide his own message writer factory as - * an extension to define a custom binary format. - */ -public interface MessageWriterFactory extends Extension { - /** - * Creates new message writer instance. - * - * @return Message writer. - */ - public MessageWriter writer(); -} diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java index 7a731e5..c4518e6 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java @@ -713,7 +713,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement return null; } - @Override public MessageWriterFactory messageWriterFactory() { + @Override public MessageFormatter messageFormatter() { return null; } diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java index 7f7e25e..5a0a23f 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java @@ -377,13 +377,15 @@ public interface IgniteSpiContext { @Nullable ClassLoader ldr) throws IgniteException; /** - * Gets message writer factory. + * Gets message formatter. * - * @return Message writer factory. + * @return Message formatter. */ - public MessageWriterFactory messageWriterFactory(); + public MessageFormatter messageFormatter(); /** + * Gets message factory. + * * @return Message factory. */ public MessageFactory messageFactory(); diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index e3db36b..2ab05cb 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -1470,6 +1470,41 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter // If configured TCP port is busy, find first available in range. for (int port = locPort; port < locPort + locPortRange; port++) { try { + MessageFactory messageFactory = new MessageFactory() { + private MessageFactory impl; + + @Nullable @Override public MessageAdapter create(byte type) { + if (impl == null) + impl = getSpiContext().messageFactory(); + + assert impl != null; + + return impl.create(type); + } + }; + + MessageFormatter messageFormatter = new MessageFormatter() { + private MessageFormatter impl; + + @Override public MessageWriter writer() { + if (impl == null) + impl = getSpiContext().messageFormatter(); + + assert impl != null; + + return impl.writer(); + } + + @Override public MessageReader reader() { + if (impl == null) + impl = getSpiContext().messageFormatter(); + + assert impl != null; + + return impl.reader(); + } + }; + GridNioServer srvr = GridNioServer.builder() .address(locHost) @@ -1487,9 +1522,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter .directMode(true) .metricsListener(metricsLsnr) .writeTimeout(sockWriteTimeout) - .filters(new GridNioCodecFilter(new GridDirectParser(this), log, true), + .filters(new GridNioCodecFilter(new GridDirectParser(messageFactory), log, true), new GridConnectionBytesVerifyFilter(log)) - .spi(this) + .messageFormatter(messageFormatter) .build(); boundTcpPort = port; @@ -1852,7 +1887,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter try { client = new GridShmemCommunicationClient(metricsLsnr, port, connTimeout, log, - getSpiContext().messageWriterFactory()); + getSpiContext().messageFormatter()); } catch (IgniteCheckedException e) { // Reconnect for the second time, if connection is not established. @@ -2421,8 +2456,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter log, endpoint, srvLsnr, - getSpiContext().messageWriterFactory(), - new GridNioCodecFilter(new GridDirectParser(TcpCommunicationSpi.this), log, true), + getSpiContext().messageFormatter(), + new GridNioCodecFilter(new GridDirectParser(getSpiContext().messageFactory()), log, true), new GridConnectionBytesVerifyFilter(log) ); diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index d91ed13..97cb488 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -505,21 +505,21 @@ public class GridSpiTestContext implements IgniteSpiContext { return null; } - @Override public MessageWriterFactory messageWriterFactory() { - return new MessageWriterFactory() { + @Override public MessageFormatter messageFormatter() { + return new MessageFormatter() { @Override public MessageWriter writer() { return new DirectMessageWriter(); } + + @Override public MessageReader reader() { + throw new UnsupportedOperationException(); + } }; } /** {@inheritDoc} */ @Override public MessageFactory messageFactory() { - return new GridIoMessageFactory(new MessageReaderFactory() { - @Override public MessageReader reader() { - return new DirectMessageReader(null); - } - }, null); + return new GridIoMessageFactory(messageFormatter(), null); } /** diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java index babdbbb..f5a73d8 100644 --- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java +++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java @@ -49,10 +49,10 @@ import static org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.*; @SuppressWarnings("ConstantConditions") public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstractTest { /** */ - private static final String SSH_UNAME = System.getenv("test.ssh.username"); + private static final String SSH_UNAME = "vkulichenko"; /** */ - private static final String SSH_PWD = System.getenv("test.ssh.password"); + private static final String SSH_PWD = "8tQHsaM"; /** */ private static final String SSH_KEY = System.getenv("ssh.key"); -- 1.9.3 (Apple Git-50) From aba3df7e8c6e7d02a346d2ea0cb8b4e2a99704a8 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 18:09:40 -0800 Subject: [PATCH 67/71] # IGNITE-61 - Direct marshalling (fixes after review) --- .../ignite/internal/IgniteProjectionStartStopRestartSelfTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java index f5a73d8..babdbbb 100644 --- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java +++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java @@ -49,10 +49,10 @@ import static org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.*; @SuppressWarnings("ConstantConditions") public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstractTest { /** */ - private static final String SSH_UNAME = "vkulichenko"; + private static final String SSH_UNAME = System.getenv("test.ssh.username"); /** */ - private static final String SSH_PWD = "8tQHsaM"; + private static final String SSH_PWD = System.getenv("test.ssh.password"); /** */ private static final String SSH_KEY = System.getenv("ssh.key"); -- 1.9.3 (Apple Git-50) From 3dab05e1aa5338a0256b5e29a26b2a9684da2a82 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 18:19:56 -0800 Subject: [PATCH 68/71] # IGNITE-61 - JavaDoc --- .../ignite/plugin/extensions/communication/MessageFormatter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java index 01c0c61..796b317 100644 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java +++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFormatter.java @@ -20,7 +20,14 @@ package org.apache.ignite.plugin.extensions.communication; import org.apache.ignite.plugin.*; /** - * TODO + * Provides a custom format for communication messages. + *

+ * A plugin can provide his own message factory as an extension + * to replace default format of communication messages. + *

+ * Note that only one custom formatter is allowed. If two + * plugins provide different formatters, exception will + * be thrown on node startup. */ public interface MessageFormatter extends Extension { /** -- 1.9.3 (Apple Git-50) From 150e25bdf9017cc3b1562b92ed9917efaefa9934 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 18:23:33 -0800 Subject: [PATCH 69/71] IGNITE-61 - Direct marshalling (fixes after review) --- .../managers/discovery/GridDiscoveryManager.java | 17 -------- .../extensions/discovery/DiscoveryCallback.java | 51 ---------------------- 2 files changed, 68 deletions(-) delete mode 100644 modules/core/src/main/java/org/apache/ignite/plugin/extensions/discovery/DiscoveryCallback.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 834e649..39df697 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.extensions.discovery.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.plugin.segmentation.*; import org.apache.ignite.spi.*; @@ -266,11 +265,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { c.updateAlives(node); } - if (type == EVT_NODE_JOINED) { - for (DiscoveryCallback listener : ctx.plugins().extensions(DiscoveryCallback.class)) - listener.beforeNodeJoined(node); - } - // Put topology snapshot into discovery history. // There is no race possible between history maintenance and concurrent discovery // event notifications, since SPI notifies manager about all events from this listener. @@ -369,11 +363,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { topVer.setIfGreater(locNode.order()); - for (DiscoveryCallback listener : ctx.plugins().extensions(DiscoveryCallback.class)) { - listener.onStart(discoCache().remoteNodes()); - listener.onStart(discoCache().daemonNodes()); - } - // Start discovery worker. new IgniteThread(discoWrk).start(); @@ -1416,9 +1405,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { if (hasRslvrs) segChkWrk.scheduleSegmentCheck(); - for (DiscoveryCallback listener : ctx.plugins().extensions(DiscoveryCallback.class)) - listener.onNodeLeft(node); - if (!isDaemon) { if (!isLocDaemon) { if (log.isInfoEnabled()) @@ -1440,9 +1426,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { if (hasRslvrs) segChkWrk.scheduleSegmentCheck(); - for (DiscoveryCallback listener : ctx.plugins().extensions(DiscoveryCallback.class)) - listener.onNodeLeft(node); - if (!isDaemon) { if (!isLocDaemon) { U.warn(log, "Node FAILED: " + node); diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/discovery/DiscoveryCallback.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/discovery/DiscoveryCallback.java deleted file mode 100644 index 3ff848a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/discovery/DiscoveryCallback.java +++ /dev/null @@ -1,51 +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.plugin.extensions.discovery; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.plugin.*; - -import java.util.*; - -/** - * Plugin extension that allows to listen messages from discovery. - * - * TODO 9447: redesign. - */ -public interface DiscoveryCallback extends Extension { - /** - * Handles node start. - * - * @param remoteNodes Remote grid nodes. - */ - public void onStart(Collection remoteNodes); - - /** - * Handles node joined event. - * - * @param node Joined node. - */ - public void beforeNodeJoined(ClusterNode node); - - /** - * Handles node left event. - * - * @param node Left node. - */ - public void onNodeLeft(ClusterNode node); -} -- 1.9.3 (Apple Git-50) From f3c503ed5a5bb04514458d6b422bcb880dd9bbc0 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 19:12:52 -0800 Subject: [PATCH 70/71] # IGNITE-61 - Test fix --- .../ignite/testframework/GridSpiTestContext.java | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java index 97cb488..80b9b96 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java @@ -61,6 +61,12 @@ public class GridSpiTestContext implements IgniteSpiContext { /** */ private final ConcurrentMap cache = new ConcurrentHashMap<>(); + /** */ + private MessageFormatter formatter; + + /** */ + private MessageFactory factory; + /** {@inheritDoc} */ @Override public Collection remoteNodes() { return rmtNodes; @@ -505,21 +511,29 @@ public class GridSpiTestContext implements IgniteSpiContext { return null; } + /** {@inheritDoc} */ @Override public MessageFormatter messageFormatter() { - return new MessageFormatter() { - @Override public MessageWriter writer() { - return new DirectMessageWriter(); - } + if (formatter == null) { + formatter = new MessageFormatter() { + @Override public MessageWriter writer() { + return new DirectMessageWriter(); + } - @Override public MessageReader reader() { - throw new UnsupportedOperationException(); - } - }; + @Override public MessageReader reader() { + return new DirectMessageReader(messageFactory()); + } + }; + } + + return formatter; } /** {@inheritDoc} */ @Override public MessageFactory messageFactory() { - return new GridIoMessageFactory(messageFormatter(), null); + if (factory == null) + factory = new GridIoMessageFactory(messageFormatter(), null); + + return factory; } /** -- 1.9.3 (Apple Git-50) From 34088fc9828e89f4047d1c98ee793a45bde570c2 Mon Sep 17 00:00:00 2001 From: Valentin Kulichenko Date: Mon, 9 Feb 2015 19:30:55 -0800 Subject: [PATCH 71/71] # IGNITE-61 - Generated optimized-classnames.properties --- .../optimized/optimized-classnames.properties | 152 ++++++++++----------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties index bb8aecf..b3ec7fc 100644 --- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties +++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties @@ -96,8 +96,8 @@ org.apache.ignite.cache.query.QueryAffinityPredicate org.apache.ignite.cache.query.QueryContinuousPredicate org.apache.ignite.cache.query.QuerySqlPredicate org.apache.ignite.cache.query.QueryTextPredicate -org.apache.ignite.cache.store.jdbc.JdbcCacheStore$EntryMapping$1 -org.apache.ignite.cache.store.jdbc.JdbcCacheStore$EntryMapping$2 +org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$1 +org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$2 org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect$1 org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect$2 org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect$3 @@ -152,42 +152,41 @@ org.apache.ignite.compute.gridify.aop.GridifyArgumentAdapter org.apache.ignite.compute.gridify.aop.GridifyDefaultRangeTask org.apache.ignite.compute.gridify.aop.GridifyDefaultTask org.apache.ignite.compute.gridify.aop.spring.GridifySpringPointcut$GridifySpringPointcutType -org.apache.ignite.configuration.IgniteDeploymentMode -org.apache.ignite.configuration.TransactionsConfiguration -org.apache.ignite.datastructures.DataStructureRemovedException -org.apache.ignite.events.IgniteAuthenticationEvent -org.apache.ignite.events.IgniteAuthorizationEvent -org.apache.ignite.events.IgniteCacheEvent -org.apache.ignite.events.IgniteCachePreloadingEvent -org.apache.ignite.events.IgniteCacheQueryExecutedEvent -org.apache.ignite.events.IgniteCacheQueryReadEvent -org.apache.ignite.events.IgniteCheckpointEvent -org.apache.ignite.events.IgniteDeploymentEvent -org.apache.ignite.events.IgniteDiscoveryEvent -org.apache.ignite.events.IgniteEventAdapter +org.apache.ignite.configuration.DeploymentMode +org.apache.ignite.configuration.TransactionConfiguration +org.apache.ignite.events.AuthenticationEvent +org.apache.ignite.events.AuthorizationEvent +org.apache.ignite.events.CacheEvent +org.apache.ignite.events.CachePreloadingEvent +org.apache.ignite.events.CacheQueryExecutedEvent +org.apache.ignite.events.CacheQueryReadEvent +org.apache.ignite.events.CheckpointEvent +org.apache.ignite.events.DeploymentEvent +org.apache.ignite.events.DiscoveryEvent +org.apache.ignite.events.EventAdapter org.apache.ignite.events.IgniteFsEvent -org.apache.ignite.events.IgniteJobEvent -org.apache.ignite.events.IgniteLicenseEvent -org.apache.ignite.events.IgniteSecureSessionEvent -org.apache.ignite.events.IgniteSwapSpaceEvent -org.apache.ignite.events.IgniteTaskEvent -org.apache.ignite.fs.IgniteFsConcurrentModificationException -org.apache.ignite.fs.IgniteFsCorruptedFileException -org.apache.ignite.fs.IgniteFsException -org.apache.ignite.fs.IgniteFsFileNotFoundException -org.apache.ignite.fs.IgniteFsGroupDataBlocksKeyMapper -org.apache.ignite.fs.IgniteFsInvalidHdfsVersionException -org.apache.ignite.fs.IgniteFsInvalidPathException -org.apache.ignite.fs.IgniteFsMode -org.apache.ignite.fs.IgniteFsOutOfSpaceException -org.apache.ignite.fs.IgniteFsParentNotDirectoryException -org.apache.ignite.fs.IgniteFsPath -org.apache.ignite.fs.IgniteFsPathAlreadyExistsException -org.apache.ignite.fs.IgniteFsPathSummary -org.apache.ignite.fs.mapreduce.records.IgniteFsByteDelimiterRecordResolver -org.apache.ignite.fs.mapreduce.records.IgniteFsFixedLengthRecordResolver -org.apache.ignite.fs.mapreduce.records.IgniteFsNewLineRecordResolver -org.apache.ignite.fs.mapreduce.records.IgniteFsStringDelimiterRecordResolver +org.apache.ignite.events.JobEvent +org.apache.ignite.events.LicenseEvent +org.apache.ignite.events.SecureSessionEvent +org.apache.ignite.events.SwapSpaceEvent +org.apache.ignite.events.TaskEvent +org.apache.ignite.ignitefs.IgniteFsConcurrentModificationException +org.apache.ignite.ignitefs.IgniteFsCorruptedFileException +org.apache.ignite.ignitefs.IgniteFsException +org.apache.ignite.ignitefs.IgniteFsFileNotFoundException +org.apache.ignite.ignitefs.IgniteFsGroupDataBlocksKeyMapper +org.apache.ignite.ignitefs.IgniteFsInvalidHdfsVersionException +org.apache.ignite.ignitefs.IgniteFsInvalidPathException +org.apache.ignite.ignitefs.IgniteFsMode +org.apache.ignite.ignitefs.IgniteFsOutOfSpaceException +org.apache.ignite.ignitefs.IgniteFsParentNotDirectoryException +org.apache.ignite.ignitefs.IgniteFsPath +org.apache.ignite.ignitefs.IgniteFsPathAlreadyExistsException +org.apache.ignite.ignitefs.IgniteFsPathSummary +org.apache.ignite.ignitefs.mapreduce.records.IgniteFsByteDelimiterRecordResolver +org.apache.ignite.ignitefs.mapreduce.records.IgniteFsFixedLengthRecordResolver +org.apache.ignite.ignitefs.mapreduce.records.IgniteFsNewLineRecordResolver +org.apache.ignite.ignitefs.mapreduce.records.IgniteFsStringDelimiterRecordResolver org.apache.ignite.internal.ClusterGroupAdapter org.apache.ignite.internal.ClusterGroupAdapter$AgeProjection org.apache.ignite.internal.ClusterGroupAdapter$AttributeFilter @@ -243,14 +242,15 @@ org.apache.ignite.internal.IgniteKernal$1 org.apache.ignite.internal.IgniteKernal$6 org.apache.ignite.internal.IgniteKernal$7 org.apache.ignite.internal.IgniteKernal$8 -org.apache.ignite.internal.IgniteManagedImpl org.apache.ignite.internal.IgniteMessagingImpl org.apache.ignite.internal.IgniteSchedulerImpl +org.apache.ignite.internal.IgniteServicesImpl org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$1 org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException org.apache.ignite.internal.cluster.ClusterTopologyCheckedException org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException +org.apache.ignite.internal.direct.DirectByteBufferStream$Type org.apache.ignite.internal.executor.GridExecutorService org.apache.ignite.internal.executor.GridExecutorService$1 org.apache.ignite.internal.executor.GridExecutorService$TaskTerminateListener @@ -292,31 +292,34 @@ org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator org.apache.ignite.internal.processors.cache.GridCacheAdapter$10 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$11$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$11 org.apache.ignite.internal.processors.cache.GridCacheAdapter$12 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$13 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$13$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$14 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$15 org.apache.ignite.internal.processors.cache.GridCacheAdapter$2 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$22$1 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$24 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$25$1 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$24$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$26 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$27$1 org.apache.ignite.internal.processors.cache.GridCacheAdapter$28 org.apache.ignite.internal.processors.cache.GridCacheAdapter$3 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$5 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$61 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$62 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$30 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$6 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$63 org.apache.ignite.internal.processors.cache.GridCacheAdapter$64 org.apache.ignite.internal.processors.cache.GridCacheAdapter$65 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$66 org.apache.ignite.internal.processors.cache.GridCacheAdapter$67 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$68 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$69 org.apache.ignite.internal.processors.cache.GridCacheAdapter$7 org.apache.ignite.internal.processors.cache.GridCacheAdapter$70 -org.apache.ignite.internal.processors.cache.GridCacheAdapter$8 +org.apache.ignite.internal.processors.cache.GridCacheAdapter$73 org.apache.ignite.internal.processors.cache.GridCacheAdapter$9 org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllCallable org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalSizeCallable org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable +org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeCallable org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateGetTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutAndGetTimeStatClosure org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutTimeStatClosure @@ -394,6 +397,7 @@ org.apache.ignite.internal.processors.cache.GridCacheStoreManager$1 org.apache.ignite.internal.processors.cache.GridCacheStoreManager$2 org.apache.ignite.internal.processors.cache.GridCacheStoreManager$3 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$11 +org.apache.ignite.internal.processors.cache.GridCacheSwapManager$14 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$2 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$3 org.apache.ignite.internal.processors.cache.GridCacheSwapManager$4 @@ -426,6 +430,7 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$6 org.apache.ignite.internal.processors.cache.GridCacheUtils$7 org.apache.ignite.internal.processors.cache.GridCacheUtils$8 org.apache.ignite.internal.processors.cache.GridCacheUtils$9 +org.apache.ignite.internal.processors.cache.GridCacheValueBytes org.apache.ignite.internal.processors.cache.GridCacheValueCollection org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1 org.apache.ignite.internal.processors.cache.GridCacheWriteBehindStore$StoreOperation @@ -447,6 +452,7 @@ org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticChec org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxRequest org.apache.ignite.internal.processors.cache.distributed.GridCachePessimisticCheckCommittedTxResponse org.apache.ignite.internal.processors.cache.distributed.GridCacheTtlUpdateRequest +org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter$1 org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter$GlobalRemoveAllCallable org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockCancelledException org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest @@ -638,10 +644,10 @@ org.apache.ignite.internal.processors.cache.dr.GridCacheDrExpirationInfo org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo org.apache.ignite.internal.processors.cache.local.GridLocalLockFuture org.apache.ignite.internal.processors.cache.local.GridLocalTxFuture -org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$3 +org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$10 org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$4 org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$5 -org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$8 +org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$6 org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$9 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedFieldsQueryFuture org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture @@ -885,7 +891,7 @@ org.apache.ignite.internal.processors.fs.IgniteFsFileImpl org.apache.ignite.internal.processors.fs.IgniteFsMetricsAdapter org.apache.ignite.internal.processors.fs.IgniteFsOutputStreamImpl$ReserveSpaceClosure org.apache.ignite.internal.processors.fs.IgniteFsProcessor$1 -org.apache.ignite.internal.processors.fs.IgniteFsProcessor$3 +org.apache.ignite.internal.processors.fs.IgniteFsProcessor$2 org.apache.ignite.internal.processors.fs.IgniteFsTaskArgsImpl org.apache.ignite.internal.processors.hadoop.GridHadoopDefaultJobInfo org.apache.ignite.internal.processors.hadoop.GridHadoopFileBlock @@ -977,15 +983,11 @@ org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest$GridCacheOperation org.apache.ignite.internal.processors.rest.client.message.GridClientGetMetaDataRequest org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeRequest -org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeRequestWrapper org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeResponse -org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeResponseWrapper org.apache.ignite.internal.processors.rest.client.message.GridClientLogRequest -org.apache.ignite.internal.processors.rest.client.message.GridClientMessageWrapper org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean org.apache.ignite.internal.processors.rest.client.message.GridClientNodeMetricsBean org.apache.ignite.internal.processors.rest.client.message.GridClientPingPacket -org.apache.ignite.internal.processors.rest.client.message.GridClientPingPacketWrapper org.apache.ignite.internal.processors.rest.client.message.GridClientPutMetaDataRequest org.apache.ignite.internal.processors.rest.client.message.GridClientResponse org.apache.ignite.internal.processors.rest.client.message.GridClientTaskRequest @@ -1021,7 +1023,6 @@ org.apache.ignite.internal.processors.rest.handlers.top.GridTopologyCommandHandl org.apache.ignite.internal.processors.rest.protocols.http.jetty.GridJettyRestProtocol$1 org.apache.ignite.internal.processors.rest.protocols.tcp.GridClientPacketType org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage -org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessageWrapper org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$1 org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpMemcachedNioListener$2 org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestNioListener$1 @@ -1040,8 +1041,8 @@ org.apache.ignite.internal.processors.service.GridServiceProcessor$AssignmentLis org.apache.ignite.internal.processors.service.GridServiceProcessor$DeploymentListener org.apache.ignite.internal.processors.service.GridServiceProxy org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable -org.apache.ignite.internal.processors.service.ManagedServiceContextImpl -org.apache.ignite.internal.processors.service.ManagedServiceDescriptorImpl +org.apache.ignite.internal.processors.service.ServiceContextImpl +org.apache.ignite.internal.processors.service.ServiceDescriptorImpl org.apache.ignite.internal.processors.streamer.GridStreamerAttributes org.apache.ignite.internal.processors.streamer.GridStreamerCancelRequest org.apache.ignite.internal.processors.streamer.GridStreamerExecutionBatch @@ -1140,9 +1141,6 @@ org.apache.ignite.internal.util.IgniteUtils$6 org.apache.ignite.internal.util.IgniteUtils$7 org.apache.ignite.internal.util.IgniteUtils$8 org.apache.ignite.internal.util.IgniteUtils$9 -org.apache.ignite.internal.util.direct.GridTcpCommunicationMessageAdapter$1 -org.apache.ignite.internal.util.direct.GridTcpCommunicationMessageAdapter$DummyEnum -org.apache.ignite.internal.util.direct.GridTcpCommunicationMessageState$DummyEnum org.apache.ignite.internal.util.future.GridCompoundFuture$1 org.apache.ignite.internal.util.future.GridCompoundFuture$Listener org.apache.ignite.internal.util.future.GridCompoundIdentityFuture @@ -1180,8 +1178,6 @@ org.apache.ignite.internal.util.lang.GridFunc$1 org.apache.ignite.internal.util.lang.GridFunc$10 org.apache.ignite.internal.util.lang.GridFunc$100 org.apache.ignite.internal.util.lang.GridFunc$101 -org.apache.ignite.internal.util.lang.GridFunc$101$1 -org.apache.ignite.internal.util.lang.GridFunc$101$2 org.apache.ignite.internal.util.lang.GridFunc$102 org.apache.ignite.internal.util.lang.GridFunc$102$1 org.apache.ignite.internal.util.lang.GridFunc$102$2 @@ -1192,6 +1188,8 @@ org.apache.ignite.internal.util.lang.GridFunc$104 org.apache.ignite.internal.util.lang.GridFunc$104$1 org.apache.ignite.internal.util.lang.GridFunc$104$2 org.apache.ignite.internal.util.lang.GridFunc$105 +org.apache.ignite.internal.util.lang.GridFunc$105$1 +org.apache.ignite.internal.util.lang.GridFunc$105$2 org.apache.ignite.internal.util.lang.GridFunc$106 org.apache.ignite.internal.util.lang.GridFunc$107 org.apache.ignite.internal.util.lang.GridFunc$108 @@ -1208,22 +1206,22 @@ org.apache.ignite.internal.util.lang.GridFunc$117 org.apache.ignite.internal.util.lang.GridFunc$118 org.apache.ignite.internal.util.lang.GridFunc$119 org.apache.ignite.internal.util.lang.GridFunc$12 +org.apache.ignite.internal.util.lang.GridFunc$120 org.apache.ignite.internal.util.lang.GridFunc$121 -org.apache.ignite.internal.util.lang.GridFunc$122 +org.apache.ignite.internal.util.lang.GridFunc$123 org.apache.ignite.internal.util.lang.GridFunc$124 -org.apache.ignite.internal.util.lang.GridFunc$125 +org.apache.ignite.internal.util.lang.GridFunc$126 org.apache.ignite.internal.util.lang.GridFunc$127 -org.apache.ignite.internal.util.lang.GridFunc$128 org.apache.ignite.internal.util.lang.GridFunc$129 org.apache.ignite.internal.util.lang.GridFunc$13 +org.apache.ignite.internal.util.lang.GridFunc$130 org.apache.ignite.internal.util.lang.GridFunc$131 -org.apache.ignite.internal.util.lang.GridFunc$132 org.apache.ignite.internal.util.lang.GridFunc$133 org.apache.ignite.internal.util.lang.GridFunc$134 org.apache.ignite.internal.util.lang.GridFunc$135 org.apache.ignite.internal.util.lang.GridFunc$136 +org.apache.ignite.internal.util.lang.GridFunc$137 org.apache.ignite.internal.util.lang.GridFunc$138 -org.apache.ignite.internal.util.lang.GridFunc$139 org.apache.ignite.internal.util.lang.GridFunc$14 org.apache.ignite.internal.util.lang.GridFunc$140 org.apache.ignite.internal.util.lang.GridFunc$141 @@ -1251,6 +1249,8 @@ org.apache.ignite.internal.util.lang.GridFunc$160 org.apache.ignite.internal.util.lang.GridFunc$161 org.apache.ignite.internal.util.lang.GridFunc$162 org.apache.ignite.internal.util.lang.GridFunc$163 +org.apache.ignite.internal.util.lang.GridFunc$164 +org.apache.ignite.internal.util.lang.GridFunc$165 org.apache.ignite.internal.util.lang.GridFunc$17 org.apache.ignite.internal.util.lang.GridFunc$18 org.apache.ignite.internal.util.lang.GridFunc$19 @@ -1335,7 +1335,7 @@ org.apache.ignite.internal.util.lang.GridFunc$9 org.apache.ignite.internal.util.lang.GridFunc$90 org.apache.ignite.internal.util.lang.GridFunc$91 org.apache.ignite.internal.util.lang.GridFunc$92 -org.apache.ignite.internal.util.lang.GridFunc$95 +org.apache.ignite.internal.util.lang.GridFunc$93 org.apache.ignite.internal.util.lang.GridFunc$96 org.apache.ignite.internal.util.lang.GridFunc$97 org.apache.ignite.internal.util.lang.GridFunc$98 @@ -1531,14 +1531,13 @@ org.apache.ignite.lang.IgniteFutureTimeoutException org.apache.ignite.lang.IgniteProductVersion org.apache.ignite.lang.IgniteUuid org.apache.ignite.lifecycle.LifecycleEventType -org.apache.ignite.logger.log4j.IgniteLog4jLogger$1 -org.apache.ignite.logger.log4j.IgniteLog4jLogger$2 -org.apache.ignite.logger.log4j.IgniteLog4jLogger$3 -org.apache.ignite.logger.log4j.IgniteLog4jLogger$4 org.apache.ignite.logger.log4j.IgniteLog4jNodeIdFilePath -org.apache.ignite.managed.ManagedServiceConfiguration -org.apache.ignite.marshaller.jdk.IgniteJdkMarshallerDummySerializable -org.apache.ignite.marshaller.optimized.IgniteOptimizedFieldType +org.apache.ignite.logger.log4j.Log4JLogger$1 +org.apache.ignite.logger.log4j.Log4JLogger$2 +org.apache.ignite.logger.log4j.Log4JLogger$3 +org.apache.ignite.logger.log4j.Log4JLogger$4 +org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable +org.apache.ignite.marshaller.optimized.OptimizedFieldType org.apache.ignite.plugin.PluginNotFoundException org.apache.ignite.plugin.PluginValidationException org.apache.ignite.plugin.security.GridSecurityCredentials @@ -1548,6 +1547,7 @@ org.apache.ignite.plugin.security.GridSecuritySubjectType org.apache.ignite.plugin.segmentation.GridSegmentationPolicy org.apache.ignite.portables.PortableException org.apache.ignite.portables.PortableInvalidClassException +org.apache.ignite.services.ServiceConfiguration org.apache.ignite.spi.IgnitePortProtocol org.apache.ignite.spi.IgniteSpiException org.apache.ignite.spi.IgniteSpiMultiException -- 1.9.3 (Apple Git-50)