Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

net.jxta.impl.rendezvous.rpv
Class PeerView  view PeerView download PeerView.java

java.lang.Object
  extended bynet.jxta.impl.rendezvous.rpv.PeerView
All Implemented Interfaces:
net.jxta.endpoint.EndpointListener, java.util.EventListener, net.jxta.rendezvous.RendezvousListener

public final class PeerView
extends java.lang.Object
implements net.jxta.endpoint.EndpointListener, net.jxta.rendezvous.RendezvousListener

This class models a Rendezvous Peer View (RPV): ordered collection of all other Rendezvous Peers visible to this Peer.

Presently this class implements a random "diffusion" algorithm where each Peer periodically selects a randomly selected peer advertisement from its view and sends it over to a randomly selected peer from its view. Over time, this causes every peer to learn about every other peer, resulting in a "consistent" peer view.

This diffusion process is bootstrapped by every peer sending their own peer advertisements to some well-known, stable, "seed" peers on startup.


Nested Class Summary
private  class PeerView.AdvertisingGroupQueryTask
          Class implementing the query request on the AdvertisingGroup
private  class PeerView.KickerTask
          Class implementing the kicker
private  class PeerView.OpenPipesTask
          Make sure that the PeerView properly changes behavior, when switching from edge mode to rdv mode, and vice-versa.
private  class PeerView.TimedSendTask
          Class implementing the TimerTask that tries to send an advertisement to a remote peer, in background.
private  class PeerView.WatchdogTask
          A task that checks on upPeer and downPeer.
private  class PeerView.WirePipeListener
          Adapter class for receiving wire pipe messages
 
Field Summary
protected  net.jxta.impl.access.AccessList acl
           
private static long ACL_REFRESH_PERIOD
           
protected  java.io.File aclFile
           
protected  long aclFileLastModified
           
private  java.util.Set activeSeedHosts
          The active list of seed peers.
private  net.jxta.peergroup.PeerGroup advertisingGroup
           
private  net.jxta.protocol.PipeAdvertisement advGroupPropPipeAdv
           
private  int bootLevel
          Describes the frequency and amount of effort we will spend updating the peerview.
private static int BOOTLEVEL_INCREMENT
           
(package private) static net.jxta.endpoint.MessageElement CACHED_RADV_ELEMENT
           
(package private) static java.lang.String CACHED_RADV_ELEMENT_NAME
          Element name that specifies by its presence whether the enclosed RdvAdvertisement is a hint (cached), or is known to be active.
private  boolean closed
          If true then this Peer View instance is closed and is shutting down.
private static long DEFAULT_BOOTSTRAP_KICK_INTERVAL
           
private static long DEFAULT_RADV_EXPIRATION
           
private static long DEFAULT_RADV_LIFETIME
          Default lifetimes for RdvAdvertisement that are published.
private static long DEFAULT_SEEDING_PERIOD
          This is the interval between adv exchange in seconds.
private static int DEFAULT_SEEDING_RDVPEERS
          DEFAULT_SEEDING_RDVPEERS This value is the maximum number of rendezvous peers that will be send our own advertisement at boot time.
private  PeerViewElement downPeer
           
private  long earliestReseed
          Earliest absolute time in milliseconds at which we will allow a reseed to take place.
(package private) static net.jxta.endpoint.MessageElement EDGE_ELEMENT
           
(package private) static java.lang.String EDGE_ELEMENT_NAME
          Element name that specifies by its presence whether the sender is configured as an edge peer.
private  net.jxta.endpoint.EndpointService endpoint
           
(package private) static net.jxta.endpoint.MessageElement FAILURE_ELEMENT
           
(package private) static java.lang.String FAILURE_ELEMENT_NAME
          Element name that specifies by its presence whether the enclosed RdvAdvertisement is about a failure.
private  net.jxta.peergroup.PeerGroup group
           
private  PeerViewStrategy kickAdvertisementStrategy
           
private  PeerViewStrategy kickRecipientStrategy
           
private  int lastModCount
           
private  net.jxta.protocol.PeerAdvertisement lastPeerAdv
           
