giraph-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: updated refs/heads/trunk to b914fec
Date Thu, 07 Aug 2014 22:37:14 GMT
Repository: giraph
Updated Branches:
  refs/heads/trunk d8b443979 -> b914fec7e


GIRAPH-935: Loosen modifiers when needed (ikabiljo via majakabiljo)


Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/b914fec7
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/b914fec7
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/b914fec7

Branch: refs/heads/trunk
Commit: b914fec7e2bc669c20531ae7c2fbf340f8de9a8e
Parents: d8b4439
Author: Maja Kabiljo <majakabiljo@fb.com>
Authored: Thu Aug 7 15:36:00 2014 -0700
Committer: Maja Kabiljo <majakabiljo@fb.com>
Committed: Thu Aug 7 15:36:56 2014 -0700

----------------------------------------------------------------------
 CHANGELOG                                       |  2 +
 .../comm/messages/OneMessagePerVertexStore.java |  2 +-
 .../conf/GiraphConfigurationSettable.java       | 39 ++++++++++++++++++++
 .../ImmutableClassesGiraphConfigurable.java     | 10 +----
 .../ImmutableClassesGiraphConfiguration.java    |  9 +++--
 .../org/apache/giraph/edge/DefaultEdge.java     |  2 +-
 .../java/org/apache/giraph/utils/TestGraph.java | 21 ++++++-----
 7 files changed, 62 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index be3c59f..08abaaa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 Giraph Change Log
 
 Release 1.1.0 - unreleased
+  GIRAPH-935: Loosen modifiers when needed (ikabiljo via majakabiljo)
+
   GIRAPH-937 - Upgrade Hive I/O to 0.26. (aching)
 
   GIRAPH-893: Implement preLoad & postSave on workerObservers (pavanka)

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/comm/messages/OneMessagePerVertexStore.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/comm/messages/OneMessagePerVertexStore.java
b/giraph-core/src/main/java/org/apache/giraph/comm/messages/OneMessagePerVertexStore.java
index d3942d4..349e58b 100644
--- a/giraph-core/src/main/java/org/apache/giraph/comm/messages/OneMessagePerVertexStore.java
+++ b/giraph-core/src/main/java/org/apache/giraph/comm/messages/OneMessagePerVertexStore.java
@@ -52,7 +52,7 @@ public class OneMessagePerVertexStore<I extends WritableComparable,
    * @param messageCombiner MessageCombiner for messages
    * @param config Hadoop configuration
    */
