|
18 | 18 | package org.apache.hadoop.hive.ql.exec.tez; |
19 | 19 |
|
20 | 20 | import org.apache.hadoop.hive.common.JavaVersionUtils; |
21 | | -import org.apache.hadoop.registry.client.api.RegistryOperations; |
22 | 21 |
|
23 | 22 | import java.io.File; |
24 | 23 | import java.io.IOException; |
@@ -308,7 +307,11 @@ protected void openInternal(String[] additionalFilesNotFromConf, |
308 | 307 | addJarLRByClass(LlapTaskSchedulerService.class, commonLocalResources); |
309 | 308 | addJarLRByClass(LlapProtocolClientImpl.class, commonLocalResources); |
310 | 309 | addJarLRByClass(LlapProtocolClientProxy.class, commonLocalResources); |
311 | | - addJarLRByClass(RegistryOperations.class, commonLocalResources); |
| 310 | + addJarLRByClassName( |
| 311 | + getClass().getClassLoader(), |
| 312 | + "org.apache.hadoop.registry.client.api.RegistryOperations", |
| 313 | + commonLocalResources |
| 314 | + ); |
312 | 315 | } |
313 | 316 |
|
314 | 317 | // Create environment for AM. |
@@ -852,15 +855,27 @@ private String getKey(final FileStatus fileStatus) { |
852 | 855 | return fileStatus.getPath() + ":" + fileStatus.getLen() + ":" + fileStatus.getModificationTime(); |
853 | 856 | } |
854 | 857 |
|
| 858 | + private void addJarLRByPath(String jarPath, final Map<String, LocalResource> lrMap) throws IOException { |
| 859 | + final File jar = new File(jarPath); |
| 860 | + final String localJarPath = jar.toURI().toURL().toExternalForm(); |
| 861 | + final LocalResource jarLr = createJarLocalResource(localJarPath); |
| 862 | + lrMap.put(DagUtils.getBaseName(jarLr), jarLr); |
| 863 | + } |
| 864 | + |
855 | 865 | private void addJarLRByClass(Class<?> clazz, final Map<String, LocalResource> lrMap) throws IOException { |
856 | 866 | String jarPath = Utilities.jarFinderGetJar(clazz); |
857 | 867 | if (jarPath == null) { |
858 | 868 | throw new IOException("Can't find jar for: " + clazz); |
859 | 869 | } |
860 | | - final File jar = new File(jarPath); |
861 | | - final String localJarPath = jar.toURI().toURL().toExternalForm(); |
862 | | - final LocalResource jarLr = createJarLocalResource(localJarPath); |
863 | | - lrMap.put(DagUtils.getBaseName(jarLr), jarLr); |
| 870 | + addJarLRByPath(jarPath, lrMap); |
| 871 | + } |
| 872 | + |
| 873 | + private void addJarLRByClassName(ClassLoader loader, String className, final Map<String, LocalResource> lrMap) throws IOException { |
| 874 | + String jarPath = Utilities.jarFinderGetJar(loader, className); |
| 875 | + if (jarPath == null) { |
| 876 | + throw new IOException("Can't find jar for: " + className); |
| 877 | + } |
| 878 | + addJarLRByPath(jarPath, lrMap); |
864 | 879 | } |
865 | 880 |
|
866 | 881 | private String getSha(final Path localFile) throws IOException, IllegalArgumentException { |
|
0 commit comments