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 5
5
<parent >
6
6
<groupId >com.facebook.airlift</groupId >
7
7
<artifactId >airbase</artifactId >
8
- <version >98 </version >
8
+ <version >105 </version >
9
9
</parent >
10
10
11
11
<groupId >com.facebook.presto.hadoop</groupId >
462
462
<plugin >
463
463
<groupId >org.apache.maven.plugins</groupId >
464
464
<artifactId >maven-compiler-plugin</artifactId >
465
- <version >3.1</version >
466
465
<configuration >
467
466
<source >${project.build.targetJdk} </source >
468
467
<target >${project.build.targetJdk} </target >
472
471
<plugin >
473
472
<groupId >org.apache.maven.plugins</groupId >
474
473
<artifactId >maven-surefire-plugin</artifactId >
475
- <version >2.12.4</version >
476
474
</plugin >
477
475
478
476
<plugin >
479
477
<groupId >org.apache.maven.plugins</groupId >
480
478
<artifactId >maven-source-plugin</artifactId >
481
- <version >2.2.1</version >
482
479
<executions >
483
480
<execution >
484
481
<id >attach-sources</id >
Original file line number Diff line number Diff line change 16
16
import org .apache .hadoop .fs .FileSystem ;
17
17
import org .apache .hadoop .fs .PrestoFileSystemCache ;
18
18
19
- import java .lang .reflect .Field ;
20
- import java .lang .reflect .Modifier ;
21
-
22
19
public final class HadoopFileSystemCache
23
20
{
24
21
private static PrestoFileSystemCache cache ;
@@ -28,26 +25,9 @@ private HadoopFileSystemCache() {}
28
25
public static synchronized void initialize ()
29
26
{
30
27
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 ;
51
31
}
52
32
}
53
33
}
Original file line number Diff line number Diff line change @@ -211,7 +211,11 @@ public abstract class FileSystem
211
211
* FileSystem cache.
212
212
*/
213
213
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
+ }
215
219
216
220
/**
217
221
* The key this instance is stored under in the cache.
You can’t perform that action at this time.
0 commit comments