mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-01-09 11:48:00 +01:00
algorithm: Use ConcurrentHashMap instead of HashMap
Signed-off-by: Paul Schaub <vanitasvitae@fsfe.org>
This commit is contained in:
parent
2c816dd84c
commit
8780d5a7b0
5 changed files with 11 additions and 11 deletions
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.algorithm;
|
package org.pgpainless.algorithm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
|
import org.bouncycastle.bcpg.CompressionAlgorithmTags;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public enum CompressionAlgorithm {
|
||||||
BZIP2 (CompressionAlgorithmTags.BZIP2),
|
BZIP2 (CompressionAlgorithmTags.BZIP2),
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Integer, CompressionAlgorithm> MAP = new HashMap<>();
|
private static final Map<Integer, CompressionAlgorithm> MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (CompressionAlgorithm c : CompressionAlgorithm.values()) {
|
for (CompressionAlgorithm c : CompressionAlgorithm.values()) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.algorithm;
|
package org.pgpainless.algorithm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.sig.Features;
|
import org.bouncycastle.bcpg.sig.Features;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public enum Feature {
|
||||||
MODIFICATION_DETECTION(Features.FEATURE_MODIFICATION_DETECTION),
|
MODIFICATION_DETECTION(Features.FEATURE_MODIFICATION_DETECTION),
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Byte, Feature> MAP = new HashMap<>();
|
private static final Map<Byte, Feature> MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (Feature f : Feature.values()) {
|
for (Feature f : Feature.values()) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.algorithm;
|
package org.pgpainless.algorithm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.HashAlgorithmTags;
|
import org.bouncycastle.bcpg.HashAlgorithmTags;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ public enum HashAlgorithm {
|
||||||
SHA512 (HashAlgorithmTags.SHA512),
|
SHA512 (HashAlgorithmTags.SHA512),
|
||||||
SHA224 (HashAlgorithmTags.SHA224),
|
SHA224 (HashAlgorithmTags.SHA224),
|
||||||
;
|
;
|
||||||
// Coincidence? I don't this so...
|
|
||||||
private static final Map<Integer, HashAlgorithm> MAP = new HashMap<>();
|
private static final Map<Integer, HashAlgorithm> MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (HashAlgorithm h : HashAlgorithm.values()) {
|
for (HashAlgorithm h : HashAlgorithm.values()) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.algorithm;
|
package org.pgpainless.algorithm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public enum PublicKeyAlgorithm {
|
||||||
DIFFIE_HELLMAN (PublicKeyAlgorithmTags.DIFFIE_HELLMAN),
|
DIFFIE_HELLMAN (PublicKeyAlgorithmTags.DIFFIE_HELLMAN),
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Integer, PublicKeyAlgorithm> MAP = new HashMap<>();
|
private static final Map<Integer, PublicKeyAlgorithm> MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (PublicKeyAlgorithm p : PublicKeyAlgorithm.values()) {
|
for (PublicKeyAlgorithm p : PublicKeyAlgorithm.values()) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.algorithm;
|
package org.pgpainless.algorithm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
|
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public enum SymmetricKeyAlgorithm {
|
||||||
CAMELLIA_256 (SymmetricKeyAlgorithmTags.CAMELLIA_256),
|
CAMELLIA_256 (SymmetricKeyAlgorithmTags.CAMELLIA_256),
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Integer, SymmetricKeyAlgorithm> MAP = new HashMap<>();
|
private static final Map<Integer, SymmetricKeyAlgorithm> MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (SymmetricKeyAlgorithm s : SymmetricKeyAlgorithm.values()) {
|
for (SymmetricKeyAlgorithm s : SymmetricKeyAlgorithm.values()) {
|
||||||
|
|
Loading…
Reference in a new issue