Package org.goldenorb

Examples of org.goldenorb.Messages


          currentPartition.put(m.getDestinationVertex(), messageList);
        }
       
        // once the expected number of messages is met, begins the message sending operation
        if (messageCounter >= maxMessages) {
          Messages messagesToBeSent = new Messages(messageClass);
         
          // collects the messages associated to each key and adds them to a Messages object to be sent
          for (Collection<Message<? extends Writable>> ms : currentPartition.values()) {
            for (Message<? extends Writable> message : ms) {
              messagesToBeSent.add(message);
            }
          }
         
          // logger stuff
          omqLogger
              .info(this.toString() + " Partition: " + Integer.toString(partitionId)
                    + "Sending bulk messages. Count: " + messageCounter + ", " + messagesToBeSent.size());
          omqLogger.info(messageClass.getName());
         
          // sends the Messages to the partition as specified over RPC, then creates a fresh, empty Map in its
          // place
          orbClients.get(messageHash).sendMessages(messagesToBeSent);
View Full Code Here


   * Sends any remaining messages if the maximum number of messages is not met.
   */
  public void sendRemainingMessages() {
   
    for (int partitionID = 0; partitionID < numberOfPartitions; partitionID++) {
      Messages messagesToBeSent = new Messages(messageClass);
     
      for (Collection<Message<? extends Writable>> ms : pmo.partitionMessageMapsList.get(partitionID)
          .values()) {
        for (Message<? extends Writable> message : ms) {
          messagesToBeSent.add(message);
        }
      }
     
      if (messagesToBeSent.size() > 0) {
        omqLogger.info("Partition {} sending bulk messages.  Count: " + pmo.partitionMessageCounter.get(partitionID) + ", "
                       + messagesToBeSent.size(), partitionID);
        orbClients.get(partitionID).sendMessages(messagesToBeSent);
      }
      else {
        omqLogger.debug("No messages to be sent from Partition {}", partitionID);
      }
View Full Code Here

   
    // initialize the Threads and pass them their test Messages
    CountDownLatch startLatch = new CountDownLatch(1);
    CountDownLatch everyoneDoneLatch = new CountDownLatch(numberOfPartitions);
    for (int i = 0; i < numberOfPartitions; i++) {
      Messages msgs = new Messages(TextMessage.class);
      for (int p = 0; p < numOfMessagesToSendPerThread; p++) {
        TextMessage txtmsg = new TextMessage(Integer.toString(i), new Text("test message "
                                                                           + Integer.toString(p)));
        msgs.add(txtmsg);
      }
     
      OutboundMessageThread obmThread = new OutboundMessageThread(msgs, omq, startLatch, everyoneDoneLatch);
      obmThread.start(); // initialize a Thread
    }
View Full Code Here

    CountDownLatch startLatch = new CountDownLatch(1);
    CountDownLatch everyoneDoneLatch = new CountDownLatch(numOfThreads);
   
    // create new MessageThreads that add the passed message to the inbound message queue
    for (int i = 0; i < numOfThreads; i++) {
      Messages msgs = new Messages(TextMessage.class);
      for (int p = 0; p < numOfMessages; p++) {
        TextMessage txtmsg = new TextMessage(Integer.toString(i), new Text("test message "
                                                                           + Integer.toString(p)));
        msgs.add(txtmsg);
      }
     
      MessageThread mThread = new MessageThread(msgs, imq, startLatch, everyoneDoneLatch);
      mThread.start();
    }
View Full Code Here

TOP

Related Classes of org.goldenorb.Messages

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.