Is it possible to use the same client object for multiple requests simultaneously with the AWS Java SDK. For example, if I have a web server that processes several requests at the same time, and one or more requests need access to DynamoDB, is it safe to have a static client object for reading and writing with static access methods, for example.
public class DynamoDBManager { private static AmazonDynamoDBClient client = new AmazonDynamoDBClient(CREDENTIALS); public static void doRead(String hashKey) {
... or should I abandon the static modifiers in the client methods and object so that every time a web server request needs access to the database, it must create an instance of the manager class in order to get its own version of the client.
Will there be any problems or concurrency conflicts if the client object is static? I use DynamoDB here as an example, but I am also interested in the same scenario with the S3 client.
source share