ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/22] incubator-ignite git commit: #ignite-51: IgniteTxEntry implements Message: small fixs.
Date Wed, 04 Mar 2015 13:26:49 GMT
#ignite-51: IgniteTxEntry implements Message: small fixs.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/21cdc80e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/21cdc80e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/21cdc80e

Branch: refs/heads/ignite-51
Commit: 21cdc80ef8b2a159aae1a75045c38d58ea30c9de
Parents: 0aedd9c
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Mar 4 12:33:22 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Mar 4 12:33:22 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheObjectImpl.java       |  2 +
 .../cache/transactions/TxEntryValueHolder.java  | 75 ++------------------
 2 files changed, 9 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/21cdc80e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
index aef1978..5da0f79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectImpl.java
@@ -94,6 +94,8 @@ public class CacheObjectImpl extends CacheObjectAdapter {
 
     /** {@inheritDoc} */
     @Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException
{
+        assert val != null || valBytes != null;
+
         if (valBytes == null && !byteArray())
             valBytes = CU.marshal(ctx.kernalContext().cache().context(), val);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/21cdc80e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
index 2cd0c37..cafe643 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxEntryValueHolder.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.jetbrains.annotations.*;
 
-import java.io.*;
 import java.nio.*;
 
 import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
@@ -147,7 +146,7 @@ public class TxEntryValueHolder implements Message {
      * @throws org.apache.ignite.IgniteCheckedException If unmarshalling failed.
      */
     public void unmarshal(GridCacheContext<?, ?> ctx, ClassLoader ldr) throws IgniteCheckedException
{
-        if (val != null)
+        if (hasWriteVal && val != null)
             val.finishUnmarshal(ctx, ldr);
 
 // TODO IGNITE-51.
@@ -155,68 +154,6 @@ public class TxEntryValueHolder implements Message {
 //                val = ctx.marshaller().unmarshal(valBytes, ldr);
     }
 
-    /**
-     * @param out Data output.
-     * @throws java.io.IOException If failed.
-     */
-    public void writeTo(ObjectOutput out) throws IOException {
-        out.writeBoolean(hasWriteVal);
-
-        if (hasWriteVal)
-            out.writeObject(val);
-
-        out.writeInt(op.ordinal());
-// TODO IGNITE-51.
-//            out.writeBoolean(hasWriteVal);
-//            out.writeBoolean(valBytesSent);
-//
-//            if (hasWriteVal) {
-//                if (valBytesSent)
-//                    U.writeByteArray(out, valBytes);
-//                else {
-//                    if (val != null && val instanceof byte[]) {
-//                        out.writeBoolean(true);
-//
-//                        U.writeByteArray(out, (byte[]) val);
-//                    }
-//                    else {
-//                        out.writeBoolean(false);
-//
-//                        out.writeObject(val);
-//                    }
-//                }
-//            }
-//
-//            out.writeInt(op.ordinal());
-    }
-
-    /**
-     * @param in Data input.
-     * @throws java.io.IOException If failed.
-     * @throws ClassNotFoundException If failed.
-     */
-    @SuppressWarnings("unchecked")
-    public void readFrom(ObjectInput in) throws IOException, ClassNotFoundException {
-        hasWriteVal = in.readBoolean();
-
-        if (hasWriteVal)
-            val = (CacheObject)in.readObject();
-
-        op = fromOrdinal(in.readInt());
-// TODO IGNITE-51.
-//            hasWriteVal = in.readBoolean();
-//            valBytesSent = in.readBoolean();
-//
-//            if (hasWriteVal) {
-//                if (valBytesSent)
-//                    valBytes = U.readByteArray(in);
-//                else
-//                    val = in.readBoolean() ? (V) U.readByteArray(in) : (V)in.readObject();
-//            }
-//
-//            op = fromOrdinal(in.readInt());
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return "[op=" + op +", val=" + val + ']';
@@ -247,7 +184,7 @@ public class TxEntryValueHolder implements Message {
                 writer.incrementState();
 
             case 2:
-                if (!writer.writeMessage("val", val))
+                if (hasWriteVal && !writer.writeMessage("val", val))
                     return false;
 
                 writer.incrementState();
@@ -286,10 +223,12 @@ public class TxEntryValueHolder implements Message {
                 reader.incrementState();
 
             case 2:
-                val = reader.readMessage("val");
+                if (hasWriteVal) {
+                    val = reader.readMessage("val");
 
-                if (!reader.isLastRead())
-                    return false;
+                    if (!reader.isLastRead())
+                        return false;
+                }
 
                 reader.incrementState();
 


Mime
View raw message