private  net.jxta.protocol.PipeAdvertisement localGroupWirePipeAdv
           
private  net.jxta.pipe.InputPipe localGroupWirePipeInputPipe
          Used for notifications about pve failures.
private  net.jxta.pipe.OutputPipe localGroupWirePipeOutputPipe
          Used for notifications about pve failures.
private  java.util.SortedSet localView
          This is the accumulated view by an instance of this class.
private static org.apache.log4j.Logger LOG
          Log4J Logger
private static int MAX_EDGE_PEER_BOOTLEVEL
           
private static int MAX_RDV_PEER_BOOTLEVEL
           
(package private) static java.lang.String MESSAGE_ELEMENT_NAME
          Element name of outgoing messages.
(package private) static java.lang.String MESSAGE_NAMESPACE
          Namespace used for rdv message elements.
private static int MIN_BOOTLEVEL
           
private  int minHappyPeerView
          If the peerview is smaller than this we will try harder to find additional peerview members.
private  java.lang.String name
          The name of this PeerView.
private  java.util.Set permanentSeedHosts
          These are seed peers which were specified as part of the configuration data or programmatically.
private  boolean probeRelays
          Whether relays should be probed for rendezvous advertisements.
private static java.util.Random random
          A random number generator.
private  net.jxta.impl.rendezvous.RendezVousServiceImpl rdvService
           
private  PeerViewStrategy refreshRecipientStrategy
           
private  long refreshTime
           
private  PeerViewStrategy replyStrategy
           
(package private) static java.lang.String RESPONSE_ELEMENT_NAME
          Element name of responses.
private  java.util.Set rpvListeners
           
private  java.util.Set scheduledTasks
          List of scheduled tasks
private  long seedingRdvConnDelay
          Delay in relative milliseconds to apply before contacting seeding rdvs.
private  java.util.Set seedingURIs
          These URIs specify location of seed peer lists.
private  PeerViewElement self
          PVE for ourself.
(package private) static java.lang.String SERVICE_NAME
          Our service name
(package private) static java.lang.String SRCROUTEADV_ELEMENT_NAME
          (optional) Element name that specifies the route advertisement of the source of the message.
private  java.util.Timer timer
          A single timer is used to periodically kick each PeerView into activity.
private  java.lang.String uniqueGroupId
           
private  PeerViewElement upPeer
           
private  boolean useOnlySeeds
          Whether we are restricted to using seed rdvs only.
private static long WATCHDOG_GRACE_DELAY
           
private static long WATCHDOG_PERIOD
           
private  PeerView.WatchdogTask watchdogTask
          A task which monitors the up and down peers in the peerview.
private  net.jxta.pipe.InputPipe wirePipeInputPipe
          Used for querying for pves.
private  net.jxta.pipe.OutputPipe wirePipeOutputPipe
          Used for querying for pves.
 
Constructor Summary
PeerView(net.jxta.peergroup.PeerGroup group, net.jxta.peergroup.PeerGroup advertisingGroup, net.jxta.impl.rendezvous.RendezVousServiceImpl rdvService, java.lang.String name)
          Get an instance of PeerView for the specified PeerGroup and Service.
 
Method Summary
 boolean addListener(PeerViewListener listener)
          Add a listener for PeerViewEvent
private  boolean addPeerViewElement(PeerViewElement pve)
          Add the provided element to the local peerview.
 void addSeed(java.net.URI seed)
          Adds the specified URI to the list of seeds.
protected  void addTask(java.util.TimerTask task, long delay, long interval)
           
private  int adjustBootLevel()
          Choose a boot level appropriate for the current configuration and state.
private  void closeWirePipes()
           
private static net.jxta.protocol.RdvAdvertisement createRdvAdvertisement(net.jxta.protocol.PeerAdvertisement padv, java.lang.String name)
           
private  java.util.List discoverRdvAdverisements()
          Get a List of RdvAdvertisements locally found in Discovery of peers that w ere known to act as Rendezvous.
