private void loadVertices(
BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer)
throws IOException, SyncException, InterruptedException {
final boolean selfReference = conf.getBoolean("hama.graph.self.ref", false);
RecordConverter converter = org.apache.hadoop.util.ReflectionUtils
.newInstance(conf.getClass(Constants.RUNTIME_PARTITION_RECORDCONVERTER,
DefaultRecordConverter.class, RecordConverter.class), conf);
// our VertexInputReader ensures incoming vertices are sorted by their ID
Vertex<V, E, M> vertex = GraphJobRunner
.<V, E, M> newVertexInstance(VERTEX_CLASS);
Vertex<V, E, M> currentVertex = GraphJobRunner
.<V, E, M> newVertexInstance(VERTEX_CLASS);
KeyValuePair<Writable, Writable> record = null;
KeyValuePair<Writable, Writable> converted = null;
while ((record = peer.readNext()) != null) {
converted = converter.convertRecord(record, conf);
currentVertex = (Vertex<V, E, M>) converted.getValue();
if (vertex.getVertexID() == null) {
vertex = currentVertex;
} else {