Ignite-65 fox for GridJobSubjectIdSelfTest

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

Branch: refs/heads/ignite-49
Commit: 16e58046cba2c9e23f65c892b8db8fac9df8e88a
Parents: 8795b0f
Author: avinogradov <avinogra...@gridgain.com>
Authored: Fri Jan 23 14:13:36 2015 +0300
Committer: avinogradov <avinogra...@gridgain.com>
Committed: Fri Jan 23 14:13:36 2015 +0300

----------------------------------------------------------------------
 .../grid/kernal/GridJobExecuteRequest.java      |  29 ++-
 .../grid/kernal/GridJobExecuteRequestV2.java    | 185 -------------------
 .../kernal/processors/job/GridJobProcessor.java |   3 -
 .../kernal/processors/task/GridTaskWorker.java  |  78 +++-----
 .../GridTcpCommunicationMessageFactory.java     |   5 +-
 5 files changed, 52 insertions(+), 248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16e58046/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java
----------------------------------------------------------------------
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 ea88004..8cb8e5c 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
@@ -34,7 +34,10 @@ import java.util.*;
  */
 public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter 
implements GridTaskMessage {
     /** */
-    private static final long serialVersionUID = 0L;
+    private static final long serialVersionUID = -1470089047880101067L;
+
+    /** Subject ID. */
+    private UUID subjId;
 
     /** */
     private IgniteUuid sesId;
@@ -161,6 +164,7 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
      * @param forceLocDep {@code True} If remote node should ignore deployment 
settings.
      * @param sesFullSup {@code True} if session attributes are disabled.
      * @param internal {@code True} if internal job.
+     * @param subjId Subject ID.
      */
     public GridJobExecuteRequest(
         IgniteUuid sesId,
@@ -186,7 +190,8 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
         Map<UUID, IgniteUuid> ldrParticipants,
         boolean forceLocDep,
         boolean sesFullSup,
-        boolean internal) {
+        boolean internal,
+        UUID subjId) {
         this.top = top;
         assert sesId != null;
         assert jobId != null;
@@ -222,6 +227,7 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
         this.forceLocDep = forceLocDep;
         this.sesFullSup = sesFullSup;
         this.internal = internal;
+        this.subjId = subjId;
 
         this.cpSpi = cpSpi == null || cpSpi.isEmpty() ? null : cpSpi;
     }
@@ -406,7 +412,7 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
      * @return Subject ID.
      */
     public UUID getSubjectId() {
-        return null;
+        return subjId;
     }
 
     /** {@inheritDoc} */
@@ -449,6 +455,7 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
         _clone.sesFullSup = sesFullSup;
         _clone.internal = internal;
         _clone.top = top;
+        _clone.subjId = subjId;
     }
 
     /** {@inheritDoc} */
@@ -643,6 +650,11 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
 
                 commState.idx++;
 
+            case 21:
+                if (!commState.putUuid(subjId))
+                    return false;
+
+                commState.idx++;
         }
 
         return true;
@@ -901,6 +913,15 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
 
                 commState.idx++;
 
+            case 21:
+                UUID subjId0 = commState.getUuid();
+
+                if (subjId0 == UUID_NOT_READ)
+                    return false;
+
+                subjId = subjId0;
+
+                commState.idx++;
         }
 
         return true;
