phet commented on code in PR #3891:
URL: https://github.com/apache/gobblin/pull/3891#discussion_r1518140960
##########
gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinYarnAppLauncher.java:
##########
@@ -898,49 +858,31 @@ private Path getHdfsLogDir(Path appWorkDir) throws
IOException {
return logRootDir;
}
- private AbstractYarnAppSecurityManager buildSecurityManager() throws
IOException {
+ /**
+ *
+ * @return
+ * @throws IOException
+ */
+ private AbstractAppSecurityManager buildSecurityManager() throws IOException
{
Path tokenFilePath = new Path(this.fs.getHomeDirectory(),
this.applicationName + Path.SEPARATOR +
GobblinYarnConfigurationKeys.TOKEN_FILE_NAME);
+ String securityManagerClassName = ConfigUtils.getString(config,
GobblinYarnConfigurationKeys.SECURITY_MANAGER_CLASS,
GobblinYarnConfigurationKeys.DEFAULT_SECURITY_MANAGER_CLASS);
- ClassAliasResolver<AbstractYarnAppSecurityManager> aliasResolver = new
ClassAliasResolver<>(
- AbstractYarnAppSecurityManager.class);
try {
- return (AbstractYarnAppSecurityManager)
GobblinConstructorUtils.invokeLongestConstructor(Class.forName(aliasResolver.resolve(
- ConfigUtils.getString(config,
GobblinYarnConfigurationKeys.SECURITY_MANAGER_CLASS,
GobblinYarnConfigurationKeys.DEFAULT_SECURITY_MANAGER_CLASS))), this.config,
this.helixManager, this.fs,
- tokenFilePath);
+ if (helixClusterLifecycleManager.isPresent()) {
+ HelixManager helixManager =
helixClusterLifecycleManager.get().getHelixManager();
+ ClassAliasResolver<AbstractYarnAppSecurityManager> aliasResolver = new
ClassAliasResolver<>(AbstractYarnAppSecurityManager.class);
+ return (AbstractYarnAppSecurityManager)
GobblinConstructorUtils.invokeLongestConstructor(Class.forName(aliasResolver.resolve(securityManagerClassName)),
this.config, helixManager, this.fs,
+ tokenFilePath);
+ }
+
+ ClassAliasResolver aliasResolver = new
ClassAliasResolver<>(AbstractAppSecurityManager.class);
+ return (AbstractAppSecurityManager)
GobblinConstructorUtils.invokeLongestConstructor(Class.forName(aliasResolver.resolve(securityManagerClassName)),
this.config, this.fs, tokenFilePath);
Review Comment:
somewhat confusing to have alt. `ClassAliasResolver`s, one typed and the
other `CAR<?>`.
couldn't we combine into one code path by taking advantage of the ctor
allowing `null` as the second param, then:
```
helixClusterLifecycleManager.map(HCLM::getHelixManager).orElse(null)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]