Name

PeerGroup

Synopsis

Instances of this class represent the core JXTA peergroup service. The peergroup service forms the basis of a number of JXTA operations that every peer must undertake.

JXTA peers typically join the NetPeerGroup by calling the newNetPeerGroup( ) method of the PeerGroupFactory class, which returns a peergroup object. Alternately, they may use the newPeerGroup( ) method of the PeerGroupFactory to join the NetPeerGroup, which also returns a peergroup object. In either case, the returned object is used to locate the core JXTA services: discovery, membership, and so on. In general, peers are encouraged to use the discovery service of the NetPeerGroup to locate other peergroups and use the services of the other peergroups to communicate with other peers. This prevents the NetPeerGroup from being overwhelmed.

New peergroups are created by the newGroup( ) method of this interface. You must have a new peergroup advertisement in order to make a new peergroup. This is usually accomplished by discovering the peergroup advertisement that you’re interested in: you retrieve the discovery service from a peergroup (using the getDiscoveryService( ) method) and use it to find the peergroup advertisement. If no advertisement is found, you must create one; the easiest way to do this is to use the advertisement returned from the getAllPurposePeerGroupImplAdvertisement( ) method of this interface. This advertisement may be modified to provide for new services within the new ...

Get JXTA in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.