From 4384a49cbed68c17b410afee97abd69799617e57 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Thu, 04 Oct 2007 20:36:33 +0000
Subject: [PATCH] Use ConcurrentHashMap for the secret key caches to make access to them thread-safe.

---
 opends/src/server/org/opends/server/types/CryptoManager.java |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/types/CryptoManager.java b/opends/src/server/org/opends/server/types/CryptoManager.java
index e94d9fa..7ac8b8e 100644
--- a/opends/src/server/org/opends/server/types/CryptoManager.java
+++ b/opends/src/server/org/opends/server/types/CryptoManager.java
@@ -37,6 +37,7 @@
 import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.zip.DataFormatException;
 import java.util.zip.Deflater;
 import java.util.zip.Inflater;
@@ -131,8 +132,8 @@
   private final String preferredDigestAlgorithm;
 
   // The map from encryption key ID to MacKeyEntry (cache).
-  private final HashMap<KeyEntryID, MacKeyEntry> macKeyEntryCache
-          = new HashMap<KeyEntryID, MacKeyEntry>();
+  private final Map<KeyEntryID, MacKeyEntry> macKeyEntryCache
+          = new ConcurrentHashMap<KeyEntryID, MacKeyEntry>();
 
   // The preferred MAC algorithm for the Directory Server.
   private final String preferredMACAlgorithm;
@@ -141,8 +142,8 @@
   private final int preferredMACAlgorithmKeyLengthBits;
 
   // The map from encryption key ID to CipherKeyEntry (cache).
-  private final HashMap<KeyEntryID, CipherKeyEntry>
-      cipherKeyEntryCache = new HashMap<KeyEntryID, CipherKeyEntry>();
+  private final Map<KeyEntryID, CipherKeyEntry> cipherKeyEntryCache
+       = new ConcurrentHashMap<KeyEntryID, CipherKeyEntry>();
 
   // The preferred cipher for the Directory Server.
   private final String preferredCipherTransformation;

--
Gitblit v1.10.0