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,19 +708,13 @@ 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. // We want this method to run only once.
if (interfaceFiltersInitialized) if (interfaceFiltersInitialized)
return; return;
interfaceFiltersInitialized = true; 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(
StackProperties.ALLOWED_INTERFACES, ";"); StackProperties.ALLOWED_INTERFACES, ";");