Coverage Report - org.apache.giraph.comm.requests.SendWorkerMessagesRequest
 
Classes in this File Line Coverage Branch Coverage Complexity
SendWorkerMessagesRequest
0%
0/16
0%
0/2
1.2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 package org.apache.giraph.comm.requests;
 20  
 
 21  
 import org.apache.giraph.comm.ServerData;
 22  
 import org.apache.giraph.utils.ByteArrayVertexIdMessages;
 23  
 import org.apache.giraph.utils.PairList;
 24  
 import org.apache.giraph.utils.VertexIdMessages;
 25  
 import org.apache.hadoop.io.Writable;
 26  
 import org.apache.hadoop.io.WritableComparable;
 27  
 
 28  
 /**
 29  
  * Send a collection of vertex messages for a partition.
 30  
  *
 31  
  * @param <I> Vertex id
 32  
  * @param <M> Message data
 33  
  */
 34  0
 @SuppressWarnings("unchecked")
 35  
 public class SendWorkerMessagesRequest<I extends WritableComparable,
 36  
     M extends Writable> extends SendWorkerDataRequest<I, M,
 37  
     VertexIdMessages<I, M>> {
 38  
 
 39  
   /** Default constructor */
 40  0
   public SendWorkerMessagesRequest() {
 41  0
   }
 42  
 
 43  
   /**
 44  
    * Constructor used to send request.
 45  
    *
 46  
    * @param partVertMsgs Map of remote partitions =&gt;
 47  
    *                     VertexIdMessages
 48  
    */
 49  
   public SendWorkerMessagesRequest(
 50  0
       PairList<Integer, VertexIdMessages<I, M>> partVertMsgs) {
 51  0
     this.partitionVertexData = partVertMsgs;
 52  0
   }
 53  
 
 54  
   @Override
 55  
   public VertexIdMessages<I, M> createVertexIdData() {
 56  0
     return new ByteArrayVertexIdMessages<I, M>(
 57  0
         getConf().createOutgoingMessageValueFactory());
 58  
   }
 59  
 
 60  
   @Override
 61  
   public RequestType getType() {
 62  0
     return RequestType.SEND_WORKER_MESSAGES_REQUEST;
 63  
   }
 64  
 
 65  
   @Override
 66  
   public void doRequest(ServerData serverData) {
 67  
     PairList<Integer, VertexIdMessages<I, M>>.Iterator
 68  0
         iterator = partitionVertexData.getIterator();
 69  0
     while (iterator.hasNext()) {
 70  0
       iterator.next();
 71  0
       serverData.getIncomingMessageStore().
 72  0
           addPartitionMessages(iterator.getCurrentFirst(),
 73  0
               iterator.getCurrentSecond());
 74  
     }
 75  0
   }
 76  
 }