Skip to content

Instantly share code, notes, and snippets.

@richardgrantserverless
Created April 11, 2022 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardgrantserverless/bad4f07c3614ecb15075afc403556a11 to your computer and use it in GitHub Desktop.
Save richardgrantserverless/bad4f07c3614ecb15075afc403556a11 to your computer and use it in GitHub Desktop.
package com.serverless.dal;
...
public class DynamoDBAdapter {
...
private DynamoDBAdapter() {
this.client = AmazonDynamoDBClientBuilder.standard()
.withRegion(Regions.US_EAST_1)
.build();
}
public static DynamoDBAdapter getInstance() {
if (db_adapter == null)
db_adapter = new DynamoDBAdapter();
return db_adapter;
}
...
public DynamoDBMapper createDbMapper(DynamoDBMapperConfig mapperConfig) {
if (this.client != null)
mapper = new DynamoDBMapper(this.client, mapperConfig);
return this.mapper;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment