ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [07/50] incubator-ignite git commit: # ignite-675
Date Mon, 06 Apr 2015 16:38:02 GMT
# ignite-675


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

Branch: refs/heads/ignite-564
Commit: c88e8a771905f49764ec7ccbe4c9be7f9b00b33a
Parents: 09a3a82
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Apr 3 13:39:13 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Apr 3 13:42:06 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  2 +-
 .../processors/task/GridTaskProcessor.java      | 24 ++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c88e8a77/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 2789a0c..a623cb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -760,7 +760,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
             startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
             startProcessor(new GridRestProcessor(ctx));
             startProcessor(new DataStreamProcessor(ctx));
-            startProcessor((GridProcessor) IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration())));
+            startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration())));
             startProcessor(new GridContinuousProcessor(ctx));
             startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ?
                 IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading
is enabled.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c88e8a77/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index 274310e..0dce4ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -84,7 +84,10 @@ public class GridTaskProcessor extends GridProcessorAdapter {
     private final GridSpinReadWriteLock lock = new GridSpinReadWriteLock();
 
     /** Internal metadata cache. */
-    private GridCache<GridTaskNameHashKey, String> tasksMetaCache;
+    private volatile GridCache<GridTaskNameHashKey, String> tasksMetaCache;
+
+    /** */
+    private final CountDownLatch startLatch = new CountDownLatch(1);
 
     /**
      * @param ctx Kernal context.
@@ -112,6 +115,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
     /** {@inheritDoc} */
     @Override public void onKernalStart() throws IgniteCheckedException {
         tasksMetaCache = ctx.security().enabled() ? ctx.cache().<GridTaskNameHashKey,
String>utilityCache() : null;
+
+        startLatch.countDown();
     }
 
     /** {@inheritDoc} */
@@ -191,6 +196,18 @@ public class GridTaskProcessor extends GridProcessorAdapter {
             log.debug("Finished executing task processor onKernalStop() callback.");
     }
 
+    /**
+     * @return Task metadata cache.
+     */
+    private GridCache<GridTaskNameHashKey, String> taskMetaCache() {
+        assert ctx.security().enabled();
+
+        if (tasksMetaCache == null)
+            U.awaitQuiet(startLatch);
+
+        return tasksMetaCache;
+    }
+
     /** {@inheritDoc} */
     @Override public void stop(boolean cancel) {
         if (log.isDebugEnabled())
@@ -345,7 +362,7 @@ public class GridTaskProcessor extends GridProcessorAdapter {
         assert ctx.security().enabled();
 
         try {
-            return tasksMetaCache.localPeek(
+            return taskMetaCache().localPeek(
                 new GridTaskNameHashKey(taskNameHash), CachePeekModes.ONHEAP_ONLY, null);
         }
         catch (IgniteCheckedException e) {
@@ -676,6 +693,7 @@ public class GridTaskProcessor extends GridProcessorAdapter {
      * Saves task name metadata to utility cache.
      *
      * @param taskName Task name.
+     * @throws IgniteCheckedException If failed.
      */
     private void saveTaskMetadata(String taskName) throws IgniteCheckedException {
         if (ctx.isDaemon())
@@ -691,6 +709,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
 
         GridTaskNameHashKey key = new GridTaskNameHashKey(nameHash);
 
+        GridCache<GridTaskNameHashKey, String> tasksMetaCache = taskMetaCache();
+
         String existingName = tasksMetaCache.get(key);
 
         if (existingName == null)


Mime
View raw message