You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/05/13 18:10:26 UTC

[1/7] incubator-ignite git commit: # IGNITE-894 Code cleanup.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sprint-5 ba0caa1fc -> 27b559e3a


# IGNITE-894 Code cleanup.


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

Branch: refs/heads/ignite-sprint-5
Commit: 96ad5a8605b54e02057253ad7d330f2726ddd687
Parents: f027ac5
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 18:39:37 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 18:39:37 2015 +0300

----------------------------------------------------------------------
 .../processors/resource/GridResourceField.java    |  5 +----
 .../processors/resource/GridResourceIoc.java      | 18 ++++++++++--------
 .../apache/ignite/internal/util/IgniteUtils.java  |  3 +++
 3 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
index 162de1c..fed7ebd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
@@ -44,10 +44,7 @@ class GridResourceField {
      * @param field Field where resource should be injected.
      * @param ann Resource annotation.
      */
-    GridResourceField(Field field, @Nullable Annotation ann) {
-        assert field != null;
-        assert ann != null || GridResourceUtils.mayRequireResources(field);
-
+    GridResourceField(@NotNull Field field, @NotNull Annotation ann) {
         this.field = field;
         this.ann = ann;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index c2ef116..3d853d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
@@ -142,9 +143,9 @@ class GridResourceIoc {
 
         boolean injected = false;
 
-        for (GridResourceField field : descr.recursiveFields()) {
+        for (Field field : descr.recursiveFields()) {
             try {
-                Object obj = field.getField().get(target);
+                Object obj = field.get(target);
 
                 if (obj != null) {
                     assert checkedObjs != null;
@@ -153,7 +154,7 @@ class GridResourceIoc {
                 }
             }
             catch (IllegalAccessException e) {
-                throw new IgniteCheckedException("Failed to inject resource [field=" + field.getField().getName() +
+                throw new IgniteCheckedException("Failed to inject resource [field=" + field.getName() +
                     ", target=" + target + ']', e);
             }
         }
@@ -253,7 +254,7 @@ class GridResourceIoc {
      */
     private static class ClassDescriptor {
         /** */
-        private final GridResourceField[] recursiveFields;
+        private final Field[] recursiveFields;
 
         /** */
         private final Map<Class<? extends Annotation>, T2<GridResourceField[], GridResourceMethod[]>> annMap;
@@ -265,7 +266,7 @@ class GridResourceIoc {
             Map<Class<? extends Annotation>, T2<List<GridResourceField>, List<GridResourceMethod>>> annMap
                 = new HashMap<>();
 
-            Collection<GridResourceField> recursiveFieldsList = new ArrayList<>();
+            List<Field> recursiveFieldsList = new ArrayList<>();
 
             boolean allowImplicitInjection = !GridNoImplicitInjection.class.isAssignableFrom(cls);
 
@@ -291,7 +292,7 @@ class GridResourceIoc {
                         && fieldAnns.length == 0
                         && GridResourceUtils.mayRequireResources(field)) {
                         // Account for anonymous inner classes.
-                        recursiveFieldsList.add(new GridResourceField(field, null));
+                        recursiveFieldsList.add(field);
                     }
                 }
 
@@ -312,7 +313,8 @@ class GridResourceIoc {
                 }
             }
 
-            recursiveFields = GridResourceField.toArray(recursiveFieldsList);
+            recursiveFields = recursiveFieldsList.isEmpty() ? U.EMPTY_FIELDS
+                : recursiveFieldsList.toArray(new Field[recursiveFieldsList.size()]);
 
             this.annMap = IgniteUtils.limitedMap(annMap.size());
 
@@ -328,7 +330,7 @@ class GridResourceIoc {
         /**
          * @return Recursive fields.
          */
-        public GridResourceField[] recursiveFields() {
+        public Field[] recursiveFields() {
             return recursiveFields;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
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 ffb4e99..673287d 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
@@ -113,6 +113,9 @@ public abstract class IgniteUtils {
     /** Empty  longs. */
     public static final long[] EMPTY_LONGS = new long[0];
 
+    /** Empty  longs. */
+    public static final Field[] EMPTY_FIELDS = new Field[0];
+
     /** System line separator. */
     private static final String NL = System.getProperty("line.separator");
 


[3/7] incubator-ignite git commit: IGNITE-894 Fix file header.

Posted by se...@apache.org.
IGNITE-894 Fix file header.


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

Branch: refs/heads/ignite-sprint-5
Commit: 3e59d23c18facc9be0663dc494d58de2fd94ac54
Parents: a1ce1ce
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 14:54:15 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 14:54:15 2015 +0300

----------------------------------------------------------------------
 .../ignite/resources/InjectRecursively.java     | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e59d23c/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
index 6cf8c8a..60d1bd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -1,10 +1,18 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+/*
+ * 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.resources;


[7/7] incubator-ignite git commit: # IGNITE-894 Move @InjectRecursively to private package.

Posted by se...@apache.org.
# IGNITE-894 Move @InjectRecursively to private package.


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

Branch: refs/heads/ignite-sprint-5
Commit: 27b559e3aace024f19b411a8b377858c9e0456ab
Parents: 3abd25e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:10:03 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:10:03 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsJobImpl.java   |  1 +
 .../processors/resource/GridResourceIoc.java    |  1 -
 .../processors/resource/InjectRecursively.java  | 30 ++++++++++++++++++++
 .../ignite/resources/InjectRecursively.java     | 30 --------------------
 4 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index b5a336e..8f2cfd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
+import org.apache.ignite.internal.processors.resource.*;
 import org.apache.ignite.resources.*;
 
 import java.io.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 55c0d3b..ce19664 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.managers.deployment.*;
 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.resources.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
new file mode 100644
index 0000000..383ee03
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
@@ -0,0 +1,30 @@
+/*
+ * 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.resource;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
deleted file mode 100644
index 60d1bd7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ /dev/null
@@ -1,30 +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.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Indicates that resource injection should be performed for field value too.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface InjectRecursively {
-    // No-op.
-}


[2/7] incubator-ignite git commit: IGNITE-894 Add @InjectRecursively.

Posted by se...@apache.org.
IGNITE-894 Add @InjectRecursively.


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

Branch: refs/heads/ignite-sprint-5
Commit: a1ce1ce4b749f2fc12a803052bf0df21eb42f675
Parents: 96ad5a8
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 19:15:56 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 19:15:56 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridInternalWrapper.java    | 30 ------
 .../closure/GridClosureProcessor.java           | 25 ++---
 .../internal/processors/igfs/IgfsJobImpl.java   |  9 +-
 .../processors/resource/GridResourceIoc.java    | 34 +++----
 .../resource/GridResourceProcessor.java         | 22 +----
 .../processors/resource/GridResourceUtils.java  | 15 ---
 .../util/lang/GridComputeJobWrapper.java        | 96 --------------------
 .../ignite/resources/InjectRecursively.java     | 22 +++++
 8 files changed, 48 insertions(+), 205 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
deleted file mode 100644
index 76563e7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
+++ /dev/null
@@ -1,30 +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;
-
-/**
- * Internal wrapper interface for custom resource injection logic.
- */
-public interface GridInternalWrapper<T> {
-    /**
-     * Get user object where resources must be injected.
-     *
-     * @return User object.
-     */
-    public T userObject();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 658557e..8f5afbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1584,12 +1584,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
-        GridInternalWrapper<IgniteClosure> {
+    private static class C1<T, R> implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected IgniteClosure<T, R> job;
 
         /** */
@@ -1635,11 +1635,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteClosure userObject() {
-            return job;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C1.class, this);
         }
@@ -1681,11 +1676,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
+    private static class C2<R> implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected Callable<R> c;
 
         /**
@@ -1728,11 +1724,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Callable userObject() {
-            return c;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C2.class, this);
         }
@@ -1772,11 +1763,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
     /**
      */
-    private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
+    private static class C4 implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected Runnable r;
 
         /**
@@ -1816,11 +1808,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Runnable userObject() {
-            return r;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C4.class, this);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index fa90e21..b5a336e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.*;
 import org.apache.ignite.resources.*;
 
 import java.io.*;
@@ -29,11 +28,12 @@ import java.io.*;
 /**
  * IGFS job implementation.
  */
-public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
+public class IgfsJobImpl implements ComputeJob {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** IGFS job. */
+    @InjectRecursively
     private IgfsJob job;
 
     /** IGFS name. */
@@ -109,9 +109,4 @@ public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
     @Override public void cancel() {
         job.cancel();
     }
-
-    /** {@inheritDoc} */
-    @Override public IgfsJob userObject() {
-        return job;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 3d853d6..a2ffa55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.managers.deployment.*;
 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.resources.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
@@ -272,27 +273,26 @@ class GridResourceIoc {
 
             for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
                 for (Field field : cls0.getDeclaredFields()) {
-                    Annotation[] fieldAnns = field.getAnnotations();
+                    InjectRecursively injectRecursively = field.getAnnotation(InjectRecursively.class);
 
-                    for (Annotation ann : fieldAnns) {
-                        T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
-
-                        if (t2 == null) {
-                            t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
-                                new ArrayList<GridResourceField>(),
-                                new ArrayList<GridResourceMethod>());
+                    if (injectRecursively != null
+                        || (allowImplicitInjection && field.getName().startsWith("this$")
+                            || field.getName().startsWith("val$")))
+                        recursiveFieldsList.add(field);
+                    else {
+                        for (Annotation ann : field.getAnnotations()) {
+                            T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
 
-                            annMap.put(ann.annotationType(), t2);
-                        }
+                            if (t2 == null) {
+                                t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+                                    new ArrayList<GridResourceField>(),
+                                    new ArrayList<GridResourceMethod>());
 
-                        t2.get1().add(new GridResourceField(field, ann));
-                    }
+                                annMap.put(ann.annotationType(), t2);
+                            }
 
-                    if (allowImplicitInjection
-                        && fieldAnns.length == 0
-                        && GridResourceUtils.mayRequireResources(field)) {
-                        // Account for anonymous inner classes.
-                        recursiveFieldsList.add(field);
+                            t2.get1().add(new GridResourceField(field, ann));
+                        }
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
index cb4149b..5b51592 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
@@ -278,16 +278,9 @@ public class GridResourceProcessor extends GridProcessorAdapter {
             log.debug("Injecting resources: " + job);
 
         // Unwrap Proxy object.
-        Object obj = unwrapTarget(unwrapJob(job));
+        Object obj = unwrapTarget(job);
 
         injectToJob(dep, taskCls, obj, ses, jobCtx);
-
-        if (obj instanceof GridInternalWrapper) {
-            Object usrObj = ((GridInternalWrapper)obj).userObject();
-
-            if (usrObj != null)
-                injectToJob(dep, taskCls, usrObj, ses, jobCtx);
-        }
     }
 
     /**
@@ -329,19 +322,6 @@ public class GridResourceProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * Gets rid of job wrapper, if any.
-     *
-     * @param job Job to unwrap.
-     * @return Unwrapped job.
-     */
-    private ComputeJob unwrapJob(ComputeJob job) {
-        if (job instanceof GridComputeJobWrapper)
-            return ((GridComputeJobWrapper)job).wrappedJob();
-
-        return job;
-    }
-
-    /**
      * Injects held resources into given grid task.
      *
      * @param dep Deployed class.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
index 660d6ba..254f171 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
@@ -88,19 +88,4 @@ final class GridResourceUtils {
                 ", target=" + target + ", rsrc=" + rsrc + ']', e);
         }
     }
-
-    /**
-     * Checks if specified field requires recursive inspection to find resource annotations.
-     *
-     * @param f Field.
-     * @return {@code true} if requires, {@code false} if doesn't.
-     */
-    static boolean mayRequireResources(Field f) {
-        assert f != null;
-
-        // Need to inspect anonymous classes, callable and runnable instances.
-        return f.getName().startsWith("this$") || f.getName().startsWith("val$") ||
-            Callable.class.isAssignableFrom(f.getType()) || Runnable.class.isAssignableFrom(f.getType()) ||
-            IgniteClosure.class.isAssignableFrom(f.getType());
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
deleted file mode 100644
index 82c0078..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
+++ /dev/null
@@ -1,96 +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.lang;
-
-import org.apache.ignite.compute.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-
-/**
- * Convenient wrapper for grid job. It allows to create a job clone in cases when the same
- * job needs to be cloned to multiple grid nodes during mapping phase of task execution.
- */
-public class GridComputeJobWrapper implements ComputeJob, Callable<Object>,
-    GridPeerDeployAware {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private final ComputeJob job;
-
-    /** Peer deploy aware class. */
-    private transient volatile GridPeerDeployAware p;
-
-    /**
-     * Creates a wrapper with given grid {@code job}.
-     *
-     * @param job Job to wrap.
-     */
-    public GridComputeJobWrapper(ComputeJob job) {
-        A.notNull(job, "job");
-
-        this.job = job;
-    }
-
-    /**
-     * Gets wrapped job.
-     *
-     * @return Wrapped job.
-     */
-    public ComputeJob wrappedJob() {
-        return job;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public final Object call() throws Exception {
-        return execute();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Class<?> deployClass() {
-        if (p == null)
-            p = U.detectPeerDeployAware(this);
-
-        return p.deployClass();
-    }
-
-    /** {@inheritDoc} */
-    @Override public ClassLoader classLoader() {
-        if (p == null)
-            p = U.detectPeerDeployAware(this);
-
-        return p.classLoader();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void cancel() {
-        job.cancel();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object execute() {
-        return job.execute();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridComputeJobWrapper.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
new file mode 100644
index 0000000..6cf8c8a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.resources;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+    // No-op.
+}


[5/7] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-894

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-894


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

Branch: refs/heads/ignite-sprint-5
Commit: 34a9b315b2dc09b771e924e0970ecd9b1696144c
Parents: 9ea2dbd 8246788
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:20:26 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:20:26 2015 +0300

----------------------------------------------------------------------
 bin/include/functions.sh                        |    2 +-
 .../processors/cache/GridCacheMvccManager.java  |    4 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |    9 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   32 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   27 +
 .../cache/distributed/dht/GridDhtTxMapping.java |    2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   81 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   25 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |    4 +-
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../distributed/near/GridNearLockFuture.java    |    5 -
 .../near/GridNearOptimisticTxPrepareFuture.java |  779 +++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     |  349 ++++++
 .../cache/distributed/near/GridNearTxLocal.java |   84 +-
 .../near/GridNearTxPrepareFuture.java           | 1050 ------------------
 .../near/GridNearTxPrepareFutureAdapter.java    |  226 ++++
 .../cache/transactions/IgniteInternalTx.java    |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   68 +-
 .../transactions/IgniteTxLocalAdapter.java      |    2 +-
 .../cache/transactions/IgniteTxManager.java     |   12 +-
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   11 +-
 .../distributed/GridCacheLockAbstractTest.java  |    2 -
 .../distributed/IgniteTxGetAfterStopTest.java   |  131 +++
 ...achePartitionedNearDisabledLockSelfTest.java |   47 +
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |    4 +-
 ...idCacheAtomicReplicatedFailoverSelfTest.java |    6 +
 .../GridCachePartitionedTxSalvageSelfTest.java  |   25 +-
 .../GridCacheReplicatedFailoverSelfTest.java    |    6 +
 .../GridCacheReplicatedLockSelfTest.java        |    5 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |   80 ++
 .../discovery/tcp/TcpDiscoveryRestartTest.java  |  199 ++++
 .../IgniteCacheFailoverTestSuite.java           |   10 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    8 +-
 .../testsuites/IgniteCacheTestSuite2.java       |    1 +
 .../testsuites/IgniteCacheTestSuite3.java       |    2 +
 37 files changed, 2029 insertions(+), 1287 deletions(-)
----------------------------------------------------------------------



[4/7] incubator-ignite git commit: IGNITE-894 Add missing field.setAccessible(true);

Posted by se...@apache.org.
IGNITE-894 Add missing field.setAccessible(true);


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

Branch: refs/heads/ignite-sprint-5
Commit: 9ea2dbdd9c5d89e3da3950ac40bf2aa2a16e283b
Parents: 3e59d23
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:16:19 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:16:19 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/resource/GridResourceIoc.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ea2dbdd/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index a2ffa55..55c0d3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -277,8 +277,11 @@ class GridResourceIoc {
 
                     if (injectRecursively != null
                         || (allowImplicitInjection && field.getName().startsWith("this$")
-                            || field.getName().startsWith("val$")))
+                            || field.getName().startsWith("val$"))) {
+                        field.setAccessible(true);
+
                         recursiveFieldsList.add(field);
+                    }
                     else {
                         for (Annotation ann : field.getAnnotations()) {
                             T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());


[6/7] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-894' into ignite-sprint-5

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-894' into ignite-sprint-5


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

Branch: refs/heads/ignite-sprint-5
Commit: 3abd25e4e46a3fe8a77bd84570ff41fcdacb1e82
Parents: ba0caa1 34a9b31
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:03:47 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:03:47 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridInternalWrapper.java    | 30 ------
 .../closure/GridClosureProcessor.java           | 25 ++---
 .../internal/processors/igfs/IgfsJobImpl.java   |  9 +-
 .../processors/resource/GridResourceField.java  |  5 +-
 .../processors/resource/GridResourceIoc.java    | 51 ++++++-----
 .../resource/GridResourceProcessor.java         | 22 +----
 .../processors/resource/GridResourceUtils.java  | 15 ---
 .../ignite/internal/util/IgniteUtils.java       |  3 +
 .../util/lang/GridComputeJobWrapper.java        | 96 --------------------
 .../ignite/resources/InjectRecursively.java     | 30 ++++++
 10 files changed, 71 insertions(+), 215 deletions(-)
----------------------------------------------------------------------