You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2013/11/09 11:26:49 UTC

svn commit: r1540284 - in /hama/trunk: core/src/main/java/org/apache/hama/bsp/message/ core/src/main/java/org/apache/hama/bsp/message/queue/ graph/src/main/java/org/apache/hama/graph/

Author: edwardyoon
Date: Sat Nov  9 10:26:49 2013
New Revision: 1540284

URL: http://svn.apache.org/r1540284
Log:
Remove deprecated constants

Added:
    hama/trunk/core/src/main/java/org/apache/hama/bsp/message/queue/SortedMessageTransferProtocol.java
Modified:
    hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java
    hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageTransferQueueFactory.java
    hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java?rev=1540284&r1=1540283&r2=1540284&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageManager.java Sat Nov  9 10:26:49 2013
@@ -36,8 +36,6 @@ import org.apache.hama.bsp.message.queue
  */
 public interface MessageManager<M extends Writable> {
 
-  @Deprecated
-  public static final String QUEUE_TYPE_CLASS = "hama.messenger.queue.class";
   public static final String RECEIVE_QUEUE_TYPE_CLASS = "hama.messenger.receive.queue.class";
   public static final String SENDER_QUEUE_TYPE_CLASS = "hama.messenger.sender.queue.class";
   public static final String TRANSFER_QUEUE_TYPE_CLASS = "hama.messenger.xfer.queue.class";

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageTransferQueueFactory.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageTransferQueueFactory.java?rev=1540284&r1=1540283&r2=1540284&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageTransferQueueFactory.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/message/MessageTransferQueueFactory.java Sat Nov  9 10:26:49 2013
@@ -17,8 +17,6 @@
  */
 package org.apache.hama.bsp.message;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hama.bsp.message.queue.MemoryQueue;
 import org.apache.hama.bsp.message.queue.MessageQueue;
@@ -32,30 +30,6 @@ import org.apache.hama.util.ReflectionUt
  */
 public class MessageTransferQueueFactory<M> {
 
-  private static final Log LOG = LogFactory.getLog(MessageTransferQueueFactory.class);
-
-  private static class BackwardCompatibleTransferQueue<M> implements
-      MessageTransferQueue<M> {
-
-    @Override
-    public MessageQueue<M> getSenderQueue(Configuration conf) {
-      return getMessageQueue(conf);
-    }
-
-    @Override
-    public MessageQueue<M> getReceiverQueue(Configuration conf) {
-      return getMessageQueue(conf);
-    }
-
-    @SuppressWarnings({ "unchecked", "deprecation" })
-    private MessageQueue<M> getMessageQueue(Configuration conf) {
-      return ReflectionUtils.newInstance(conf.getClass(
-          MessageManager.QUEUE_TYPE_CLASS, MemoryQueue.class,
-          MessageQueue.class));
-    }
-
-  }
-
   private static class DefaultMessageTransferQueue<M> implements
       MessageTransferQueue<M> {
 
@@ -77,16 +51,7 @@ public class MessageTransferQueueFactory
 
   }
 
-  @SuppressWarnings({ "rawtypes", "deprecation" })
   public static MessageTransferQueue getMessageTransferQueue(Configuration conf) {
-
-    if (conf.getClass(MessageManager.QUEUE_TYPE_CLASS, null) != null) {
-      // TODO print only once -- Ed
-      
-      // LOG.warn("Message queue is configured on deprecated parameter:"
-      //   + MessageManager.QUEUE_TYPE_CLASS);
-      return new BackwardCompatibleTransferQueue();
-    }
     return (MessageTransferQueue) ReflectionUtils.newInstance(conf.getClass(
         MessageManager.TRANSFER_QUEUE_TYPE_CLASS,
         DefaultMessageTransferQueue.class, MessageTransferQueue.class));

Added: hama/trunk/core/src/main/java/org/apache/hama/bsp/message/queue/SortedMessageTransferProtocol.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/queue/SortedMessageTransferProtocol.java?rev=1540284&view=auto
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/message/queue/SortedMessageTransferProtocol.java (added)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/message/queue/SortedMessageTransferProtocol.java Sat Nov  9 10:26:49 2013
@@ -0,0 +1,41 @@
+/**
+ * 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.hama.bsp.message.queue;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Queue transfer protocol for sorted message queue.
+ *
+ * @param <M>
+ */
+public class SortedMessageTransferProtocol<M extends WritableComparable<M>> implements
+    MessageTransferQueue<M> {
+
+  @Override
+  public SortedMessageQueue<M> getSenderQueue(Configuration conf) {
+    return new SortedMessageQueue<M>();
+  }
+
+  @Override
+  public SortedMessageQueue<M> getReceiverQueue(Configuration conf) {
+    return new SortedMessageQueue<M>();
+  }
+
+}

Modified: hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java?rev=1540284&r1=1540283&r2=1540284&view=diff
==============================================================================
--- hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java (original)
+++ hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java Sat Nov  9 10:26:49 2013
@@ -31,8 +31,8 @@ import org.apache.hama.bsp.HashPartition
 import org.apache.hama.bsp.Partitioner;
 import org.apache.hama.bsp.PartitioningRunner.RecordConverter;
 import org.apache.hama.bsp.message.MessageManager;
-import org.apache.hama.bsp.message.queue.MessageQueue;
-import org.apache.hama.bsp.message.queue.SortedMessageQueue;
+import org.apache.hama.bsp.message.queue.MessageTransferQueue;
+import org.apache.hama.bsp.message.queue.SortedMessageTransferProtocol;
 
 import com.google.common.base.Preconditions;
 
@@ -123,8 +123,8 @@ public class GraphJob extends BSPJob {
   /**
    * Sets the input reader for parsing the input to vertices.
    */
-  public void setVertexInputReaderClass(
-      @SuppressWarnings("rawtypes") Class<? extends VertexInputReader> cls) {
+  public void setVertexInputReaderClass(@SuppressWarnings("rawtypes")
+  Class<? extends VertexInputReader> cls) {
     ensureState(JobState.DEFINE);
     conf.setClass(Constants.RUNTIME_PARTITION_RECORDCONVERTER, cls,
         RecordConverter.class);
@@ -135,8 +135,8 @@ public class GraphJob extends BSPJob {
    * Sets the output writer for materializing vertices to the output sink. If
    * not set, the default DefaultVertexOutputWriter will be used.
    */
-  public void setVertexOutputWriterClass(
-      @SuppressWarnings("rawtypes") Class<? extends VertexOutputWriter> cls) {
+  public void setVertexOutputWriterClass(@SuppressWarnings("rawtypes")
+  Class<? extends VertexOutputWriter> cls) {
     ensureState(JobState.DEFINE);
     conf.setClass(VERTEX_OUTPUT_WRITER_CLASS_ATTR, cls,
         VertexOutputWriter.class);
@@ -149,8 +149,8 @@ public class GraphJob extends BSPJob {
   }
 
   @Override
-  public void setPartitioner(
-      @SuppressWarnings("rawtypes") Class<? extends Partitioner> theClass) {
+  public void setPartitioner(@SuppressWarnings("rawtypes")
+  Class<? extends Partitioner> theClass) {
     super.setPartitioner(theClass);
     conf.setBoolean(Constants.ENABLE_RUNTIME_PARTITIONING, true);
   }
@@ -197,8 +197,8 @@ public class GraphJob extends BSPJob {
     }
 
     // add the default message queue to the sorted one
-    this.getConfiguration().setClass(MessageManager.QUEUE_TYPE_CLASS,
-        SortedMessageQueue.class, MessageQueue.class);
+    this.getConfiguration().setClass(MessageManager.TRANSFER_QUEUE_TYPE_CLASS,
+        SortedMessageTransferProtocol.class, MessageTransferQueue.class);
 
     super.submit();
   }