Avoiding premature helix manager closure
@@ -34,7 +34,6 @@ public class WorkflowCancellationTask extends AbstractTask {
super.init(manager, workflowName, jobName, taskName);
try {
-
helixManager = HelixManagerFactory.getZKHelixManager(ServerSettings.getSetting("helix.cluster.name"), taskName,
InstanceType.SPECTATOR, ServerSettings.getZookeeperConnection());
helixManager.connect();
@@ -47,19 +46,18 @@ public class WorkflowCancellationTask extends AbstractTask {
);
taskDriver = new TaskDriver(helixManager);
} catch (Exception e) {
- logger.error("Failed to build Helix Task driver in " + taskName, e);
- throw new RuntimeException("Failed to build Helix Task driver in " + taskName, e);
- } finally {
-
try {
if (helixManager != null) {
if (helixManager.isConnected()) {
helixManager.disconnect();
}
}
- } catch (Exception e) {
- logger.warn("Failed to disconnect helix manager", e);
+ } catch (Exception ex) {
+ logger.warn("Failed to disconnect helix manager", ex);
}
+
+ logger.error("Failed to build Helix Task driver in " + taskName, e);
+ throw new RuntimeException("Failed to build Helix Task driver in " + taskName, e);
}
}
