fix: Fixes a potential synchronization issue.

This commit is contained in:
Boris Grozev 2016-11-16 13:14:20 -06:00
parent 99600368f6
commit a08c77a3c1

View File

@ -708,18 +708,12 @@ public class HostCandidateHarvester
* @throws java.lang.IllegalStateException if there were errors during host * @throws java.lang.IllegalStateException if there were errors during host
* candidate interface filters initialization. * 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)
// We want this method to run only once. return;
if (interfaceFiltersInitialized) interfaceFiltersInitialized = true;
return;
interfaceFiltersInitialized = true;
// Should we hold this lock until we are done modifying the fields?
}
// Initialize the allowed interfaces array. // Initialize the allowed interfaces array.
allowedInterfaces = StackProperties.getStringArray( allowedInterfaces = StackProperties.getStringArray(