GIRAPH-1069 Race condition in all *ConfOption classes
authorSergey Edunov <edunov@fb.com>
Wed, 8 Jun 2016 22:01:40 +0000 (15:01 -0700)
committerSergey Edunov <edunov@fb.com>
Wed, 8 Jun 2016 22:01:40 +0000 (15:01 -0700)
commitfe87b23fbd86d8f978142dc326231ea6bd4a61f0
tree138486bf47fe62b177a62d448ecec92f4c9a8f5e
parentc94dd9c74895d419f72974fcbe5456fbae84b7a9
GIRAPH-1069 Race condition in all *ConfOption classes

Summary:
*ConfOption classes, such as ClassConfOption, IntConfOption, FloatConfOption etc, call AllOtions.add(this) from their constructor. This call updates static list without any synchronization. Hence, if you create conf option classes in different threads you run into race condition.
The only reason we have AllOptions is to create documentation. It can be done with reflection instead. So, let's remove AllOtions.add(this) from all conf classes and implement reflection based approach in AllOptions

Test Plan:
mvn clean verify -Phadoop_facebook

checked that generated options.xml is the same as before

Reviewers: majakabiljo, dionysis.logothetis, heslami, maja.kabiljo

Reviewed By: heslami, maja.kabiljo

Differential Revision: https://reviews.facebook.net/D59331
giraph-core/pom.xml
giraph-core/src/main/java/org/apache/giraph/comm/flow_control/CreditBasedFlowControl.java
giraph-core/src/main/java/org/apache/giraph/conf/AllOptions.java
giraph-core/src/main/java/org/apache/giraph/conf/BooleanConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/ClassConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/EnumConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/FloatConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/IntConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/LongConfOption.java
giraph-core/src/main/java/org/apache/giraph/conf/StrConfOption.java