5252import java .security .PrivilegedExceptionAction ;
5353import java .util .ArrayList ;
5454import java .util .List ;
55+ import java .util .Locale ;
5556import java .util .function .Supplier ;
5657
5758public class HdfsFixture extends ExternalResource {
5859
5960 private static final Logger LOGGER = LoggerFactory .getLogger (HdfsFixture .class );
61+ private static final Object STATIC_CONFIG_LOCK = new Object ();
6062
6163 private TemporaryFolder temporaryFolder = new TemporaryFolder ();
6264 private MiniDFSCluster dfs ;
@@ -81,9 +83,20 @@ public HdfsFixture withKerberos(Supplier<String> principalConfig, Supplier<Path>
8183
8284 @ Override
8385 protected void before () throws Throwable {
84- temporaryFolder .create ();
85- assumeHdfsAvailable ();
86- startMinHdfs ();
86+ // Save current locale and set to English for consistent HDFS startup behavior
87+ Locale originalLocale = Locale .getDefault ();
88+ // Synchronize to prevent race conditions in concurrent test execution
89+ synchronized (STATIC_CONFIG_LOCK ) {
90+ try {
91+ Locale .setDefault (Locale .ENGLISH );
92+ temporaryFolder .create ();
93+ assumeHdfsAvailable ();
94+ startMinHdfs ();
95+ } finally {
96+ // Restore original locale
97+ Locale .setDefault (originalLocale );
98+ }
99+ }
87100 }
88101
89102 private void assumeHdfsAvailable () {
@@ -458,7 +471,7 @@ public void close() {
458471
459472 @ SuppressWarnings ({ "unchecked" , "rawtypes" })
460473 public static void refreshKrb5Config () throws ClassNotFoundException , NoSuchMethodException , IllegalArgumentException ,
461- IllegalAccessException , InvocationTargetException , InvocationTargetException {
474+ IllegalAccessException , InvocationTargetException {
462475 Class classRef ;
463476 if (System .getProperty ("java.vendor" ).contains ("IBM" )) {
464477 classRef = Class .forName ("com.ibm.security.krb5.internal.Config" );
0 commit comments