ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject incubator-ignite git commit: Add debug info.
Date Wed, 11 Mar 2015 13:28:14 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-task-Benchmark-1 [created] 3de16fe6d


Add debug info.


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

Branch: refs/heads/ignite-task-Benchmark-1
Commit: 3de16fe6da052a57f3130d8507a4c20f9d67ecd2
Parents: b1b8aca
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Wed Mar 11 16:27:37 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Wed Mar 11 16:27:37 2015 +0300

----------------------------------------------------------------------
 .../processors/task/GridTaskProcessor.java      | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3de16fe6/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 67058f6..8876d7d 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
@@ -40,6 +40,7 @@ import org.jetbrains.annotations.*;
 
 import java.util.*;
 import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.internal.GridTopic.*;
@@ -57,6 +58,11 @@ public class GridTaskProcessor extends GridProcessorAdapter {
     private static final Map<GridTaskThreadContextKey, Object> EMPTY_ENUM_MAP =
         new EnumMap<>(GridTaskThreadContextKey.class);
 
+    private static final AtomicInteger taskCnt = new AtomicInteger();
+    private static final AtomicInteger iterationCnt = new AtomicInteger();
+
+    private static boolean hookInstalled = false;
+
     /** */
     private final Marshaller marsh;
 
@@ -98,6 +104,20 @@ public class GridTaskProcessor extends GridProcessorAdapter {
         tasksMetaCache = ctx.security().enabled() ? ctx.cache().<GridTaskNameHashKey,
String>utilityCache() : null;
     }
 
+    private void ensureHookInstalled() {
+        if (hookInstalled)
+            return;
+
+        hookInstalled = true;
+
+        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+            @Override public void run() {
+                System.err.printf("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" +
+                    "!!! Task count=%d , iterationCnt=%d \n\n", taskCnt.get(), iterationCnt.get());
+            }
+        }));
+    }
+
     /** {@inheritDoc} */
     @Override public void start() {
         ctx.event().addLocalEventListener(discoLsnr, EVT_NODE_FAILED, EVT_NODE_LEFT);
@@ -239,12 +259,16 @@ public class GridTaskProcessor extends GridProcessorAdapter {
         return map == null ? null : (T)map.get(key);
     }
 
+
+
     /**
      * Gets currently used deployments.
      *
      * @return Currently used deployments.
      */
     public Collection<GridDeployment> getUsedDeployments() {
+        iterationCnt.incrementAndGet();
+
         return F.viewReadOnly(tasks.values(), new C1<GridTaskWorker<?, ?>, GridDeployment>()
{
             @Override public GridDeployment apply(GridTaskWorker<?, ?> w) {
                 return w.getDeployment();
@@ -260,6 +284,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
     public Map<String, GridDeployment> getUsedDeploymentMap() {
         Map<String, GridDeployment> deps = new HashMap<>();
 
+        iterationCnt.incrementAndGet();
+
         for (GridTaskWorker w : tasks.values()) {
             GridTaskSessionImpl ses = w.getSession();
 
@@ -403,6 +429,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
             // Reset thread-local context.
             thCtx.remove();
 
+        taskCnt.incrementAndGet();
+
         Long timeout = (Long)map.get(TC_TIMEOUT);
 
         long timeout0 = timeout == null || timeout == 0 ? Long.MAX_VALUE : timeout;
@@ -617,6 +645,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
     public <R> Map<IgniteUuid, ComputeTaskFuture<R>> taskFutures() {
         Map<IgniteUuid, ComputeTaskFuture<R>> res = U.newHashMap(tasks.size());
 
+        iterationCnt.incrementAndGet();
+
         for (GridTaskWorker taskWorker : tasks.values()) {
             ComputeTaskInternalFuture<R> fut = taskWorker.getTaskFuture();
 


Mime
View raw message