-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Remove @LegacyFileIO and Make DelegationRefreshToken use ne…
…w cluster.yaml (#100) Refactor: Remove @LegacyFileIO and Make DelegationRefreshToken use new cluster.yaml (#100)
- Loading branch information
Showing
13 changed files
with
287 additions
and
134 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
...linkedin/openhouse/cluster/storage/filesystem/DelegationTokenRefreshSchedulingConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
.../java/com/linkedin/openhouse/cluster/storage/hdfs/HdfsDelegationTokenRefresherConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.linkedin.openhouse.cluster.storage.hdfs; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
/** | ||
* Configuration class to conditionally enable/disable creation of {@link | ||
* HdfsDelegationTokenRefresher} bean and enable delegation token refresh scheduling. | ||
*/ | ||
@Slf4j | ||
@Configuration | ||
@EnableScheduling | ||
public class HdfsDelegationTokenRefresherConfig { | ||
|
||
@Autowired private HdfsStorage hdfsStorage; | ||
|
||
private static final String HDFS_TOKEN_REFRESH_ENABLED = "token.refresh.enabled"; | ||
|
||
/** | ||
* Conditionally provide the HdfsDelegationTokenRefresher bean if the parameter for token refresh | ||
* is enabled in the HdfsStorage properties. The relevant configuration in the cluster YAML file | ||
* is as follows: | ||
* | ||
* <pre> | ||
* cluster: | ||
* storages: | ||
* hdfs: | ||
* parameter: | ||
* token.refresh.enabled: true | ||
* </pre> | ||
* | ||
* @return HdfsDelegationTokenRefresher | ||
*/ | ||
@Bean | ||
public HdfsDelegationTokenRefresher getDelegationTokenRefresher() { | ||
if (!hdfsStorage.isConfigured()) { | ||
log.debug( | ||
"Hdfs storage is not configured, ignoring HdfsDelegationTokenRefresher bean creation"); | ||
return null; | ||
} | ||
String refreshEnabled = | ||
hdfsStorage.getProperties().getOrDefault(HDFS_TOKEN_REFRESH_ENABLED, "false"); | ||
if (Boolean.parseBoolean(refreshEnabled)) { | ||
log.info("Creating HdfsDelegationTokenRefresher bean"); | ||
return new HdfsDelegationTokenRefresher(); | ||
} else { | ||
log.debug( | ||
"Hdfs storage token refresh is not enabled, ignoring HdfsDelegationTokenRefresher bean creation"); | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.