-  OneMessagePerVertexStore(
+  public OneMessagePerVertexStore(
       MessageValueFactory<M> messageValueFactory,
       CentralizedServiceWorker<I, ?, ?> service,
       MessageCombiner<I, M> messageCombiner,

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfigurationSettable.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfigurationSettable.java
b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfigurationSettable.java
new file mode 100644
index 0000000..ce8384c
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/conf/GiraphConfigurationSettable.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.giraph.conf;
+
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Can be instantiated with ImmutableClassesGiraphConfiguration
+ *
+ * @param <I> Vertex id
+ * @param <V> Vertex data
+ * @param <E> Edge data
+ */
+public interface GiraphConfigurationSettable<
+    I extends WritableComparable, V extends Writable, E extends Writable> {
+  /**
+   * Set the configuration to be used by this object.
+   *
+   * @param configuration Set configuration
+   */
+  void setConf(ImmutableClassesGiraphConfiguration<I, V, E> configuration);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfigurable.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfigurable.java
b/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfigurable.java
index dbffbc7..4291c86 100644
--- a/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfigurable.java
+++ b/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfigurable.java
@@ -29,14 +29,8 @@ import org.apache.hadoop.io.WritableComparable;
  * @param <E> Edge data
  */
 public interface ImmutableClassesGiraphConfigurable<
-    I extends WritableComparable, V extends Writable, E extends Writable> {
-  /**
-   * Set the configuration to be used by this object.
-   *
-   * @param configuration Set configuration
-   */
-  void setConf(ImmutableClassesGiraphConfiguration<I, V, E> configuration);
-
+    I extends WritableComparable, V extends Writable, E extends Writable>
+    extends GiraphConfigurationSettable<I, V, E> {
   /**
    * Return the configuration used by this object.
    *

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfiguration.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfiguration.java
b/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfiguration.java
index 32d08f8..8b67490 100644
--- a/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfiguration.java
+++ b/giraph-core/src/main/java/org/apache/giraph/conf/ImmutableClassesGiraphConfiguration.java
@@ -18,13 +18,13 @@
 
 package org.apache.giraph.conf;
 
-import com.google.common.base.Preconditions;
 import io.netty.handler.codec.ByteToMessageDecoder;
 import io.netty.handler.codec.MessageToByteEncoder;
 import io.netty.handler.codec.compression.JdkZlibDecoder;
 import io.netty.handler.codec.compression.JdkZlibEncoder;
 import io.netty.handler.codec.compression.SnappyFramedDecoder;
 import io.netty.handler.codec.compression.SnappyFramedEncoder;
+
 import org.apache.giraph.aggregators.AggregatorWriter;
 import org.apache.giraph.combiner.MessageCombiner;
 import org.apache.giraph.edge.Edge;
@@ -89,6 +89,8 @@ import org.apache.hadoop.io.WritableComparable;
 import org.apache.hadoop.mapreduce.Mapper;
 import org.apache.hadoop.util.Progressable;
 
+import com.google.common.base.Preconditions;
+
 
 /**
  * The classes set here are immutable, the remaining configuration is mutable.
@@ -150,8 +152,8 @@ public class ImmutableClassesGiraphConfiguration<I extends WritableComparable,
    * @param obj Object
    */
   public void configureIfPossible(Object obj) {
-    if (obj instanceof ImmutableClassesGiraphConfigurable) {
-      ((ImmutableClassesGiraphConfigurable) obj).setConf(this);
+    if (obj instanceof GiraphConfigurationSettable) {
+      ((GiraphConfigurationSettable) obj).setConf(this);
     }
   }
 
@@ -520,6 +522,7 @@ public class ImmutableClassesGiraphConfiguration<I extends WritableComparable,
    *
    * @return User's combiner class
    */
+  @Override
   public Class<? extends MessageCombiner<I, ? extends Writable>>
   getMessageCombinerClass() {
     return classes.getMessageCombinerClass();

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/edge/DefaultEdge.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/DefaultEdge.java b/giraph-core/src/main/java/org/apache/giraph/edge/DefaultEdge.java
index d7cfb2f..0a558db 100644
--- a/giraph-core/src/main/java/org/apache/giraph/edge/DefaultEdge.java
+++ b/giraph-core/src/main/java/org/apache/giraph/edge/DefaultEdge.java
@@ -47,7 +47,7 @@ public class DefaultEdge<I extends WritableComparable, E extends Writable>
    * @param targetVertexId Desination vertex id.
    * @param value Value of the edge.
    */
-  DefaultEdge(I targetVertexId, E value) {
+  protected DefaultEdge(I targetVertexId, E value) {
     this.targetVertexId = targetVertexId;
     this.value = value;
   }

http://git-wip-us.apache.org/repos/asf/giraph/blob/b914fec7/giraph-core/src/main/java/org/apache/giraph/utils/TestGraph.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/utils/TestGraph.java b/giraph-core/src/main/java/org/apache/giraph/utils/TestGraph.java
index 183e90b..7a37167 100644
--- a/giraph-core/src/main/java/org/apache/giraph/utils/TestGraph.java
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/TestGraph.java
@@ -18,6 +18,11 @@
 
 package org.apache.giraph.utils;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+
 import org.apache.giraph.conf.GiraphConfiguration;
 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
 import org.apache.giraph.edge.Edge;
@@ -30,11 +35,6 @@ import com.google.common.base.Objects;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-
 /**
  * TestGraph class for in-memory testing.
  *
@@ -47,9 +47,9 @@ public class TestGraph<I extends WritableComparable,
                        E extends Writable>
                        implements Iterable<Vertex<I, V, E>> {
   /** The vertex values */
-  private final HashMap<I, Vertex<I, V, E>> vertices = Maps.newHashMap();
+  protected HashMap<I, Vertex<I, V, E>> vertices = Maps.newHashMap();
   /** The configuration */
-  private ImmutableClassesGiraphConfiguration<I, V, E> conf;
+  protected ImmutableClassesGiraphConfiguration<I, V, E> conf;
 
   /**
    * Constructor requiring classes
@@ -112,7 +112,7 @@ public class TestGraph<I extends WritableComparable,
       vertices.put(vertexId, v);
     }
     vertices.get(vertexId)
-      .addEdge((Edge<I, E>) EdgeFactory.create(edgePair.getKey(),
+      .addEdge(EdgeFactory.create(edgePair.getKey(),
                                                edgePair.getValue()));
     return this;
   }
@@ -132,7 +132,7 @@ public class TestGraph<I extends WritableComparable,
       vertices.put(vertexId, v);
     }
     vertices.get(vertexId)
-      .addEdge((Edge<I, E>) EdgeFactory.create(toVertex, edgeValue));
+      .addEdge(EdgeFactory.create(toVertex, edgeValue));
     return this;
   }
   /**
@@ -149,6 +149,7 @@ public class TestGraph<I extends WritableComparable,
    *
    * @return the iterator
    */
+  @Override
   public Iterator<Vertex<I, V, E>> iterator() {
     return vertices.values().iterator();
   }
@@ -173,7 +174,7 @@ public class TestGraph<I extends WritableComparable,
   createEdges(Entry<I, E>... destEdgess) {
     List<Edge<I, E>> edgesList = Lists.newArrayList();
     for (Entry<I, E> e: destEdgess) {
-      edgesList.add((Edge<I, E>) EdgeFactory.create(e.getKey(), e.getValue()));
+      edgesList.add(EdgeFactory.create(e.getKey(), e.getValue()));
     }
     return edgesList;
   }


Mime
View raw message