private  void generateEvent(int type, PeerViewElement element)
          Generate a PeerView Event and notify all listeners.
 PeerViewElement getDownPeer()
          Get the down peer from the local peer.
 PeerViewElement getPeerViewElement(net.jxta.id.ID pid)
          Get from the local view, the PeerViewElement for the given PeerID, if one exists.
 PeerViewElement getPeerViewElement(PeerViewDestination wanted)
          Return from the local view, the PeerViewElement that is equal to the given PeerViewDestination, if one exists or null if it is not present.
private  java.util.List getRelayPeers()
           
 PeerViewElement getSelf()
          Get the local peer.
 PeerViewElement getUpPeer()
          Get the up peer from the local peer.
 java.util.SortedSet getView()
          Get a copy of the PeerView for this group.
private  boolean isSeedRdv(net.jxta.protocol.RdvAdvertisement rdvAdv)
          Evaluates if the given pve corresponds to one of our seed rdvs.
private  void kick()
          Invoked by the Timer thread to cause each PeerView to initiate a Peer Advertisement exchange.
(package private) static java.net.URI[] loadSeeds(java.net.URI seedingURI)
           
private  net.jxta.endpoint.Message makeMessage(PeerViewElement content, boolean response, boolean failure)
          Make a PeerView Message
private  net.jxta.protocol.PipeAdvertisement makeWirePipeAdvertisement(net.jxta.peergroup.PeerGroup destGroup)
           
 void notifyFailure(net.jxta.peer.PeerID pid, boolean propagate)
          Invoked by anyone in order to inform the PeerView of a failure of one of its rendezvous peer.
(package private)  void notifyFailure(PeerViewElement pve, boolean propagateFailure)
          Invoked by a PeerViewElement when a rendezvous peer becomes unreachable.
private  void openWirePipes()
           
 boolean probeAddress(net.jxta.endpoint.EndpointAddress address, java.lang.Object hint)
          Probe the specified peer immediately.
 void processIncomingMessage(net.jxta.endpoint.Message msg, net.jxta.endpoint.EndpointAddress srcAddr, net.jxta.endpoint.EndpointAddress dstAddr)
          null Listener for "PeerView"/ and propagate pipes.
private  void refreshSelf()
          Refresh the local copy of the peer advertisement and the rendezvous advertisement.
 boolean removeListener(PeerViewListener listener)
          Removes a PeerViewEvent Listener previously added with addListener.
private  boolean removePeerViewElement(PeerViewElement pve)
          Remove the provided element from the local peerview.
protected  void removeTask(java.util.TimerTask task)
           
 void rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
          null
private  void rescheduleKick(boolean now)
           
private  void scheduleAdvertisingGroupQuery(long delay)
           
private  void scheduleOpenPipes(long delay)
           
 void seed()
          Send our own advertisement to all of the seed rendezvous.
private  boolean send(net.jxta.endpoint.EndpointAddress dest, java.lang.Object hint, PeerViewElement pve, boolean response, boolean failure)
          Send a PeerView Message to the specified peer.
private  boolean send(net.jxta.pipe.OutputPipe dest, PeerViewElement pve, boolean response, boolean failure)
          Send a PeerView Message to the specified peer.
private  boolean send(PeerViewElement dest, PeerViewElement pve, boolean response, boolean failure)
          Send a PeerView Message to the specified peer.
private  boolean sendRandomByAddr(java.util.List dests, int maxNb, long delay)
          Send our own advertisement to a randomly choosen set of potential rendezvous peers.
private  boolean sendRandomByAdv(java.util.List rdvs, int maxNb, long delay)
          Send our own advertisement to a randomly choosen set of potential rendezvous peers.
 void start()
           
 void stop()
           
private  void timedSend(PeerViewElement pve, net.jxta.endpoint.EndpointAddress destAddr, long delay)
           
private  void timedSend(PeerViewElement pve, PeerViewElement dest, long delay)
           
private  void updateUpAndDownPeers()
          update Up and Down Peers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final transient org.apache.log4j.Logger LOG
Log4J Logger


SERVICE_NAME

static final java.lang.String SERVICE_NAME
Our service name

See Also:
Constant Field Values

