software.amazon.nio.spi.s3.CacheableS3Client Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-nio-spi-for-s3 Show documentation
Show all versions of aws-java-nio-spi-for-s3 Show documentation
A Java NIO.2 service provider for S3, allowing Java NIO operations to be performed on paths using the `s3` scheme. This
package implements the service provider interface (SPI) defined for Java NIO.2 in JDK 1.7 providing "plug-in" non-blocking
access to S3 objects for Java applications using Java NIO.2 for file access.
The newest version!
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package software.amazon.nio.spi.s3;
import software.amazon.awssdk.services.s3.DelegatingS3AsyncClient;
import software.amazon.awssdk.services.s3.S3AsyncClient;
/**
* A wrapper around an {@code S3AsyncClient} that can be used in a cache. It keeps track of the "closed" status of the wrapped
* client and adds a {@code boolean isClosed()} method that can be used to determine if any client returned by the cache has
* been previously closed. All other method calls are delegated to the wrapped client.
*/
public class CacheableS3Client extends DelegatingS3AsyncClient {
private boolean closed = false;
public CacheableS3Client(S3AsyncClient client) {
super(client);
}
@Override
public void close() {
this.closed = true;
super.close();
}
public boolean isClosed() {
return closed;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy