Skip to content

Add @ThreadSafe or @NotThreadSafe annotations to each @SdkPublicApi in dynamodb-enhanced. #3136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.ConverterProviderResolver;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

Expand All @@ -24,6 +25,7 @@
* converting a given {@link EnhancedType}.
*/
@SdkPublicApi
@ThreadSafe
public interface AttributeConverterProvider {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;

@SdkPublicApi
@ThreadSafe
public enum AttributeValueType {
B(ScalarAttributeType.B), // binary
BOOL, // boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import software.amazon.awssdk.annotations.Immutable;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.PrimitiveConverter;
Expand Down Expand Up @@ -249,6 +250,7 @@ private static Builder getDefaultBuilder() {
/**
* A builder for configuring and creating {@link DefaultAttributeConverterProvider}s.
*/
@NotThreadSafe
public static class Builder {
private List<AttributeConverter<?>> converters = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;

/**
* A document representing a table item in the form of a map containing attributes and values.
* <p>
* Use the {@link #getItem(MappedTableResource)} method to transform the collection of attributes into a typed item.
*/
@SdkPublicApi
@ThreadSafe
public interface Document {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.function.Consumer;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.async.SdkPublisher;
import software.amazon.awssdk.enhanced.dynamodb.model.Page;
import software.amazon.awssdk.enhanced.dynamodb.model.QueryConditional;
Expand All @@ -33,6 +34,7 @@
* @param <T> The type of the modelled object.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbAsyncIndex<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest;
import software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedRequest;
import software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedResponse;
Expand Down Expand Up @@ -47,6 +48,7 @@
* @param <T> The type of the modelled object.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbAsyncTable<T> extends MappedTableResource<T> {
/**
* Returns a mapped index that can be used to execute commands against a secondary index belonging to the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.async.SdkPublisher;
import software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbEnhancedAsyncClient;
import software.amazon.awssdk.enhanced.dynamodb.model.BatchGetItemEnhancedRequest;
Expand All @@ -42,6 +44,7 @@
* implementing classes.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbEnhancedAsyncClient extends DynamoDbEnhancedResource {

/**
Expand Down Expand Up @@ -441,6 +444,7 @@ static DynamoDbEnhancedAsyncClient create() {
/**
* The builder definition for a {@link DynamoDbEnhancedAsyncClient}.
*/
@NotThreadSafe
interface Builder extends DynamoDbEnhancedResource.Builder {
/**
* The regular low-level SDK client to use with the enhanced client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.pagination.sync.SdkIterable;
import software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbEnhancedClient;
import software.amazon.awssdk.enhanced.dynamodb.model.BatchGetItemEnhancedRequest;
Expand All @@ -42,6 +44,7 @@
* implementing classes.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbEnhancedClient extends DynamoDbEnhancedResource {

/**
Expand Down Expand Up @@ -443,6 +446,7 @@ static DynamoDbEnhancedClient create() {
/**
* The builder definition for a {@link DynamoDbEnhancedClient}.
*/
@NotThreadSafe
interface Builder extends DynamoDbEnhancedResource.Builder {
/**
* The regular low-level SDK client to use with the enhanced client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.extensions.ReadModification;
import software.amazon.awssdk.enhanced.dynamodb.extensions.WriteModification;

Expand All @@ -29,6 +30,7 @@
* calculation.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbEnhancedClientExtension {
/**
* This hook is called just before an operation is going to write data to the database. The extension that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@
package software.amazon.awssdk.enhanced.dynamodb;

import java.util.List;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;

/**
* Shared interface components for {@link DynamoDbEnhancedClient} and {@link DynamoDbEnhancedAsyncClient}. Any common
* methods implemented by both of those classes or their builders are declared here.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbEnhancedResource {
/**
* Shared interface components for the builders of {@link DynamoDbEnhancedClient} and
* {@link DynamoDbEnhancedAsyncClient}
*/
@NotThreadSafe
interface Builder {
/**
* Specifies the extensions to load with the enhanced client. The extensions will be loaded in the strict order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@

import java.util.Map;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.internal.operations.OperationName;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

/**
* A wrapper for the immutable context objects that are visible to the {@link DynamoDbEnhancedClientExtension}s.
*/
@SdkPublicApi
@ThreadSafe
public final class DynamoDbExtensionContext {
private DynamoDbExtensionContext() {
}

@SdkPublicApi
@ThreadSafe
public interface Context {
/**
* @return The {@link AttributeValue} map of the items that is about to be written or has just been read.
Expand Down Expand Up @@ -57,6 +60,7 @@ default TableSchema<?> tableSchema() {
* The state of the execution when the {@link DynamoDbEnhancedClientExtension#beforeWrite} method is invoked.
*/
@SdkPublicApi
@ThreadSafe
public interface BeforeWrite extends Context {

/**
Expand All @@ -69,6 +73,7 @@ public interface BeforeWrite extends Context {
* The state of the execution when the {@link DynamoDbEnhancedClientExtension#afterRead} method is invoked.
*/
@SdkPublicApi
@ThreadSafe
public interface AfterRead extends Context {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.function.Consumer;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.pagination.sync.SdkIterable;
import software.amazon.awssdk.enhanced.dynamodb.model.Page;
import software.amazon.awssdk.enhanced.dynamodb.model.QueryConditional;
Expand All @@ -33,6 +34,7 @@
* @param <T> The type of the modelled object.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbIndex<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.function.Consumer;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.pagination.sync.SdkIterable;
import software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest;
import software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedRequest;
Expand Down Expand Up @@ -47,6 +48,7 @@
* @param <T> The type of the modelled object.
*/
@SdkPublicApi
@ThreadSafe
public interface DynamoDbTable<T> extends MappedTableResource<T> {
/**
* Returns a mapped index that can be used to execute commands against a secondary index belonging to the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
package software.amazon.awssdk.enhanced.dynamodb;


import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
* Configuration for {@link EnhancedType} of document type
*/
@SdkPublicApi
@ThreadSafe
public final class EnhancedTypeDocumentConfiguration implements ToCopyableBuilder<EnhancedTypeDocumentConfiguration.Builder,
EnhancedTypeDocumentConfiguration> {
private final boolean preserveEmptyObject;
Expand Down Expand Up @@ -82,6 +85,7 @@ public static Builder builder() {
return new Builder();
}

@NotThreadSafe
public static final class Builder implements CopyableBuilder<Builder, EnhancedTypeDocumentConfiguration> {
private Boolean preserveEmptyObject;
private Boolean ignoreNulls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

/**
Expand All @@ -42,6 +44,7 @@
* }
*/
@SdkPublicApi
@ThreadSafe
public final class Expression {
private final String expression;
private final Map<String, AttributeValue> expressionValues;
Expand Down Expand Up @@ -218,6 +221,7 @@ public int hashCode() {
/**
* A builder for {@link Expression}
*/
@NotThreadSafe
public static final class Builder {
private String expression;
private Map<String, AttributeValue> expressionValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

import java.util.Optional;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;

/**
* A metadata class that stores information about an index
*/
@SdkPublicApi
@ThreadSafe
public interface IndexMetadata {
/**
* The name of the index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import software.amazon.awssdk.annotations.NotThreadSafe;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.enhanced.dynamodb.internal.AttributeValues;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
Expand All @@ -36,6 +38,7 @@
* The names of the keys themselves are not part of this object.
*/
@SdkPublicApi
@ThreadSafe
public final class Key {
private final AttributeValue partitionValue;
private final AttributeValue sortValue;
Expand Down Expand Up @@ -111,6 +114,7 @@ public Builder toBuilder() {
/**
* Builder for {@link Key}
*/
@NotThreadSafe
public static final class Builder {
private AttributeValue partitionValue;
private AttributeValue sortValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;

/**
* A metadata class that stores information about a key attribute
*/
@SdkPublicApi
@ThreadSafe
public interface KeyAttributeMetadata {
/**
* The name of the key attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package software.amazon.awssdk.enhanced.dynamodb;

import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;

/**
* Interface for a resource object that is part of either a {@link DynamoDbTable} or {@link DynamoDbAsyncTable}. This
Expand All @@ -26,6 +27,7 @@
* @param <T> The type of the modelled object.
*/
@SdkPublicApi
@ThreadSafe
public interface MappedTableResource<T> {
/**
* Gets the {@link DynamoDbEnhancedClientExtension} associated with this mapped resource.
Expand Down
Loading