MESSAGE_NAMESPACE

static final java.lang.String MESSAGE_NAMESPACE
Namespace used for rdv message elements.

See Also:
Constant Field Values

MESSAGE_ELEMENT_NAME

static final java.lang.String MESSAGE_ELEMENT_NAME
Element name of outgoing messages.

See Also:
Constant Field Values

RESPONSE_ELEMENT_NAME

static final java.lang.String RESPONSE_ELEMENT_NAME
Element name of responses.

See Also:
Constant Field Values

CACHED_RADV_ELEMENT_NAME

static final java.lang.String CACHED_RADV_ELEMENT_NAME
Element name that specifies by its presence whether the enclosed RdvAdvertisement is a hint (cached), or is known to be active. In practice, when sending its own RdvAdvertisement,a peer does not set this element, but when sending another peer's RdvAdvertisement, this element is set.

See Also:
Constant Field Values

CACHED_RADV_ELEMENT

static final net.jxta.endpoint.MessageElement CACHED_RADV_ELEMENT

SRCROUTEADV_ELEMENT_NAME

static final java.lang.String SRCROUTEADV_ELEMENT_NAME
(optional) Element name that specifies the route advertisement of the source of the message.

See Also:
Constant Field Values

EDGE_ELEMENT_NAME

static final java.lang.String EDGE_ELEMENT_NAME
Element name that specifies by its presence whether the sender is configured as an edge peer. Edge peers do not become part of any peer's view.

See Also:
Constant Field Values

EDGE_ELEMENT

static final net.jxta.endpoint.MessageElement EDGE_ELEMENT

FAILURE_ELEMENT_NAME

static final java.lang.String FAILURE_ELEMENT_NAME
Element name that specifies by its presence whether the enclosed RdvAdvertisement is about a failure.

See Also:
Constant Field Values

FAILURE_ELEMENT

static final net.jxta.endpoint.MessageElement FAILURE_ELEMENT

DEFAULT_SEEDING_PERIOD

private static final long DEFAULT_SEEDING_PERIOD
This is the interval between adv exchange in seconds. This is the main tunable runtime parameter for the diffusion process. An interval that is too low will improve view consistency at the expense of gratuitous network traffic. On the other hand, an interval that is too high will cause the view to become inconsistent. It is desirable to err on the side of extra traffic.

See Also:
Constant Field Values

WATCHDOG_PERIOD

private static final long WATCHDOG_PERIOD
See Also:
Constant Field Values

ACL_REFRESH_PERIOD

private static final long ACL_REFRESH_PERIOD
See Also:
Constant Field Values

WATCHDOG_GRACE_DELAY

private static final long WATCHDOG_GRACE_DELAY
See Also:
Constant Field Values

DEFAULT_BOOTSTRAP_KICK_INTERVAL

private static final long DEFAULT_BOOTSTRAP_KICK_INTERVAL
See Also:
Constant Field Values

MIN_BOOTLEVEL

private static final int MIN_BOOTLEVEL
See Also:
Constant Field Values

BOOTLEVEL_INCREMENT

private static final int BOOTLEVEL_INCREMENT
See Also:
Constant Field Values

MAX_EDGE_PEER_BOOTLEVEL

private static final int MAX_EDGE_PEER_BOOTLEVEL
See Also:
Constant Field Values

MAX_RDV_PEER_BOOTLEVEL

private static final int MAX_RDV_PEER_BOOTLEVEL
See Also:
Constant Field Values

DEFAULT_RADV_LIFETIME

private static final long DEFAULT_RADV_LIFETIME
Default lifetimes for RdvAdvertisement that are published.

See Also:
Constant Field Values

DEFAULT_RADV_EXPIRATION

private static final long DEFAULT_RADV_EXPIRATION
See Also:
Constant Field Values

DEFAULT_SEEDING_RDVPEERS

private static final int DEFAULT_SEEDING_RDVPEERS
DEFAULT_SEEDING_RDVPEERS This value is the maximum number of rendezvous peers that will be send our own advertisement at boot time.

See Also:
Constant Field Values

group

