Updated Branches: refs/heads/trunk 218f60236 -> 8df1027b4
GIRAPH-725: AggregatorWrapper instantiates aggregator bypassing ReflectionUtils (apresta) Project: http://git-wip-us.apache.org/repos/asf/giraph/repo Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/8df1027b Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/8df1027b Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/8df1027b Branch: refs/heads/trunk Commit: 8df1027b4403f3b64ef02bd066d864371f6613f3 Parents: 218f602 Author: Alessandro Presta <[email protected]> Authored: Tue Jul 30 11:49:25 2013 -0700 Committer: Alessandro Presta <[email protected]> Committed: Tue Jul 30 12:07:45 2013 -0700 ---------------------------------------------------------------------- .../org/apache/giraph/aggregators/AggregatorWrapper.java | 8 ++++++-- .../org/apache/giraph/master/MasterAggregatorHandler.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/giraph/blob/8df1027b/giraph-core/src/main/java/org/apache/giraph/aggregators/AggregatorWrapper.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/aggregators/AggregatorWrapper.java b/giraph-core/src/main/java/org/apache/giraph/aggregators/AggregatorWrapper.java index 6b98085..9613805 100644 --- a/giraph-core/src/main/java/org/apache/giraph/aggregators/AggregatorWrapper.java +++ b/giraph-core/src/main/java/org/apache/giraph/aggregators/AggregatorWrapper.java @@ -18,6 +18,8 @@ package org.apache.giraph.aggregators; +import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; +import org.apache.giraph.utils.ReflectionUtils; import org.apache.hadoop.io.Writable; /** @@ -41,14 +43,16 @@ public class AggregatorWrapper<A extends Writable> { * @param aggregatorClass Class type of the aggregator * @param persistent False iff aggregator should be reset at the end of * each super step + * @param conf Configuration * @throws IllegalAccessException * @throws InstantiationException */ public AggregatorWrapper(Class<? extends Aggregator<A>> aggregatorClass, - boolean persistent) throws IllegalAccessException, + boolean persistent, ImmutableClassesGiraphConfiguration conf) throws + IllegalAccessException, InstantiationException { this.persistent = persistent; - currentAggregator = aggregatorClass.newInstance(); + currentAggregator = ReflectionUtils.newInstance(aggregatorClass, conf); changed = false; previousAggregatedValue = currentAggregator.createInitialValue(); } http://git-wip-us.apache.org/repos/asf/giraph/blob/8df1027b/giraph-core/src/main/java/org/apache/giraph/master/MasterAggregatorHandler.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/master/MasterAggregatorHandler.java b/giraph-core/src/main/java/org/apache/giraph/master/MasterAggregatorHandler.java index 0537915..325d91f 100644 --- a/giraph-core/src/main/java/org/apache/giraph/master/MasterAggregatorHandler.java +++ b/giraph-core/src/main/java/org/apache/giraph/master/MasterAggregatorHandler.java @@ -149,7 +149,7 @@ public class MasterAggregatorHandler implements MasterAggregatorUsage, (AggregatorWrapper<A>) aggregatorMap.get(name); if (aggregatorWrapper == null) { aggregatorWrapper = - new AggregatorWrapper<A>(aggregatorClass, persistent); + new AggregatorWrapper<A>(aggregatorClass, persistent, conf); aggregatorMap.put(name, (AggregatorWrapper<Writable>) aggregatorWrapper); } return aggregatorWrapper;
