Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/1642#discussion_r77417627
--- Diff:
storm-core/src/jvm/org/apache/storm/daemon/supervisor/RunAsUserContainerLauncher.java
---
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.storm.daemon.supervisor;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.storm.container.ResourceIsolationInterface;
+import org.apache.storm.generated.LocalAssignment;
+import org.apache.storm.utils.LocalState;
+
+public class RunAsUserContainerLauncher extends ContainerLauncher {
+ private final Map<String, Object> _conf;
+ private final String _supervisorId;
+ protected final ResourceIsolationInterface _resourceIsolationManager;
+
+ public RunAsUserContainerLauncher(Map<String, Object> conf, String
supervisorId, ResourceIsolationInterface resourceIsolationManager) throws
IOException {
+ _conf = conf;
+ _supervisorId = supervisorId;
+ _resourceIsolationManager = resourceIsolationManager;
+ }
+
+ @Override
+ public Container launchContainer(int port, LocalAssignment assignment,
LocalState state) throws IOException {
+ Container container = new RunAsUserContainer(port, assignment,
_conf, _supervisorId, state,
+ _resourceIsolationManager, false);
+ container.setup();
+ container.launch();
+ return container;
+ }
+
+ @Override
+ public Container recoverContainer(int port, LocalAssignment
assignment, LocalState state) throws IOException {
+ Container container = null;
+ try {
+ container = new RunAsUserContainer(port, assignment, _conf,
_supervisorId, state,
+ _resourceIsolationManager, true);
+ } catch (ContainerRecoveryException e) {
+ // We could not recover return null
+ }
+ return container;
+ }
+
+ @Override
+ public Killable recoverContainer(String workerId) throws IOException {
+ Container container = null;
+ try {
+ container = new RunAsUserContainer(workerId, _conf,
_supervisorId,
+ _resourceIsolationManager);
+ } catch (ContainerRecoveryException e) {
+ // We could not recover return null
+ }
+ return container;
+ }
--- End diff --
But then the ContainerRecoveryException will not be turned into a null. We
can change that everywhere, but for now it is an implementation detail that is
hidden.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---