private final net.jxta.peergroup.PeerGroup group

advertisingGroup

private final net.jxta.peergroup.PeerGroup advertisingGroup

rdvService

private final net.jxta.impl.rendezvous.RendezVousServiceImpl rdvService

endpoint

private final net.jxta.endpoint.EndpointService endpoint

refreshTime

private long refreshTime

name

private final java.lang.String name
The name of this PeerView.

FIXME 20040623 bondolo This should be a CodatID.


seedingRdvConnDelay

private long seedingRdvConnDelay
Delay in relative milliseconds to apply before contacting seeding rdvs. 0 is supposed to be reserved by RdvConfig to mean "use the default". However, it is in fact a valid value and also the one we want for the default. The only problem with that is that it is not possible to configure this value explicitly, should it one day not be the default. The issue is actually in RdvConfig.


probeRelays

private boolean probeRelays
Whether relays should be probed for rendezvous advertisements.


minHappyPeerView

private int minHappyPeerView
If the peerview is smaller than this we will try harder to find additional peerview members.


useOnlySeeds

private boolean useOnlySeeds
Whether we are restricted to using seed rdvs only.


permanentSeedHosts

private java.util.Set permanentSeedHosts
These are seed peers which were specified as part of the configuration data or programmatically. These seeds are never deleted.


activeSeedHosts

private java.util.Set activeSeedHosts
The active list of seed peers. Formed by the union of the permanent seed hosts and the lists of seed peers downloaded from the seeding URIs.


seedingURIs

private java.util.Set seedingURIs
These URIs specify location of seed peer lists. The URIs will be resolved via URLConnection and are assumed to refer to plain text lists of URIs.


timer

private final java.util.Timer timer
A single timer is used to periodically kick each PeerView into activity. For the Random PeerView, this activity consists of selecting a PeerViewElement at random from its view and sending it across to a randomly-selected peer from its view.

FIXME 20021121 lomax

