shishkovilja commented on code in PR #12395:
URL: https://github.com/apache/ignite/pull/12395#discussion_r2432023199
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -206,6 +212,11 @@ public boolean nearCache() {
return isFlag(NEAR_CACHE_FLAG_MASK);
}
+ /** */
Review Comment:
```suggestion
/** New topology version. */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -263,11 +274,33 @@ public int taskNameHash() {
return taskNameHash;
}
+ /**
+ * Sets task name hash code.
+ */
+ public void taskNameHash(int taskNameHash) {
+ this.taskNameHash = taskNameHash;
+ }
+
+ /** */
Review Comment:
```suggestion
/**
* @return Compressed boolean flags.
*/
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -73,36 +75,40 @@ public abstract class GridNearAtomicAbstractUpdateRequest
extends GridCacheIdMes
private static final int AFFINITY_MAPPING_FLAG_MASK = 0x80;
/** Target node ID. */
- @GridDirectTransient
protected UUID nodeId;
/** Future version. */
+ @Order(value = 4, method = "futureId")
protected long futId;
/** Topology version. */
+ @Order(value = 5, method = "topologyVersion")
protected AffinityTopologyVersion topVer;
- /** Write synchronization mode. */
- protected CacheWriteSynchronizationMode syncMode;
-
/** Update operation. */
Review Comment:
```suggestion
/** Cache operation wrapper message. */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -73,36 +75,40 @@ public abstract class GridNearAtomicAbstractUpdateRequest
extends GridCacheIdMes
private static final int AFFINITY_MAPPING_FLAG_MASK = 0x80;
/** Target node ID. */
- @GridDirectTransient
protected UUID nodeId;
/** Future version. */
+ @Order(value = 4, method = "futureId")
protected long futId;
/** Topology version. */
+ @Order(value = 5, method = "topologyVersion")
protected AffinityTopologyVersion topVer;
- /** Write synchronization mode. */
- protected CacheWriteSynchronizationMode syncMode;
-
/** Update operation. */
- protected GridCacheOperation op;
+ @Order(value = 6, method = "cacheOperationMessage")
+ protected GridCacheOperationMessage opMsg;
+
+ /** Write synchronization mode. */
Review Comment:
```suggestion
/** Write synchronization mode wrapper message. */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java:
##########
@@ -154,13 +170,38 @@ public GridNearAtomicSingleUpdateRequest() {
return Collections.singletonList(val);
}
+ /** */
Review Comment:
```suggestion
/**
* @return Value to update.
*/
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java:
##########
@@ -154,13 +170,38 @@ public GridNearAtomicSingleUpdateRequest() {
return Collections.singletonList(val);
}
+ /** */
+ public CacheObject value() {
+ return val;
+ }
+
+ /** */
Review Comment:
```suggestion
/**
* @param val New value to update.
*/
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java:
##########
@@ -142,6 +148,16 @@ public GridNearAtomicSingleUpdateRequest() {
return Collections.singletonList(key);
}
+ /** */
Review Comment:
```suggestion
/**
* @param key New key to update.
*/
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class CacheWriteSynchronizationModeMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 503;
+
+ /** */
+ private CacheWriteSynchronizationMode cacheWriteSyncMode;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public CacheWriteSynchronizationModeMessage() {
+ // No-op.
+ }
+
+ /** */
+ public CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode
mode) {
+ this.cacheWriteSyncMode = mode;
+ this.code = encode(mode);
Review Comment:
```suggestion
code = encode(mode);
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheOperationMessage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class GridCacheOperationMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 504;
+
+ /** */
+ @Nullable private GridCacheOperation cacheOperation;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public GridCacheOperationMessage() {
+ // No-op.
+ }
+
+ /** */
+ public GridCacheOperationMessage(GridCacheOperation cacheOperation) {
+ this.cacheOperation = cacheOperation;
+ this.code = encode(cacheOperation);
Review Comment:
```suggestion
code = encode(cacheOperation);
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheOperationMessage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class GridCacheOperationMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 504;
+
+ /** */
+ @Nullable private GridCacheOperation cacheOperation;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public GridCacheOperationMessage() {
+ // No-op.
+ }
+
+ /** */
+ public GridCacheOperationMessage(GridCacheOperation cacheOperation) {
+ this.cacheOperation = cacheOperation;
+ this.code = encode(cacheOperation);
+ }
+
+ /** */
+ private static byte encode(@Nullable GridCacheOperation operation) {
+ if (operation == null)
+ return -1;
+
+ switch (operation) {
+ case READ: return 0;
+ case CREATE: return 1;
+ case UPDATE: return 2;
+ case DELETE: return 3;
+ case TRANSFORM: return 4;
+ case RELOAD: return 5;
+ case NOOP: return 6;
+ }
+
+ throw new IllegalArgumentException("Unknown cache operation: " +
operation);
+ }
+
+ /** */
+ @Nullable private static GridCacheOperation decode(byte code) {
+ switch (code) {
+ case -1: return null;
+ case 0: return GridCacheOperation.READ;
+ case 1: return GridCacheOperation.CREATE;
+ case 2: return GridCacheOperation.UPDATE;
+ case 3: return GridCacheOperation.DELETE;
+ case 4: return GridCacheOperation.TRANSFORM;
+ case 5: return GridCacheOperation.RELOAD;
+ case 6: return GridCacheOperation.NOOP;
+ }
+
+ throw new IllegalArgumentException("Unknown cache operation code: " +
code);
+ }
+
+ /** */
+ public void code(byte code) {
+ this.code = code;
+ this.cacheOperation = decode(code);
Review Comment:
```suggestion
cacheOperation = decode(code);
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class CacheWriteSynchronizationModeMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 503;
+
+ /** */
+ private CacheWriteSynchronizationMode cacheWriteSyncMode;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public CacheWriteSynchronizationModeMessage() {
+ // No-op.
+ }
+
+ /** */
+ public CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode
mode) {
+ this.cacheWriteSyncMode = mode;
+ this.code = encode(mode);
+ }
+
+ /** */
+ private static byte encode(@Nullable CacheWriteSynchronizationMode mode) {
+ if (mode == null)
+ return -1;
+
+ switch (mode) {
+ case FULL_SYNC: return 0;
+ case FULL_ASYNC: return 1;
+ case PRIMARY_SYNC: return 2;
+ }
+
+ throw new IllegalArgumentException("Unknown cache write
synchronization mode: " + mode);
+ }
+
+ /** */
+ @Nullable private static CacheWriteSynchronizationMode decode(short code) {
+ switch (code) {
+ case -1: return null;
+ case 0: return CacheWriteSynchronizationMode.FULL_SYNC;
+ case 1: return CacheWriteSynchronizationMode.FULL_ASYNC;
+ case 2: return CacheWriteSynchronizationMode.PRIMARY_SYNC;
+ }
+
+ throw new IllegalArgumentException("Unknown cache write
synchronization mode code: " + code);
+ }
+
+ /** */
+ public void code(byte code) {
+ this.code = code;
+ this.cacheWriteSyncMode = decode(code);
Review Comment:
```suggestion
cacheWriteSyncMode = decode(code);
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class CacheWriteSynchronizationModeMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 503;
+
+ /** */
+ private CacheWriteSynchronizationMode cacheWriteSyncMode;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public CacheWriteSynchronizationModeMessage() {
+ // No-op.
+ }
+
+ /** */
+ public CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode
mode) {
Review Comment:
```suggestion
public CacheWriteSynchronizationModeMessage(@Nullable
CacheWriteSynchronizationMode mode) {
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -285,10 +318,32 @@ public long futureId() {
}
/**
- * @return Write synchronization mode.
+ * Sets near node future ID.
*/
- public final CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
+ public void futureId(long futId) {
+ this.futId = futId;
+ }
+
+ /** @return The cache operation serialization message. */
+ public GridCacheOperationMessage cacheOperationMessage() {
+ return opMsg;
+ }
+
+ /** Sets the cache operation serialization message. */
+ public void cacheOperationMessage(GridCacheOperationMessage cacheOpMsg) {
+ this.opMsg = cacheOpMsg;
+ }
+
+ /**
+ * @return The write mode serialization message.
+ */
+ public final CacheWriteSynchronizationModeMessage
writeSynchronizationModeMessage() {
+ return syncModeMsg;
+ }
+
+ /** Sets the write mode serialization message */
Review Comment:
```suggestion
/** Sets the write synchronization mode wrapper message */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -285,10 +318,32 @@ public long futureId() {
}
/**
- * @return Write synchronization mode.
+ * Sets near node future ID.
*/
- public final CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
+ public void futureId(long futId) {
+ this.futId = futId;
+ }
+
+ /** @return The cache operation serialization message. */
+ public GridCacheOperationMessage cacheOperationMessage() {
+ return opMsg;
+ }
+
+ /** Sets the cache operation serialization message. */
Review Comment:
```suggestion
/** Sets the cache operation wrapper message. */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -263,11 +274,33 @@ public int taskNameHash() {
return taskNameHash;
}
+ /**
+ * Sets task name hash code.
+ */
+ public void taskNameHash(int taskNameHash) {
+ this.taskNameHash = taskNameHash;
+ }
+
+ /** */
+ public byte flags() {
+ return flags;
+ }
+
+ /** */
Review Comment:
```suggestion
/**
* @param flags New compressed boolean flags.
*/
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -285,10 +318,32 @@ public long futureId() {
}
/**
- * @return Write synchronization mode.
+ * Sets near node future ID.
*/
- public final CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
+ public void futureId(long futId) {
+ this.futId = futId;
+ }
+
+ /** @return The cache operation serialization message. */
Review Comment:
```suggestion
/** @return The cache operation wrapper message. */
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java:
##########
@@ -285,10 +318,32 @@ public long futureId() {
}
/**
- * @return Write synchronization mode.
+ * Sets near node future ID.
*/
- public final CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
+ public void futureId(long futId) {
+ this.futId = futId;
+ }
+
+ /** @return The cache operation serialization message. */
+ public GridCacheOperationMessage cacheOperationMessage() {
+ return opMsg;
+ }
+
+ /** Sets the cache operation serialization message. */
+ public void cacheOperationMessage(GridCacheOperationMessage cacheOpMsg) {
+ this.opMsg = cacheOpMsg;
+ }
+
+ /**
+ * @return The write mode serialization message.
Review Comment:
```suggestion
* @return The write synchronization mode wrapper message.
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java:
##########
@@ -142,6 +148,16 @@ public GridNearAtomicSingleUpdateRequest() {
return Collections.singletonList(key);
}
+ /** */
+ public void key(KeyCacheObject key) {
+ this.key = key;
+ }
+
+ /** */
Review Comment:
```suggestion
/**
*@return Key to update.
*/
```
##########
modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CacheWriteSynchroizationModeMessageTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import
org.apache.ignite.internal.processors.cache.CacheWriteSynchronizationModeMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.junit.Test;
+
+import static
org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class CacheWriteSynchroizationModeMessageTest {
+ /** */
+ @Test
+ public void testCacheWriteSynchroizationCode() {
+ assertEquals(-1, new
CacheWriteSynchronizationModeMessage(null).code());
+ assertEquals(0, new
CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode.FULL_SYNC).code());
+ assertEquals(1, new
CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode.FULL_ASYNC).code());
+ assertEquals(2, new
CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode.PRIMARY_SYNC).code());
+
+ for (CacheWriteSynchronizationMode op :
CacheWriteSynchronizationMode.values()) {
+ assertTrue(new CacheWriteSynchronizationModeMessage(op).code() !=
-1);
Review Comment:
This line is redundant.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
Review Comment:
Please, add java doc for class and members, see
`TransactionIsolationMessage`.
##########
modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CacheOperationModeMessageTest.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheOperationMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.junit.Test;
+
+import static
org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class CacheOperationModeMessageTest {
+ /** */
+ @Test
+ public void testCacheOperationModeCode() {
+ assertEquals(-1, new GridCacheOperationMessage(null).code());
+ assertEquals(0, new
GridCacheOperationMessage(GridCacheOperation.READ).code());
+ assertEquals(1, new
GridCacheOperationMessage(GridCacheOperation.CREATE).code());
+ assertEquals(2, new
GridCacheOperationMessage(GridCacheOperation.UPDATE).code());
+ assertEquals(3, new
GridCacheOperationMessage(GridCacheOperation.DELETE).code());
+ assertEquals(4, new
GridCacheOperationMessage(GridCacheOperation.TRANSFORM).code());
+ assertEquals(5, new
GridCacheOperationMessage(GridCacheOperation.RELOAD).code());
+ assertEquals(6, new
GridCacheOperationMessage(GridCacheOperation.NOOP).code());
+
+ for (GridCacheOperation op : GridCacheOperation.values()) {
+ assertTrue(new GridCacheOperationMessage(op).code() != -1);
Review Comment:
This line is redundant.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheOperationMessage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
Review Comment:
Please, add java doc for class and members, see
`TransactionIsolationMessage`.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class CacheWriteSynchronizationModeMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 503;
+
+ /** */
+ private CacheWriteSynchronizationMode cacheWriteSyncMode;
Review Comment:
```suggestion
@Nullable private CacheWriteSynchronizationMode cacheWriteSyncMode;
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheWriteSynchronizationModeMessage.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class CacheWriteSynchronizationModeMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 503;
+
+ /** */
+ private CacheWriteSynchronizationMode cacheWriteSyncMode;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public CacheWriteSynchronizationModeMessage() {
+ // No-op.
+ }
+
+ /** */
+ public CacheWriteSynchronizationModeMessage(CacheWriteSynchronizationMode
mode) {
+ this.cacheWriteSyncMode = mode;
Review Comment:
```suggestion
cacheWriteSyncMode = mode;
```
##########
modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CacheOperationModeMessageTest.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.managers.communication;
+
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheOperationMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.junit.Test;
+
+import static
org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class CacheOperationModeMessageTest {
Review Comment:
```suggestion
public class GridCacheOperationModeMessageTest {
```
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheOperationMessage.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class GridCacheOperationMessage implements Message {
+ /** */
+ public static final short TYPE_CODE = 504;
+
+ /** */
+ @Nullable private GridCacheOperation cacheOperation;
+
+ /** */
+ @Order(0)
+ private byte code = -1;
+
+ /** */
+ public GridCacheOperationMessage() {
+ // No-op.
+ }
+
+ /** */
+ public GridCacheOperationMessage(GridCacheOperation cacheOperation) {
Review Comment:
```suggestion
public GridCacheOperationMessage(@Nullable GridCacheOperation
cacheOperation) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]