Class MessageRecvManager
- java.lang.Object
-
- org.apache.hugegraph.computer.core.receiver.MessageRecvManager
-
- All Implemented Interfaces:
Manager,MessageHandler,TransportHandler
public class MessageRecvManager extends java.lang.Object implements Manager, MessageHandler
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAME
-
Constructor Summary
Constructors Constructor Description MessageRecvManager(org.apache.hugegraph.computer.core.common.ComputerContext context, FileManager fileManager, SortManager sortManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterSuperstep(org.apache.hugegraph.computer.core.config.Config config, int superstep)Do some clean up for a superstep.voidbeforeSuperstep(org.apache.hugegraph.computer.core.config.Config config, int superstep)Do some initialization for a superstep.java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>>edgePartitions()voidexceptionCaught(TransportException cause, ConnectionId connectionId)Invoked when the channel associated with the given connectionId has an exception is thrown processing message.java.lang.StringgenOutputPath(MessageType messageType, int partition)Build a output path.voidhandle(MessageType messageType, int partition, NetworkBuffer buffer)Handle the buffer received.voidinit(org.apache.hugegraph.computer.core.config.Config config)Used to add the resources needed by the computation.java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>>messagePartitions()java.util.Map<java.lang.Integer,MessageStat>messageStats()java.lang.Stringname()The unique identify name.voidonChannelActive(ConnectionId connectionId)Invoked when the channel associated with the given connectionId is active.voidonChannelInactive(ConnectionId connectionId)Invoked when the channel associated with the given connectionId is inactive.voidonFinished(ConnectionId connectionId)Notify finish-session completed on server-side.voidonStarted(ConnectionId connectionId)Notify start-session completed on server-side.java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>>vertexPartitions()Get the Iteratorof each partition. voidwaitReceivedAllMessages()
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MessageRecvManager
public MessageRecvManager(org.apache.hugegraph.computer.core.common.ComputerContext context, FileManager fileManager, SortManager sortManager)
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:ManagerThe unique identify name.
-
init
public void init(org.apache.hugegraph.computer.core.config.Config config)
Description copied from interface:ManagerUsed to add the resources needed by the computation. Be called only one time before all supersteps start.
-
beforeSuperstep
public void beforeSuperstep(org.apache.hugegraph.computer.core.config.Config config, int superstep)Description copied from interface:ManagerDo some initialization for a superstep. Be called before a superstep. Subclass should override this method if wants to do something before a superstep.- Specified by:
beforeSuperstepin interfaceManager
-
afterSuperstep
public void afterSuperstep(org.apache.hugegraph.computer.core.config.Config config, int superstep)Description copied from interface:ManagerDo some clean up for a superstep. Be called after a superstep. Subclass should override this method if wants to do something after a superstep.- Specified by:
afterSuperstepin interfaceManager
-
onChannelActive
public void onChannelActive(ConnectionId connectionId)
Description copied from interface:TransportHandlerInvoked when the channel associated with the given connectionId is active.- Specified by:
onChannelActivein interfaceTransportHandler
-
onChannelInactive
public void onChannelInactive(ConnectionId connectionId)
Description copied from interface:TransportHandlerInvoked when the channel associated with the given connectionId is inactive. No further requests will come from this channel.- Specified by:
onChannelInactivein interfaceTransportHandler
-
exceptionCaught
public void exceptionCaught(TransportException cause, ConnectionId connectionId)
Description copied from interface:TransportHandlerInvoked when the channel associated with the given connectionId has an exception is thrown processing message.- Specified by:
exceptionCaughtin interfaceTransportHandler
-
waitReceivedAllMessages
public void waitReceivedAllMessages()
-
handle
public void handle(MessageType messageType, int partition, NetworkBuffer buffer)
Description copied from interface:MessageHandlerHandle the buffer received. There are two buffer list for a partition, one for sorting and one for receiving new buffers. It may block the caller if the receiving list reached threshold and the sorting list is sorting in process.- Specified by:
handlein interfaceMessageHandler
-
genOutputPath
public java.lang.String genOutputPath(MessageType messageType, int partition)
Description copied from interface:MessageHandlerBuild a output path.- Specified by:
genOutputPathin interfaceMessageHandler
-
onStarted
public void onStarted(ConnectionId connectionId)
Description copied from interface:MessageHandlerNotify start-session completed on server-side.- Specified by:
onStartedin interfaceMessageHandler
-
onFinished
public void onFinished(ConnectionId connectionId)
Description copied from interface:MessageHandlerNotify finish-session completed on server-side.- Specified by:
onFinishedin interfaceMessageHandler
-
vertexPartitions
public java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>> vertexPartitions()
Get the Iteratorof each partition.
-
edgePartitions
public java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>> edgePartitions()
-
messagePartitions
public java.util.Map<java.lang.Integer,PeekableIterator<KvEntry>> messagePartitions()
-
messageStats
public java.util.Map<java.lang.Integer,MessageStat> messageStats()
-
-