The original idea of using a common timer in order to save threads IS a very good idea. However, limitations, and actually, bugs, in java.util.Timer creates the following problems when using a static Timer:

  • Memory Leak: Cancelling a TimerTask does not remove it from the execution queue of the Timer until the Timer is cancelled or the TimerTask is fired. Since most of the TimerTasks are inner classes this can mean that the PeerView is held around for a long time.
  • java.util.Timer is not only not real-time (which is more or less fine for the PeerView, but it sequentially invokes tasks (only one Thread per Timer). As a result, tasks that takes a long time to run delays other tasks.

The PeerView would function better with a better Timer, but JDK does not provide a standard timer that would fullfill the needs of the PeerView. Maybe we should implement a JXTA Timer, since lots of the JXTA services, by being very asynchronous, rely on the same kind of timer semantics as the PeerView. Until then, creating a Timer per instance of the PeerView (i.e. per instance of joined PeerGroup) is the best workaround.


random

private static final java.util.Random random
A random number generator.


scheduledTasks

private final java.util.Set scheduledTasks
List of scheduled tasks


bootLevel

private int bootLevel
Describes the frequency and amount of effort we will spend updating the peerview.


earliestReseed

private long earliestReseed
Earliest absolute time in milliseconds at which we will allow a reseed to take place.


uniqueGroupId

private final java.lang.String uniqueGroupId

rpvListeners

private final java.util.Set rpvListeners

wirePipeInputPipe

private net.jxta.pipe.InputPipe wirePipeInputPipe
Used for querying for pves.


wirePipeOutputPipe

private net.jxta.pipe.OutputPipe wirePipeOutputPipe
Used for querying for pves.


localGroupWirePipeInputPipe

private net.jxta.pipe.InputPipe localGroupWirePipeInputPipe
Used for notifications about pve failures.


localGroupWirePipeOutputPipe

private net.jxta.pipe.OutputPipe localGroupWirePipeOutputPipe
Used for notifications about pve failures.


watchdogTask

private PeerView.WatchdogTask watchdogTask
A task which monitors the up and down peers in the peerview.


localView

private final java.util.SortedSet localView
This is the accumulated view by an instance of this class.

Values are PeerViewElement


self

private final PeerViewElement self
PVE for ourself. FIXME bondolo 20041015 This should be part of the local view.


upPeer

private PeerViewElement upPeer

downPeer

private PeerViewElement downPeer

replyStrategy

private final PeerViewStrategy replyStrategy

kickRecipientStrategy

private final PeerViewStrategy kickRecipientStrategy

kickAdvertisementStrategy

private final PeerViewStrategy kickAdvertisementStrategy

refreshRecipientStrategy

private final PeerViewStrategy refreshRecipientStrategy

acl

protected final net.jxta.impl.access.AccessList acl

aclFile

protected java.io.File aclFile

aclFileLastModified

protected long aclFileLastModified

lastPeerAdv

private net.jxta.protocol.PeerAdvertisement lastPeerAdv

lastModCount

private int lastModCount

localGroupWirePipeAdv

private final net.jxta.protocol.PipeAdvertisement localGroupWirePipeAdv

advGroupPropPipeAdv

private final net.jxta.protocol.PipeAdvertisement advGroupPropPipeAdv

closed

private volatile boolean closed
If true then this Peer View instance is closed and is shutting down.

Constructor Detail

PeerView

public PeerView(net.jxta.peergroup.PeerGroup group,
                net.jxta.peergroup.PeerGroup advertisingGroup,
                net.jxta.impl.rendezvous.RendezVousServiceImpl rdvService,
                java.lang.String name)
Get an instance of PeerView for the specified PeerGroup and Service.

Method Detail

processIncomingMessage

public void processIncomingMessage(net.jxta.endpoint.Message msg,
                                   net.jxta.endpoint.EndpointAddress srcAddr,
                                   net.jxta.endpoint.EndpointAddress dstAddr)
null Listener for "PeerView"/ and propagate pipes.

Specified by:
processIncomingMessage in interface net.jxta.endpoint.EndpointListener

rendezvousEvent

public void rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
null

Specified by:
rendezvousEvent in interface net.jxta.rendezvous.RendezvousListener

start

public void start()

stop

public void stop()

addTask

protected void addTask(java.util.TimerTask task,
                       long delay,
                       long interval)

removeTask

protected void removeTask(java.util.TimerTask task)

addSeed

public void addSeed(java.net.URI seed)
Adds the specified URI to the list of seeds. Even if useOnlySeeds is in effect, this seed may now be used, as if it was part of the initial configuration.


probeAddress

public boolean probeAddress(net.jxta.endpoint.EndpointAddress address,
                            java.lang.Object hint)
Probe the specified peer immediately.

Note: If "useOnlySeeds" is in effect and the peer is not a seed, any response to this probe will be ignored.


seed

public void seed()
Send our own advertisement to all of the seed rendezvous.


isSeedRdv

private boolean isSeedRdv(net.jxta.protocol.RdvAdvertisement rdvAdv)
Evaluates if the given pve corresponds to one of our seed rdvs. This is to support the useOnlySeeds flag. The test is not completely foolproof since our list of seed rdvs is just transport addresses. We could be given a pve that exhibits an address that corresponds to one of our seeds but is fake. And we might later succeed in connecting to that rdv via one the other, real addresses. As a result, useOnlySeeds is *not* a security feature, just a convenience for certain kind of deployments. Seed rdvs should include certificates for such a restriction to be a security feature.


scheduleOpenPipes

private void scheduleOpenPipes(long delay)

send

private boolean send(PeerViewElement dest,
                     PeerViewElement pve,
                     boolean response,
                     boolean failure)
Send a PeerView Message to the specified peer.


send

private boolean send(net.jxta.endpoint.EndpointAddress dest,
                     java.lang.Object hint,
                     PeerViewElement pve,
                     boolean response,
                     boolean failure)
Send a PeerView Message to the specified peer.


send

private boolean send(net.jxta.pipe.OutputPipe dest,
                     PeerViewElement pve,
                     boolean response,
                     boolean failure)
Send a PeerView Message to the specified peer.


makeMessage

private net.jxta.endpoint.Message makeMessage(PeerViewElement content,
                                              boolean response,
                                              boolean failure)
Make a PeerView Message


notifyFailure

public void notifyFailure(net.jxta.peer.PeerID pid,
                          boolean propagate)
Invoked by anyone in order to inform the PeerView of a failure of one of its rendezvous peer.


notifyFailure

void notifyFailure(PeerViewElement pve,
                   boolean propagateFailure)
Invoked by a PeerViewElement when a rendezvous peer becomes unreachable.


kick

private void kick()
Invoked by the Timer thread to cause each PeerView to initiate a Peer Advertisement exchange.


adjustBootLevel

private int adjustBootLevel()
Choose a boot level appropriate for the current configuration and state.


rescheduleKick

private void rescheduleKick(boolean now)

sendRandomByAdv

private boolean sendRandomByAdv(java.util.List rdvs,
                                int maxNb,
                                long delay)
Send our own advertisement to a randomly choosen set of potential rendezvous peers.


sendRandomByAddr

private boolean sendRandomByAddr(java.util.List dests,
                                 int maxNb,
                                 long delay)
Send our own advertisement to a randomly choosen set of potential rendezvous peers.


discoverRdvAdverisements

private java.util.List discoverRdvAdverisements()
Get a List of RdvAdvertisements locally found in Discovery of peers that w ere known to act as Rendezvous.


refreshSelf

private void refreshSelf()
Refresh the local copy of the peer advertisement and the rendezvous advertisement.


createRdvAdvertisement

private static net.jxta.protocol.RdvAdvertisement createRdvAdvertisement(net.jxta.protocol.PeerAdvertisement padv,
                                                                         java.lang.String name)

addListener

public boolean addListener(PeerViewListener listener)
Add a listener for PeerViewEvent


removeListener

public boolean removeListener(PeerViewListener listener)
Removes a PeerViewEvent Listener previously added with addListener.


generateEvent

private void generateEvent(int type,
                           PeerViewElement element)
Generate a PeerView Event and notify all listeners.


makeWirePipeAdvertisement

private net.jxta.protocol.PipeAdvertisement makeWirePipeAdvertisement(net.jxta.peergroup.PeerGroup destGroup)

openWirePipes

private void openWirePipes()

closeWirePipes

private void closeWirePipes()

scheduleAdvertisingGroupQuery

private void scheduleAdvertisingGroupQuery(long delay)

getView

public java.util.SortedSet getView()
Get a copy of the PeerView for this group.


addPeerViewElement

private boolean addPeerViewElement(PeerViewElement pve)
Add the provided element to the local peerview.


removePeerViewElement

private boolean removePeerViewElement(PeerViewElement pve)
Remove the provided element from the local peerview.


getPeerViewElement

public PeerViewElement getPeerViewElement(PeerViewDestination wanted)
Return from the local view, the PeerViewElement that is equal to the given PeerViewDestination, if one exists or null if it is not present. Identity is defined by PeerViewDestination#equals() which only looks at the destination address. Thus a PeerViewDestination is enough. A full PeerViewElement may be passed as well. This method does not require external synchronization.


getPeerViewElement

public PeerViewElement getPeerViewElement(net.jxta.id.ID pid)
Get from the local view, the PeerViewElement for the given PeerID, if one exists. Null otherwise. This method does not require external synchronization.


getDownPeer

public PeerViewElement getDownPeer()
Get the down peer from the local peer.


getSelf

public PeerViewElement getSelf()
Get the local peer.


getUpPeer

public PeerViewElement getUpPeer()
Get the up peer from the local peer.


updateUpAndDownPeers

private void updateUpAndDownPeers()
update Up and Down Peers


getRelayPeers

private java.util.List getRelayPeers()

loadSeeds

static java.net.URI[] loadSeeds(java.net.URI seedingURI)
                         throws java.io.IOException

timedSend

private void timedSend(PeerViewElement pve,
                       PeerViewElement dest,
                       long delay)

timedSend

private void timedSend(PeerViewElement pve,
                       net.jxta.endpoint.EndpointAddress destAddr,
                       long delay)