JXTA

net.jxta.impl.rendezvous.rpv
Class PeerviewSeedingManager

java.lang.Object
  extended by net.jxta.impl.util.ACLSeedingManager
      extended by net.jxta.impl.rendezvous.rpv.PeerviewSeedingManager
All Implemented Interfaces:
EndpointListener, SeedingManager

public class PeerviewSeedingManager
extends ACLSeedingManager
implements EndpointListener

A Seeding Manager which uses the peerview advertisement pipes in order to locate seed peers for a given peer group.


Field Summary
protected  PeerGroup advGroup
           
protected  PipeAdvertisement advPipeAdv
           
protected  PeerGroup group
           
protected static long MINIMUM_PEERVIEW_REFRESH_INTERVAL
          This is the minimum interval at which we will refresh our "peerview"
protected  String name
           
protected  long nextPeerViewRefresh
          The absolute time at which we will refresh our "PeerView"
protected  Set<RouteAdvertisement> peerview
          Our mock peerview we use to keep responses.
protected static long STANDARD_PEERVIEW_REFRESH_INTERVAL
          The standard time interval after which we will refresh our "peerview"
protected  int unsuccessfulProbes
          The absolute time at which we will refresh our "PeerView"
 
Fields inherited from class net.jxta.impl.util.ACLSeedingManager
acl
 
Constructor Summary
PeerviewSeedingManager(URI aclLocation, PeerGroup group, PeerGroup advGroup, String name)
          Creates a new instance of PeerviewSeedingManager
 
Method Summary
 void addSeed(RouteAdvertisement seed)
          Adds a rpv seed
 RouteAdvertisement[] getActiveSeedRoutes()
          Returns the route advertisements of the active seed peers.
 URI[] getActiveSeedURIs()
          Returns the URI of the endpoint addresses of the active seed peers.
 boolean isAcceptablePeer(RouteAdvertisement radv)
          Returns true if the provided route advertisement is an acceptable peer as determined by the seeding manager.
 void processIncomingMessage(Message msg, EndpointAddress srcAddr, EndpointAddress dstAddr)
          This method is invoked by the EndpointService for each incoming message which is addressed to this listener.
protected  void refreshActiveSeeds()
           
 void stop()
          Stop this seeding manager.
 
Methods inherited from class net.jxta.impl.util.ACLSeedingManager
isAcceptablePeer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_PEERVIEW_REFRESH_INTERVAL

protected static final long MINIMUM_PEERVIEW_REFRESH_INTERVAL
This is the minimum interval at which we will refresh our "peerview"

See Also:
Constant Field Values

STANDARD_PEERVIEW_REFRESH_INTERVAL

protected static final long STANDARD_PEERVIEW_REFRESH_INTERVAL
The standard time interval after which we will refresh our "peerview"

See Also:
Constant Field Values

peerview

protected Set<RouteAdvertisement> peerview
Our mock peerview we use to keep responses.


nextPeerViewRefresh

protected long nextPeerViewRefresh
The absolute time at which we will refresh our "PeerView"


unsuccessfulProbes

protected int unsuccessfulProbes
The absolute time at which we will refresh our "PeerView"


advGroup

protected final PeerGroup advGroup

group

protected final PeerGroup group

name

protected final String name

advPipeAdv

protected final PipeAdvertisement advPipeAdv
Constructor Detail

PeerviewSeedingManager

public PeerviewSeedingManager(URI aclLocation,
                              PeerGroup group,
                              PeerGroup advGroup,
                              String name)
Creates a new instance of PeerviewSeedingManager

Parameters:
aclLocation - ACL uri
group - the group context
advGroup - the advertising group
name - service name
Method Detail

stop

public void stop()
Stop this seeding manager.

Specified by:
stop in interface SeedingManager

addSeed

public void addSeed(RouteAdvertisement seed)
Adds a rpv seed

Parameters:
seed - the seed

getActiveSeedURIs

public URI[] getActiveSeedURIs()
Returns the URI of the endpoint addresses of the active seed peers. The URIs are returned in the order which the consumer should attempt to contact the seed peers.

Using the endpoint address URIs is less optimal than using the route advertisements as there is no association between the potentially multiple message transport addresses referring to a single peer.

Specified by:
getActiveSeedURIs in interface SeedingManager
Returns:
The URIs of the active seed peers in the order in which the seed peers should be contacted.

getActiveSeedRoutes

public RouteAdvertisement[] getActiveSeedRoutes()
Returns the route advertisements of the active seed peers. The route advertisements are returned in the order which the consumer should attempt to contact the seed peers. In some cases the returned route advertisements may omit the destination PeerID if it is not known.

Specified by:
getActiveSeedRoutes in interface SeedingManager
Returns:
The route advertisements of the active seed peers in the order in which the seed peers should be contacted.

isAcceptablePeer

public boolean isAcceptablePeer(RouteAdvertisement radv)
Returns true if the provided route advertisement is an acceptable peer as determined by the seeding manager.

Performs it's determination based solely on the list of peers in the access list.

Specified by:
isAcceptablePeer in interface SeedingManager
Overrides:
isAcceptablePeer in class ACLSeedingManager
Parameters:
radv - The RouteAdvertisement of the peer being tested.

refreshActiveSeeds

protected void refreshActiveSeeds()

processIncomingMessage

public void processIncomingMessage(Message msg,
                                   EndpointAddress srcAddr,
                                   EndpointAddress dstAddr)
This method is invoked by the EndpointService for each incoming message which is addressed to this listener.

Listener for "PeerView"/<peergroup-unique-id> and propagate pipes.

Specified by:
processIncomingMessage in interface EndpointListener
Parameters:
msg - Incoming message
srcAddr - Endpoint Address of the source of the message.
dstAddr - Endpoint Address of the destination of the message.

JXSE