Package org.goldenorb

Examples of org.goldenorb.Vertices


    List<Integer> partitionVertexCounter;
   
    // creates an ArrayList of Vertices; each entry in the ArrayList represents a partition
    partitionVertexList = new ArrayList<Vertices>(numberOfPartitions);
    for (int i = 0; i < numberOfPartitions; i++) {
      Vertices vs = new Vertices(vertexClass);
      partitionVertexList.add(vs);
    }
   
    // initializes a vertex counter for each outbound partition
    partitionVertexCounter = new ArrayList<Integer>(numberOfPartitions);
View Full Code Here


   *          - a Vertex to be sent
   */
  public void sendVertex(Vertex<?,?,?> v) {
    synchronized (pvo) {
      int vertexHash = Math.abs(v.getVertexID().hashCode()) % numberOfPartitions;
      Vertices currentPartition = pvo.partitionVertexList.get(vertexHash);
     
      Integer vertexCounter;
      synchronized (pvo.partitionVertexCounter) {
        synchronized (currentPartition) {
          vertexCounter = pvo.partitionVertexCounter.get(vertexHash);
          vertexCounter++;
          pvo.partitionVertexCounter.set(vertexHash, vertexCounter);
         
          currentPartition.add(v);
         
          // once the expected number of vertices is met, begins the send operation
          if (vertexCounter >= maxVertices) {
            Vertices verticesToBeSent = currentPartition;
            Vertices vs = new Vertices(vertexClass);
           
            // logger stuff
            ovqLogger.info(this.toString() + " Partition: " + Integer.toString(partitionId)
                           + " Sending bulk vertices. Count: " + vertexCounter + ", "
                           + verticesToBeSent.size());
View Full Code Here

    for (int partitionID = 0; partitionID < numberOfPartitions; partitionID++) {
      ovqLogger.info(this.toString() + " Partition: " + Integer.toString(partitionId)
                     + " Sending bulk vertices. Count: " + pvo.partitionVertexCounter.get(partitionID) + ", "
                     + pvo.partitionVertexList.get(partitionID).size());
      if (pvo.partitionVertexList.get(partitionID) != null) {
        Vertices verticesToBeSent = pvo.partitionVertexList.get(partitionID);
        verticesToBeSent.setVertexType(vertexClass);
        orbClients.get(partitionID).sendVertices(pvo.partitionVertexList.get(partitionID));
      }
    }
  }
View Full Code Here

   
    // initialize the Threads and pass them their test Vertices
    CountDownLatch startLatch = new CountDownLatch(1);
    CountDownLatch everyoneDoneLatch = new CountDownLatch(numberOfPartitions);
    for (int i = 0; i < numberOfPartitions; i++) {
      Vertices vrts = new Vertices(vertexClass);
      for (int p = 0; p < numOfVerticesToSendPerThread; p++) {
        String vertexID = "vertex " + p;
        IntWritable vertexValue = new IntWritable(p);
        List<Edge<IntWritable>> edgesList = new ArrayList<Edge<IntWritable>>();
        TestVertex vrt = new TestVertex(vertexID, vertexValue, edgesList);
        vrts.add(vrt);
      }
     
      OutboundVertexThread obmThread = new OutboundVertexThread(vrts, ovq, startLatch, everyoneDoneLatch);
      obmThread.start(); // initialize a Thread
    }
View Full Code Here

TOP

Related Classes of org.goldenorb.Vertices

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.