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

質問済み 8ヶ月前209ビュー
1回答
0
承認された回答

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
エキスパート
回答済み 8ヶ月前
profile picture
エキスパート
レビュー済み 8ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