From a08c77a3c198c55995e0e461cc98cb0ea7c88b4a Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 16 Nov 2016 13:14:20 -0600 Subject: [PATCH] fix: Fixes a potential synchronization issue. --- .../ice/harvest/HostCandidateHarvester.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/ice4j/ice/harvest/HostCandidateHarvester.java b/src/main/java/org/ice4j/ice/harvest/HostCandidateHarvester.java index 1ca40c2..04efdec 100644 --- a/src/main/java/org/ice4j/ice/harvest/HostCandidateHarvester.java +++ b/src/main/java/org/ice4j/ice/harvest/HostCandidateHarvester.java @@ -708,18 +708,12 @@ public class HostCandidateHarvester * @throws java.lang.IllegalStateException if there were errors during host * candidate interface filters initialization. */ - public static void initializeInterfaceFilters() + public static synchronized void initializeInterfaceFilters() { - synchronized (HostCandidateHarvester.class) - { - // We want this method to run only once. - if (interfaceFiltersInitialized) - return; - - interfaceFiltersInitialized = true; - - // Should we hold this lock until we are done modifying the fields? - } + // We want this method to run only once. + if (interfaceFiltersInitialized) + return; + interfaceFiltersInitialized = true; // Initialize the allowed interfaces array. allowedInterfaces = StackProperties.getStringArray(