File tree Expand file tree Collapse file tree 3 files changed +9
-28
lines changed
com/facebook/presto/hadoop Expand file tree Collapse file tree 3 files changed +9
-28
lines changed Original file line number Diff line number Diff line change 55 <parent >
66 <groupId >com.facebook.airlift</groupId >
77 <artifactId >airbase</artifactId >
8- <version >98 </version >
8+ <version >105 </version >
99 </parent >
1010
1111 <groupId >com.facebook.presto.hadoop</groupId >
462462 <plugin >
463463 <groupId >org.apache.maven.plugins</groupId >
464464 <artifactId >maven-compiler-plugin</artifactId >
465- <version >3.1</version >
466465 <configuration >
467466 <source >${project.build.targetJdk} </source >
468467 <target >${project.build.targetJdk} </target >
472471 <plugin >
473472 <groupId >org.apache.maven.plugins</groupId >
474473 <artifactId >maven-surefire-plugin</artifactId >
475- <version >2.12.4</version >
476474 </plugin >
477475
478476 <plugin >
479477 <groupId >org.apache.maven.plugins</groupId >
480478 <artifactId >maven-source-plugin</artifactId >
481- <version >2.2.1</version >
482479 <executions >
483480 <execution >
484481 <id >attach-sources</id >
Original file line number Diff line number Diff line change 1616import org .apache .hadoop .fs .FileSystem ;
1717import org .apache .hadoop .fs .PrestoFileSystemCache ;
1818
19- import java .lang .reflect .Field ;
20- import java .lang .reflect .Modifier ;
21-
2219public final class HadoopFileSystemCache
2320{
2421 private static PrestoFileSystemCache cache ;
@@ -28,26 +25,9 @@ private HadoopFileSystemCache() {}
2825 public static synchronized void initialize ()
2926 {
3027 if (cache == null ) {
31- cache = setFinalStatic (FileSystem .class , "CACHE" , new PrestoFileSystemCache ());
32- }
33- }
34-
35- private static <T > T setFinalStatic (Class <?> clazz , String name , T value )
36- {
37- try {
38- Field field = clazz .getDeclaredField (name );
39- field .setAccessible (true );
40-
41- Field modifiersField = Field .class .getDeclaredField ("modifiers" );
42- modifiersField .setAccessible (true );
43- modifiersField .setInt (field , field .getModifiers () & ~Modifier .FINAL );
44-
45- field .set (null , value );
46-
47- return value ;
48- }
49- catch (ReflectiveOperationException e ) {
50- throw new AssertionError (e );
28+ PrestoFileSystemCache newCache = new PrestoFileSystemCache ();
29+ FileSystem .setCache (newCache );
30+ cache = newCache ;
5131 }
5232 }
5333}
Original file line number Diff line number Diff line change @@ -211,7 +211,11 @@ public abstract class FileSystem
211211 * FileSystem cache.
212212 */
213213
214- static final Cache CACHE = new Cache (new Configuration ());
214+ static Cache CACHE = new Cache (new Configuration ());
215+
216+ public static void setCache (Cache newCache ) {
217+ CACHE = newCache ;
218+ }
215219
216220 /**
217221 * The key this instance is stored under in the cache.
You can’t perform that action at this time.
0 commit comments