org.apache.giraph.comm
Class SendMessageCache<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>

java.lang.Object
  extended by org.apache.giraph.comm.SendCache<I,M,ByteArrayVertexIdMessages<I,M>>
      extended by org.apache.giraph.comm.SendMessageCache<I,M>
Type Parameters:
I - Vertex id
M - Message data

public class SendMessageCache<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
extends SendCache<I,M,ByteArrayVertexIdMessages<I,M>>

Aggregates the messages to be sent to workers so they can be sent in bulk. Not thread-safe.


Constructor Summary
SendMessageCache(ImmutableClassesGiraphConfiguration conf, CentralizedServiceWorker<?,?,?,?> serviceWorker)
          Constructor
 
Method Summary
 int addMessage(WorkerInfo workerInfo, int partitionId, I destVertexId, M message)
          Add a message to the cache.
 ByteArrayVertexIdMessages<I,M> createByteArrayVertexIdData()
          Create a new ByteArrayVertexIdData specialized for the use case.
 PairList<WorkerInfo,PairList<Integer,ByteArrayVertexIdMessages<I,M>>> removeAllMessages()
          Gets all the messages and removes them from the cache.
 PairList<Integer,ByteArrayVertexIdMessages<I,M>> removeWorkerMessages(WorkerInfo workerInfo)
          Gets the messages for a worker and removes it from the cache.
 
Methods inherited from class org.apache.giraph.comm.SendCache
addData, removeAllData, removeWorkerData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SendMessageCache

public SendMessageCache(ImmutableClassesGiraphConfiguration conf,
                        CentralizedServiceWorker<?,?,?,?> serviceWorker)
Constructor

Parameters:
conf - Giraph configuration
serviceWorker - Service worker
Method Detail

createByteArrayVertexIdData

public ByteArrayVertexIdMessages<I,M> createByteArrayVertexIdData()
Description copied from class: SendCache
Create a new ByteArrayVertexIdData specialized for the use case.

Specified by:
createByteArrayVertexIdData in class SendCache<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable,ByteArrayVertexIdMessages<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>>
Returns:
A new instance of ByteArrayVertexIdData

addMessage

public int addMessage(WorkerInfo workerInfo,
                      int partitionId,
                      I destVertexId,
                      M message)
Add a message to the cache.

Parameters:
workerInfo - the remote worker destination
partitionId - the remote Partition this message belongs to
destVertexId - vertex id that is ultimate destination
message - Message to send to remote worker
Returns:
Size of messages for the worker.

removeWorkerMessages

public PairList<Integer,ByteArrayVertexIdMessages<I,M>> removeWorkerMessages(WorkerInfo workerInfo)
Gets the messages for a worker and removes it from the cache.

Parameters:
workerInfo - the address of the worker who owns the data partitions that are receiving the messages
Returns:
List of pairs (partitionId, ByteArrayVertexIdMessages), where all partition ids belong to workerInfo

removeAllMessages

public PairList<WorkerInfo,PairList<Integer,ByteArrayVertexIdMessages<I,M>>> removeAllMessages()
Gets all the messages and removes them from the cache.

Returns:
All vertex messages for all partitions


Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.