is KmsMasterKeyProvider shareable

0

I checked the code of the class KmsMasterKeyProvider there are List<String>, so, I'm a bit unsure if this class can be shared among multiple threads, or if it's a good practice to share it in the first place. Could anyone help me? I'm using aws-encryption-sdk-java 2.4.1.

Thanks

feita há 8 meses209 visualizações
1 Resposta
0
Resposta aceita

Hi,

Have a look at the Javadoc: it states clearly that some methods are not thead safe.

See https://aws.github.io/aws-encryption-sdk-java/com/amazonaws/encryptionsdk/kms/KmsMasterKeyProvider.html#:~:text=Method%20Summary&text=This%20method%20is%20inherently%20not,the%20list%20of%20grant%20tokens.

This method is inherently not thread safe. Use withGrantTokens(List) or 
KmsMasterKey.setGrantTokens(List) instead. KmsMasterKeyProviders constructed using 
the builder will throw an exception on attempts to modify the list of grant tokens.

So, you should avoid this (deprecated) method to become thread safe.

Best,

Didier

profile pictureAWS
ESPECIALISTA
respondido há 8 meses
profile picture
ESPECIALISTA
avaliado há 8 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas