Examples of LinkTuple


Examples of agentj.examples.udprouting.repository.LinkTuple

      @Override
      public void run() {
        long now = System.currentTimeMillis();
        boolean changed = false;
        for (Iterator<LinkTuple> iter = _linkSet.iterator(); iter.hasNext(); ){
          LinkTuple tuple = iter.next();
          if (tuple.getExpireTime() <= now){
            iter.remove();
            changed = true;
          }
        }
       
        for (Iterator<TopologyTuple> iter = _topologySet.iterator(); iter.hasNext(); ){
          TopologyTuple tuple = iter.next();
          if (tuple.getExpireTime() <= now){
            iter.remove();
            changed = true;
          }
        }
       
        for (Iterator<ReceivedTuple> iter = _receiver.getReceivedSet().iterator(); iter.hasNext(); ){
          ReceivedTuple tuple = iter.next();
          if (tuple.getExpireTime() <= now)
            iter.remove();
        }
       
        if (changed)
          calculateDijkstra();
View Full Code Here

Examples of agentj.examples.udprouting.repository.LinkTuple

   * Process an incoming HELLO message
   * @param msg Message to be processed (should not be {@code null})
   */
  public void processHello(Message msg){
    long now = System.currentTimeMillis();
    LinkTuple existingTuple = null;
    // try to find whether a link tuple has already been added for that neighbor
    for (LinkTuple tuple : _linkSet){
      if (tuple.getAddress().equals(msg.getOrigAddress())){
        existingTuple = tuple;
        break;
      }
    }
   
    // if not, add a tuple
    if (existingTuple == null){
      existingTuple = new LinkTuple(msg.getOrigAddress());
      _linkSet.add(existingTuple);
      calculateDijkstra();
    }
   
    // Update expiration time of the tuple
    existingTuple.setExpireTime(now + Constants.HELLO_HOLD_TIME);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.