|
45 | 45 | import java.util.Stack; |
46 | 46 | import java.util.concurrent.TimeUnit; |
47 | 47 | import java.util.function.Predicate; |
| 48 | +import java.util.function.Supplier; |
48 | 49 | import java.util.regex.Matcher; |
49 | 50 | import java.util.regex.Pattern; |
50 | 51 | import java.util.zip.ZipOutputStream; |
@@ -179,13 +180,13 @@ public class DagUtils { |
179 | 180 | public static final String TEZ_TMP_DIR_KEY = "_hive_tez_tmp_dir"; |
180 | 181 | private static final Logger LOG = LoggerFactory.getLogger(DagUtils.class.getName()); |
181 | 182 | private static final String TEZ_DIR = "_tez_scratch_dir"; |
182 | | - private static final DagUtils instance = new DagUtils(defaultCredentialSuppliers()); |
| 183 | + private static final DagUtils instance = new DagUtils(DagUtils::defaultCredentialSuppliers); |
183 | 184 | // The merge file being currently processed. |
184 | 185 | public static final String TEZ_MERGE_CURRENT_MERGE_FILE_PREFIX = |
185 | 186 | "hive.tez.current.merge.file.prefix"; |
186 | 187 | // A comma separated list of work names used as prefix. |
187 | 188 | public static final String TEZ_MERGE_WORK_FILE_PREFIXES = "hive.tez.merge.file.prefixes"; |
188 | | - private final List<DagCredentialSupplier> credentialSuppliers; |
| 189 | + private final Supplier<List<DagCredentialSupplier>> credentialSuppliers; |
189 | 190 | /** |
190 | 191 | * Notifiers to synchronize resource localization across threads. If one thread is localizing |
191 | 192 | * a file, other threads can wait on the corresponding notifier object instead of just sleeping |
@@ -286,7 +287,7 @@ private void getCredentialsFromSuppliers(BaseWork work, Set<TableDesc> tables, D |
286 | 287 | if (!UserGroupInformation.isSecurityEnabled()){ |
287 | 288 | return; |
288 | 289 | } |
289 | | - for (DagCredentialSupplier supplier : credentialSuppliers) { |
| 290 | + for (DagCredentialSupplier supplier : credentialSuppliers.get()) { |
290 | 291 | Text alias = supplier.getTokenAlias(); |
291 | 292 | Token<?> t = dag.getCredentials().getToken(alias); |
292 | 293 | if (t != null) { |
@@ -1697,7 +1698,7 @@ public static String getUserSpecifiedDagName(Configuration conf) { |
1697 | 1698 | } |
1698 | 1699 |
|
1699 | 1700 | @VisibleForTesting |
1700 | | - DagUtils(List<DagCredentialSupplier> suppliers) { |
| 1701 | + DagUtils(Supplier<List<DagCredentialSupplier>> suppliers) { |
1701 | 1702 | this.credentialSuppliers = suppliers; |
1702 | 1703 | } |
1703 | 1704 |
|
|
0 commit comments