You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2014/11/19 05:42:32 UTC
[1/4] helix git commit: [HELIX-550] ZKHelixManager should shutdown
GenericHelixController.
Repository: helix
Updated Branches:
refs/heads/helix-0.6.x 2eaea9135 -> 45a9fd3a9
[HELIX-550] ZKHelixManager should shutdown GenericHelixController.
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/af882ea0
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/af882ea0
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/af882ea0
Branch: refs/heads/helix-0.6.x
Commit: af882ea025b1daf821f9f17f969a587ca7ec3e17
Parents: 961a9e1
Author: Antony T Curtis <ac...@linkedin.com>
Authored: Mon Nov 17 14:04:44 2014 -0800
Committer: Antony T Curtis <ac...@linkedin.com>
Committed: Mon Nov 17 16:15:53 2014 -0800
----------------------------------------------------------------------
.../controller/GenericHelixController.java | 9 ++++++
.../apache/helix/manager/zk/ZKHelixManager.java | 34 +++++++++++++++++---
2 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/af882ea0/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
index 81c2e3d..5e5ad5b 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
@@ -573,6 +573,15 @@ public class GenericHelixController implements ConfigChangeListener, IdealStateC
}
}
+ public void shutdown() throws InterruptedException {
+ stopRebalancingTimer();
+ while (_eventThread.isAlive())
+ {
+ _eventThread.interrupt();
+ _eventThread.join(1000);
+ }
+ }
+
private class ClusterEventProcessor extends Thread {
@Override
public void run() {
http://git-wip-us.apache.org/repos/asf/helix/blob/af882ea0/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
index a6895cf..b61c100 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
@@ -125,7 +125,7 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
/**
* controller fields
*/
- private final GenericHelixController _controller;
+ private GenericHelixController _controller;
private CallbackHandler _leaderElectionHandler = null;
protected final List<HelixTimerTask> _controllerTimerTasks = new ArrayList<HelixTimerTask>();
@@ -216,21 +216,18 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
*/
switch (instanceType) {
case PARTICIPANT:
- _controller = null;
_stateMachineEngine = new HelixStateMachineEngine(this);
_participantHealthInfoCollector =
new ParticipantHealthReportCollectorImpl(this, _instanceName);
_timerTasks.add(new ParticipantHealthReportTask(_participantHealthInfoCollector));
break;
case CONTROLLER:
- _controller = new GenericHelixController();
_stateMachineEngine = null;
_participantHealthInfoCollector = null;
_controllerTimerTasks.add(new StatusDumpTask(this));
break;
case CONTROLLER_PARTICIPANT:
- _controller = new GenericHelixController();
_stateMachineEngine = new HelixStateMachineEngine(this);
_participantHealthInfoCollector =
new ParticipantHealthReportCollectorImpl(this, _instanceName);
@@ -240,7 +237,6 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
break;
case ADMINISTRATOR:
case SPECTATOR:
- _controller = null;
_stateMachineEngine = null;
_participantHealthInfoCollector = null;
break;
@@ -501,6 +497,21 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
return;
}
+ switch (_instanceType) {
+ case CONTROLLER:
+ if (_controller == null) {
+ _controller = new GenericHelixController();
+ }
+ break;
+ case CONTROLLER_PARTICIPANT:
+ if (_controller == null) {
+ _controller = new GenericHelixController();
+ }
+ break;
+ default:
+ break;
+ }
+
try {
createClient();
_messagingService.onConnected();
@@ -543,6 +554,19 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
_zkclient.close();
_zkclient = null;
LOG.info("Cluster manager: " + _instanceName + " disconnected");
+
+ if (_controller != null) {
+ try {
+ _controller.shutdown();
+ }
+ catch (InterruptedException e) {
+ LOG.info("Interrupted shutting down GenericHelixController", e);
+ }
+ finally {
+ _controller = null;
+ _leaderElectionHandler = null;
+ }
+ }
}
}
[4/4] helix git commit: [HELIX-550] ZKHelixManager should shutdown
GenericHelixController, minor fix
Posted by ka...@apache.org.
[HELIX-550] ZKHelixManager should shutdown GenericHelixController, minor fix
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/45a9fd3a
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/45a9fd3a
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/45a9fd3a
Branch: refs/heads/helix-0.6.x
Commit: 45a9fd3a960f6bb7b32c3135fb692ab23e8dc5a7
Parents: c85cf82
Author: Kanak Biscuitwala <ka...@hotmail.com>
Authored: Tue Nov 18 20:41:20 2014 -0800
Committer: Kanak Biscuitwala <ka...@hotmail.com>
Committed: Tue Nov 18 20:41:20 2014 -0800
----------------------------------------------------------------------
.../src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/45a9fd3a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
index 2c19396..6a1fb72 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
@@ -560,8 +560,7 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
_controller.shutdown();
} catch (InterruptedException e) {
LOG.info("Interrupted shutting down GenericHelixController", e);
- }
- finally {
+ } finally {
_controller = null;
_leaderElectionHandler = null;
}
[3/4] helix git commit: Merge branch 'HELIX-550' of
https://github.com/atcurtis/helix into helix-0.6.x (resolves #11)
Posted by ka...@apache.org.
Merge branch 'HELIX-550' of https://github.com/atcurtis/helix into helix-0.6.x (resolves #11)
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/c85cf826
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/c85cf826
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/c85cf826
Branch: refs/heads/helix-0.6.x
Commit: c85cf8269a51fcc72e166871a21e06de7a6acaff
Parents: 2eaea91 85e78d3
Author: Kanak Biscuitwala <ka...@hotmail.com>
Authored: Tue Nov 18 20:37:43 2014 -0800
Committer: Kanak Biscuitwala <ka...@hotmail.com>
Committed: Tue Nov 18 20:37:43 2014 -0800
----------------------------------------------------------------------
.../controller/GenericHelixController.java | 9 ++++++
.../apache/helix/manager/zk/ZKHelixManager.java | 33 +++++++++++++++++---
2 files changed, 37 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/c85cf826/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
----------------------------------------------------------------------
[2/4] helix git commit: apply review comments
Posted by ka...@apache.org.
apply review comments
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/85e78d3f
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/85e78d3f
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/85e78d3f
Branch: refs/heads/helix-0.6.x
Commit: 85e78d3f51ed0c4d1db84fed5829920f382e3b0f
Parents: af882ea
Author: Antony T Curtis <ac...@linkedin.com>
Authored: Tue Nov 18 20:34:51 2014 -0800
Committer: Antony T Curtis <ac...@linkedin.com>
Committed: Tue Nov 18 20:34:51 2014 -0800
----------------------------------------------------------------------
.../org/apache/helix/controller/GenericHelixController.java | 6 +++---
.../main/java/org/apache/helix/manager/zk/ZKHelixManager.java | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/85e78d3f/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
index 5e5ad5b..1c59aab 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
@@ -84,6 +84,7 @@ public class GenericHelixController implements ConfigChangeListener, IdealStateC
LiveInstanceChangeListener, MessageListener, CurrentStateChangeListener,
ControllerChangeListener, InstanceConfigChangeListener {
private static final Logger logger = Logger.getLogger(GenericHelixController.class.getName());
+ private static final long EVENT_THREAD_JOIN_TIMEOUT = 1000;
volatile boolean init = false;
private final PipelineRegistry _registry;
@@ -575,10 +576,9 @@ public class GenericHelixController implements ConfigChangeListener, IdealStateC
public void shutdown() throws InterruptedException {
stopRebalancingTimer();
- while (_eventThread.isAlive())
- {
+ while (_eventThread.isAlive()) {
_eventThread.interrupt();
- _eventThread.join(1000);
+ _eventThread.join(EVENT_THREAD_JOIN_TIMEOUT);
}
}
http://git-wip-us.apache.org/repos/asf/helix/blob/85e78d3f/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
index b61c100..2c19396 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
@@ -558,8 +558,7 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
if (_controller != null) {
try {
_controller.shutdown();
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
LOG.info("Interrupted shutting down GenericHelixController", e);
}
finally {