Skip to content

Commit 401edde

Browse files
author
manishbhatt
committed
Abfs Client Timer Thread Name Constant and getTimer method protected
1 parent 99e1cc9 commit 401edde

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
public abstract class AbfsClient implements Closeable {
132132
public static final Logger LOG = LoggerFactory.getLogger(AbfsClient.class);
133133
public static final String HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + HUNDRED_CONTINUE + SEMICOLON;
134+
public static final String ABFS_CLIENT_TIMER_THREAD_NAME = "abfs-timer-client";
134135

135136
private final URL baseUrl;
136137
private final SharedKeyCredentials sharedKeyCredentials;
@@ -260,7 +261,7 @@ private AbfsClient(final URL baseUrl,
260261
}
261262
if (isMetricCollectionEnabled) {
262263
this.timer = new Timer(
263-
"abfs-timer-client", true);
264+
ABFS_CLIENT_TIMER_THREAD_NAME, true);
264265
timer.schedule(new TimerTaskImpl(),
265266
metricIdlePeriod,
266267
metricIdlePeriod);
@@ -1598,7 +1599,7 @@ KeepAliveCache getKeepAliveCache() {
15981599
}
15991600

16001601
@VisibleForTesting
1601-
Timer getTimer() {
1602+
protected Timer getTimer() {
16021603
return timer;
16031604
}
16041605

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_ACCOUNT_KEY;
3636
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_ACCOUNT_NAME;
3737
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_METRIC_FORMAT;
38+
import static org.apache.hadoop.fs.azurebfs.services.AbfsClient.ABFS_CLIENT_TIMER_THREAD_NAME;
3839

3940
public class TestAbfsClient {
4041
private static final String ACCOUNT_NAME = "bogusAccountName.dfs.core.windows.net";
@@ -61,7 +62,7 @@ public void testTimerNotInitialize() throws Exception {
6162
.isNull();
6263

6364
// Check if a thread with the name "abfs-timer-client" exists
64-
Assertions.assertThat(isThreadRunning("abfs-timer-client"))
65+
Assertions.assertThat(isThreadRunning(ABFS_CLIENT_TIMER_THREAD_NAME))
6566
.describedAs("Expected thread 'abfs-timer-client' not found")
6667
.isEqualTo(false);
6768
client.close();
@@ -91,7 +92,7 @@ public void testTimerInitialize() throws Exception {
9192
.isNotNull();
9293

9394
// Check if a thread with the name "abfs-timer-client" exists
94-
Assertions.assertThat(isThreadRunning("abfs-timer-client"))
95+
Assertions.assertThat(isThreadRunning(ABFS_CLIENT_TIMER_THREAD_NAME))
9596
.describedAs("Expected thread 'abfs-timer-client' not found")
9697
.isEqualTo(true);
9798
client.close();

0 commit comments

Comments
 (0)