ANTS v2.0 API

ants.core
Class NeighborTable

java.lang.Object
  |
  +--ants.core.NeighborTable

public final class NeighborTable
extends java.lang.Object

The neighbor table maintains a mapping of logical active network addresses to physical Addresses. The table also supports "listeners". Each listener is notifed whenever the table changes.

This class uses a somewhat crufty access control mechanism to prevent access by untrusted code. Read access is mediated by performing a single reference monitor check in Node.getNeighborTable. Write access is mediated by performing a reference monitor check for each write access. This optimizes for the common case (reads) without explicitly separting the read and write interfaces. Also, we assume that read access to the table implies the right to add and remove NeighborListeners.

XXX the current implementation suffers from race conditions related to multiple updates occurring frequently. There is a basically a single update buffer between the table and each listener. If a listener is not "quick enough" updates may get lost. Additionally (though less likely) updates can get partially overwritten.

Author:
Andrew Whitaker, Utah Janos Team
See Also:
NeighborListener, Node.getNeighborTable()

Method Summary
 void addNeighbor(int address, edu.utah.janos.nodeos.Address link)
          add a new neighbor, and notify any listeners.
 void addNeighborListener(NeighborListener nl)
           
 edu.utah.janos.nodeos.Address getNeighbor(int address)
          Return a physical address given a (virtual) active network address.
 edu.utah.janos.nodeos.Address getNeighbor(java.lang.Integer address)
          Return a physical address given a (virtual) active network address.
 java.util.Enumeration getNeighbors()
          Return an enumeration of all the neighbor virtual addresses.
 void removeNeighbor(int address)
          remove an immediate neighbor, and notify and listeners.
 void removeNeighborListener(NeighborListener nl)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNeighbor

public edu.utah.janos.nodeos.Address getNeighbor(int address)
Return a physical address given a (virtual) active network address.

getNeighbor

public edu.utah.janos.nodeos.Address getNeighbor(java.lang.Integer address)
Return a physical address given a (virtual) active network address.

getNeighbors

public java.util.Enumeration getNeighbors()
Return an enumeration of all the neighbor virtual addresses. The elements of the enumeration are Integers.

addNeighborListener

public void addNeighborListener(NeighborListener nl)

removeNeighborListener

public void removeNeighborListener(NeighborListener nl)

addNeighbor

public void addNeighbor(int address,
                        edu.utah.janos.nodeos.Address link)
add a new neighbor, and notify any listeners. We add the new neighbor BEFORE notifying the listeners. Requires an access control check.

removeNeighbor

public void removeNeighbor(int address)
remove an immediate neighbor, and notify and listeners. We remove the neighbor AFTER notifying the listeners.

ANTS v2.0 API

This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/