ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: Fixed hang in GridServiceProcessor.stop in deactivated state.
Date Tue, 06 Jun 2017 12:44:45 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 915ea32e5 -> 98cdcfdff


Fixed hang in GridServiceProcessor.stop in deactivated state.


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

Branch: refs/heads/master
Commit: 98cdcfdff72aa5a7ec9efb9b7f06a67b56c4ab0d
Parents: 915ea32
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Jun 6 15:44:38 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jun 6 15:44:38 2017 +0300

----------------------------------------------------------------------
 .../service/GridServiceProcessor.java           | 32 +++++++++++++++-----
 1 file changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/98cdcfdf/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index fd8141c..e3d365f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -149,7 +149,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
     private volatile ExecutorService depExe;
 
     /** Busy lock. */
-    private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
+    private volatile GridSpinBusyLock busyLock = new GridSpinBusyLock();
 
     /** Thread factory. */
     private ThreadFactory threadFactory = new IgniteThreadFactory(ctx.igniteInstanceName());
@@ -281,8 +281,14 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
         if (ctx.isDaemon())
             return;
 
+        GridSpinBusyLock busyLock = this.busyLock;
+
         // Will not release it.
-        busyLock.block();
+        if (busyLock != null) {
+            busyLock.block();
+
+            this.busyLock = null;
+        }
 
         U.shutdownNow(GridServiceProcessor.class, depExe, log);
 
@@ -338,6 +344,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
             log.debug("Activate service processor [nodeId=" + ctx.localNodeId() +
                 " topVer=" + ctx.discovery().topologyVersionEx() + " ]");
 
+        busyLock = new GridSpinBusyLock();
+
         depExe = Executors.newSingleThreadExecutor(new IgniteThreadFactory(ctx.igniteInstanceName(),
"srvc-deploy"));
 
         start(true);
@@ -1338,7 +1346,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
     private class ServiceEntriesListener implements CacheEntryUpdatedListener<Object,
Object> {
         /** {@inheritDoc} */
         @Override public void onUpdated(final Iterable<CacheEntryEvent<?, ?>>
deps) {
-            if (!busyLock.enterBusy())
+            GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+            if (busyLock ==  null || !busyLock.enterBusy())
                 return;
 
             try {
@@ -1483,7 +1493,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
                 }
 
                 @Override public void onTimeout() {
-                    if (!busyLock.enterBusy())
+                    GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+                    if (busyLock == null || !busyLock.enterBusy())
                         return;
 
                     try {
@@ -1504,7 +1516,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
     private class TopologyListener implements DiscoveryEventListener {
         /** {@inheritDoc} */
         @Override public void onEvent(DiscoveryEvent evt, final DiscoCache discoCache) {
-            if (!busyLock.enterBusy())
+            GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+            if (busyLock == null || !busyLock.enterBusy())
                 return;
 
             try {
@@ -1626,7 +1640,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
          */
         private void onReassignmentFailed(final AffinityTopologyVersion topVer,
             final Collection<GridServiceDeployment> retries) {
-            if (!busyLock.enterBusy())
+            GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+            if (busyLock == null || !busyLock.enterBusy())
                 return;
 
             try {
@@ -1744,7 +1760,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements
Ignite
     private abstract class DepRunnable implements Runnable {
         /** {@inheritDoc} */
         @Override public void run() {
-            if (!busyLock.enterBusy())
+            GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
+
+            if (busyLock == null || !busyLock.enterBusy())
                 return;
 
             // Won't block ServiceProcessor stopping process.


Mime
View raw message