@@ -98,17 +98,6 @@ public class S3FileSystemProvider extends FileSystemProvider {
98
98
static final String SCHEME = "s3" ;
99
99
private static final Map <String , S3FileSystem > FS_CACHE = new ConcurrentHashMap <>();
100
100
101
- /**
102
- * This variable holds the configuration for the S3 NIO Service Provider Interface (SPI).
103
- * It is used to manage and handle the configuration details required for interaction
104
- * with S3 NIO services.
105
- *
106
- * @deprecated This variable is deprecated and may be removed in future versions.
107
- * Consider using updated configuration mechanisms if available.
108
- */
109
- @ Deprecated
110
- protected S3NioSpiConfiguration configuration = new S3NioSpiConfiguration ();
111
-
112
101
private final Logger logger = LoggerFactory .getLogger (this .getClass ().getName ());
113
102
114
103
/**
@@ -393,11 +382,12 @@ public void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOExcept
393
382
directoryKey = directoryKey + PATH_SEPARATOR ;
394
383
}
395
384
396
- var timeOut = configuration .getTimeoutLow ();
385
+ var s3FileSystem = s3Directory .getFileSystem ();
386
+ var timeOut = s3FileSystem .getConfiguration ().getTimeoutLow ();
397
387
final var unit = MINUTES ;
398
388
399
389
try {
400
- s3Directory . getFileSystem () .client ().putObject (
390
+ s3FileSystem .client ().putObject (
401
391
PutObjectRequest .builder ()
402
392
.bucket (s3Directory .bucketName ())
403
393
.key (directoryKey )
@@ -426,9 +416,10 @@ public void delete(Path path) throws IOException {
426
416
final var prefix = s3Path .toRealPath (NOFOLLOW_LINKS ).getKey ();
427
417
final var bucketName = s3Path .bucketName ();
428
418
429
- final var s3Client = s3Path .getFileSystem ().client ();
419
+ final var s3FileSystem = s3Path .getFileSystem ();
420
+ final var s3Client = s3FileSystem .client ();
430
421
431
- var timeOut = configuration .getTimeoutLow ();
422
+ var timeOut = s3FileSystem . getConfiguration () .getTimeoutLow ();
432
423
final var unit = MINUTES ;
433
424
try {
434
425
var keys = s3Path .isDirectory () ?
@@ -479,10 +470,11 @@ public void copy(Path source, Path target, CopyOption... options) throws IOExcep
479
470
var s3SourcePath = checkPath (source );
480
471
var s3TargetPath = checkPath (target );
481
472
482
- final var s3Client = s3SourcePath .getFileSystem ().client ();
473
+ final var s3FileSystem = s3SourcePath .getFileSystem ();
474
+ final var s3Client = s3FileSystem .client ();
483
475
final var sourceBucket = s3SourcePath .bucketName ();
484
476
485
- final var timeOut = configuration .getTimeoutHigh ();
477
+ final var timeOut = s3FileSystem . getConfiguration () .getTimeoutHigh ();
486
478
final var unit = MINUTES ;
487
479
488
480
var fileExistsAndCannotReplace = cannotReplaceAndFileExistsCheck (options , s3Client );
@@ -654,7 +646,7 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException {
654
646
final var s3Path = checkPath (path .toRealPath (NOFOLLOW_LINKS ));
655
647
final var response = getCompletableFutureForHead (s3Path );
656
648
657
- var timeOut = configuration .getTimeoutLow ();
649
+ var timeOut = s3Path . getFileSystem (). getConfiguration () .getTimeoutLow ();
658
650
var unit = MINUTES ;
659
651
660
652
try {
@@ -758,8 +750,9 @@ public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type
758
750
var s3Path = checkPath (path );
759
751
760
752
if (type .equals (BasicFileAttributes .class )) {
753
+ var timeoutLow = s3Path .getFileSystem ().getConfiguration ().getTimeoutLow ();
761
754
@ SuppressWarnings ("unchecked" )
762
- var a = (A ) S3BasicFileAttributes .get (s3Path , Duration .ofMinutes (configuration . getTimeoutLow () ));
755
+ var a = (A ) S3BasicFileAttributes .get (s3Path , Duration .ofMinutes (timeoutLow ));
763
756
return a ;
764
757
} else {
765
758
throw new UnsupportedOperationException ("cannot read attributes of type: " + type );
@@ -795,8 +788,9 @@ public Map<String, Object> readAttributes(Path path, String attributes, LinkOpti
795
788
return Collections .emptyMap ();
796
789
}
797
790
791
+ var timeoutLow = s3Path .getFileSystem ().getConfiguration ().getTimeoutLow ();
798
792
var attributesFilter = attributesFilterFor (attributes );
799
- return S3BasicFileAttributes .get (s3Path , Duration .ofMinutes (configuration . getTimeoutLow () )).asMap (attributesFilter );
793
+ return S3BasicFileAttributes .get (s3Path , Duration .ofMinutes (timeoutLow )).asMap (attributesFilter );
800
794
}
801
795
802
796
/**
@@ -810,19 +804,6 @@ public void setAttribute(Path path, String attribute, Object value, LinkOption..
810
804
throw new UnsupportedOperationException ("s3 file attributes cannot be modified by this class" );
811
805
}
812
806
813
- /**
814
- * Set custom configuration. This configuration is referred to for API timeouts.
815
- *
816
- * @param configuration The new configuration containing the timeout info
817
- *
818
- * @deprecated This method is deprecated and may be removed in future versions.
819
- *
820
- */
821
- @ Deprecated
822
- public void setConfiguration (S3NioSpiConfiguration configuration ) {
823
- this .configuration = configuration ;
824
- }
825
-
826
807
/**
827
808
* @param path the path of the file to open or create
828
809
* @param options options specifying how the file is opened
@@ -894,8 +875,9 @@ private void closeFileSystemIfOpen(FileSystem fs) throws IOException {
894
875
895
876
boolean exists (S3AsyncClient s3Client , S3Path path ) throws InterruptedException , TimeoutException {
896
877
try {
878
+ var timeoutLow = path .getFileSystem ().getConfiguration ().getTimeoutLow ();
897
879
s3Client .headObject (HeadObjectRequest .builder ().bucket (path .bucketName ()).key (path .getKey ()).build ())
898
- .get (configuration . getTimeoutLow () , MINUTES );
880
+ .get (timeoutLow , MINUTES );
899
881
return true ;
900
882
} catch (ExecutionException | NoSuchKeyException e ) {
901
883
logger .debug ("Could not retrieve object head information" , e );
0 commit comments