@@ -908,7 +929,7 @@ public class GridJobExecuteRequest extends 
GridTcpCommunicationMessageAdapter im
 
     /** {@inheritDoc} */
     @Override public byte directType() {
-        return 1;
+        return 81;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16e58046/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 69491fe..0000000
--- 
a/modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java
+++ /dev/null
@@ -1,185 +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.gridgain.grid.kernal;
-
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.util.direct.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-
-/**
- * Updated job execute request with subject ID.
- */
-public class GridJobExecuteRequestV2 extends GridJobExecuteRequest {
-    /** */
-    private static final long serialVersionUID = -1470089047880101067L;
-
-    /** Subject ID. */
-    private UUID subjId;
-
-    /**
-     * No-op constructor to support {@link Externalizable} interface.
-     */
-    public GridJobExecuteRequestV2() {
-        // No-op.
-    }
-
-    /**
-     * @param sesId Task session ID.
-     * @param jobId Job ID.
-     * @param taskName Task name.
-     * @param userVer Code version.
-     * @param taskClsName Fully qualified task name.
-     * @param jobBytes Job serialized body.
-     * @param job Job.
-     * @param startTaskTime Task execution start time.
-     * @param timeout Task execution timeout.
-     * @param top Topology.
-     * @param siblingsBytes Serialized collection of split siblings.
-     * @param siblings Collection of split siblings.
-     * @param sesAttrsBytes Map of session attributes.
-     * @param sesAttrs Session attributes.
-     * @param jobAttrsBytes Job context attributes.
-     * @param jobAttrs Job attributes.
-     * @param cpSpi Collision SPI.
-     * @param clsLdrId Task local class loader id.
-     * @param depMode Task deployment mode.
-     * @param dynamicSiblings {@code True} if siblings are dynamic.
-     * @param ldrParticipants Other node class loader IDs that can also load 
classes.
-     * @param forceLocDep {@code True} If remote node should ignore deployment 
settings.
-     * @param sesFullSup {@code True} if session attributes are disabled.
-     * @param internal {@code True} if internal job.
-     * @param subjId Subject ID.
-     */
-    public GridJobExecuteRequestV2(
-        IgniteUuid sesId,
-        IgniteUuid jobId,
-        String taskName,
-        String userVer,
-        String taskClsName,
-        byte[] jobBytes,
-        ComputeJob job,
-        long startTaskTime,
-        long timeout,
-        @Nullable Collection<UUID> top,
-        byte[] siblingsBytes,
-        Collection<ComputeJobSibling> siblings,
-        byte[] sesAttrsBytes,
-        Map<Object, Object> sesAttrs,
-        byte[] jobAttrsBytes,
-        Map<? extends Serializable, ? extends Serializable> jobAttrs,
-        String cpSpi,
-        IgniteUuid clsLdrId,
-        IgniteDeploymentMode depMode,
-        boolean dynamicSiblings,
-        Map<UUID, IgniteUuid> ldrParticipants,
-        boolean forceLocDep,
-        boolean sesFullSup,
-        boolean internal,
-        UUID subjId
-    ) {
-        super(sesId, jobId, taskName, userVer, taskClsName, jobBytes, job, 
startTaskTime, timeout, top, siblingsBytes,
-            siblings, sesAttrsBytes, sesAttrs, jobAttrsBytes, jobAttrs, cpSpi, 
clsLdrId, depMode, dynamicSiblings,
-            ldrParticipants, forceLocDep, sesFullSup, internal);
-
-        this.subjId = subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID getSubjectId() {
-        return subjId;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
-    @Override public GridTcpCommunicationMessageAdapter clone() {
-        GridJobExecuteRequestV2 _clone = new GridJobExecuteRequestV2();
-
-        clone0(_clone);
-
-        return _clone;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
-        super.clone0(_msg);
-
-        GridJobExecuteRequestV2 _clone = (GridJobExecuteRequestV2)_msg;
-
-        _clone.subjId = subjId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf) {
-        commState.setBuffer(buf);
-
-        if (!super.writeTo(buf))
-            return false;
-
-        if (!commState.typeWritten) {
-            if (!commState.putByte(directType()))
-                return false;
-
-            commState.typeWritten = true;
-        }
-
-        switch (commState.idx) {
-            case 21:
-                if (!commState.putUuid(subjId))
-                    return false;
-
-                commState.idx++;
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
-        commState.setBuffer(buf);
-
-        if (!super.readFrom(buf))
-            return false;
-
-        switch (commState.idx) {
-            case 21:
-                UUID subjId0 = commState.getUuid();
-
-                if (subjId0 == UUID_NOT_READ)
-                    return false;
-
-                subjId = subjId0;
-
-                commState.idx++;
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte directType() {
-        return 81;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16e58046/modules/core/src/main/java/org/gridgain/grid/kernal/processors/job/GridJobProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/job/GridJobProcessor.java
 
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/job/GridJobProcessor.java
index efcefbe..57bc3e8 100644
--- 
a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/job/GridJobProcessor.java
+++ 
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/job/GridJobProcessor.java
@@ -58,9 +58,6 @@ public class GridJobProcessor extends GridProcessorAdapter {
     /** */
     private static final int FINISHED_JOBS_COUNT = 
Integer.getInteger(GG_JOBS_HISTORY_SIZE, 10240);
 
-    /** Version when subject ID was added. */
-    public static final IgniteProductVersion SUBJECT_ID_ADDED_SINCE_VER = 
IgniteProductVersion.fromString("6.2.1");
-
     /** */
     private final IgniteMarshaller marsh;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16e58046/modules/core/src/main/java/org/gridgain/grid/kernal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/task/GridTaskWorker.java
 
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/task/GridTaskWorker.java
index 8e6bcb9..e14de31 100644
--- 
a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/task/GridTaskWorker.java
+++ 
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/task/GridTaskWorker.java
@@ -1120,58 +1120,32 @@ class GridTaskWorker<T, R> extends GridWorker 
implements GridTimeoutObject {
 
                     boolean forceLocDep = internal || !ctx.deploy().enabled();
 
-                    req = 
node.version().compareTo(GridJobProcessor.SUBJECT_ID_ADDED_SINCE_VER) < 0 ?
-                        new GridJobExecuteRequest(
-                            ses.getId(),
-                            res.getJobContext().getJobId(),
-                            ses.getTaskName(),
-                            ses.getUserVersion(),
-                            ses.getTaskClassName(),
-                            loc ? null : marsh.marshal(res.getJob()),
-                            loc ? res.getJob() : null,
-                            ses.getStartTime(),
-                            timeout,
-                            ses.getTopology(),
-                            loc ? null : marsh.marshal(ses.getJobSiblings()),
-                            loc ? ses.getJobSiblings() : null,
-                            loc ? null : marsh.marshal(sesAttrs),
-                            loc ? sesAttrs : null,
-                            loc ? null: marsh.marshal(jobAttrs),
-                            loc ? jobAttrs : null,
-                            ses.getCheckpointSpi(),
-                            dep.classLoaderId(),
-                            dep.deployMode(),
-                            continuous,
-                            dep.participants(),
-                            forceLocDep,
-                            ses.isFullSupport(),
-                            internal) :
-                        new GridJobExecuteRequestV2(
-                            ses.getId(),
-                            res.getJobContext().getJobId(),
-                            ses.getTaskName(),
-                            ses.getUserVersion(),
-                            ses.getTaskClassName(),
-                            loc ? null : marsh.marshal(res.getJob()),
-                            loc ? res.getJob() : null,
-                            ses.getStartTime(),
-                            timeout,
-                            ses.getTopology(),
-                            loc ? null : marsh.marshal(ses.getJobSiblings()),
-                            loc ? ses.getJobSiblings() : null,
-                            loc ? null : marsh.marshal(sesAttrs),
-                            loc ? sesAttrs : null,
-                            loc ? null: marsh.marshal(jobAttrs),
-                            loc ? jobAttrs : null,
-                            ses.getCheckpointSpi(),
-                            dep.classLoaderId(),
-                            dep.deployMode(),
-                            continuous,
-                            dep.participants(),
-                            forceLocDep,
-                            ses.isFullSupport(),
-                            internal,
-                            subjId);
+                    req = new GridJobExecuteRequest(
+                        ses.getId(),
+                        res.getJobContext().getJobId(),
+                        ses.getTaskName(),
+                        ses.getUserVersion(),
+                        ses.getTaskClassName(),
+                        loc ? null : marsh.marshal(res.getJob()),
+                        loc ? res.getJob() : null,
+                        ses.getStartTime(),
+                        timeout,
+                        ses.getTopology(),
+                        loc ? null : marsh.marshal(ses.getJobSiblings()),
+                        loc ? ses.getJobSiblings() : null,
+                        loc ? null : marsh.marshal(sesAttrs),
+                        loc ? sesAttrs : null,
+                        loc ? null : marsh.marshal(jobAttrs),
+                        loc ? jobAttrs : null,
+                        ses.getCheckpointSpi(),
+                        dep.classLoaderId(),
+                        dep.deployMode(),
+                        continuous,
+                        dep.participants(),
+                        forceLocDep,
+                        ses.isFullSupport(),
+                        internal,
+                        subjId);
 
                     if (loc)
                         
ctx.job().processJobExecuteRequest(ctx.discovery().localNode(), req);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16e58046/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
----------------------------------------------------------------------
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 6107e22..f8bee9f 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
@@ -62,9 +62,6 @@ public class GridTcpCommunicationMessageFactory {
                     case 0:
                         return new GridJobCancelRequest();
 
-                    case 1:
-                        return new GridJobExecuteRequest();
-
                     case 2:
                         return new GridJobExecuteResponse();
 
@@ -270,7 +267,7 @@ public class GridTcpCommunicationMessageFactory {
                         return new GridDhtAffinityAssignmentResponse();
 
                     case 81:
-                        return new GridJobExecuteRequestV2();
+                        return new GridJobExecuteRequest();
 
                     case 82:
                         return new GridCacheTtlUpdateRequest();

Reply via email to