homatthew commented on code in PR #3891:
URL: https://github.com/apache/gobblin/pull/3891#discussion_r1523928137
##########
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:
The gobblin constructor utils will catastrophically fail if you pass null as
a second param because it's not possible to infer the type of null. Hence we
have the 2 separate code paths
--
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]