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

gefragt vor 8 Monaten209 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 8 Monaten
profile picture
EXPERTE
überprüft vor 8 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen