JAVA-P2P-unrealse
所属分类:P2P编程
开发工具:Java
文件大小:3525KB
下载次数:400
上传日期:2006-03-29 15:42:42
上 传 者:
ywh21
说明: JAVAP2P技术内幕源代码与大家一起分享
(JAVAP2P technology insider source code and share with everyone)
文件列表:
JAVA P2P技术内幕\code\ch02\Monitor.java (620, 2002-08-23)
JAVA P2P技术内幕\code\ch02\MulticastListener.java (729, 2005-12-08)
JAVA P2P技术内幕\code\ch02\MulticastListener.java~1~ (727, 2002-08-23)
JAVA P2P技术内幕\code\ch02\MulticastListener.java~2~ (733, 2005-12-08)
JAVA P2P技术内幕\code\ch02\MulticastSender.java (643, 2005-12-08)
JAVA P2P技术内幕\code\ch02\MulticastSender.java~1~ (642, 2002-08-23)
JAVA P2P技术内幕\code\ch02\MulticastSender.java~2~ (647, 2005-12-08)
JAVA P2P技术内幕\code\ch02\URLViewer.java (876, 2006-01-22)
JAVA P2P技术内幕\code\ch02\URLViewer.java~1~ (921, 2002-08-23)
JAVA P2P技术内幕\code\ch02\URLViewer.java~2~ (881, 2005-12-12)
JAVA P2P技术内幕\code\ch02 (0, 2006-01-22)
JAVA P2P技术内幕\code\ch07\HelloInitiator.java (4113, 2002-08-23)
JAVA P2P技术内幕\code\ch07\HelloListener.java (7068, 2002-08-23)
JAVA P2P技术内幕\code\ch07 (0, 2002-10-02)
** (1525, 2002-08-23)
JAVA P2P技术内幕\code\ch08 (0, 2002-10-02)
JAVA P2P技术内幕\code\ch10\AccountPermission.java (348, 2002-08-23)
JAVA P2P技术内幕\code\ch10\LoginContext.java (485, 2002-08-23)
JAVA P2P技术内幕\code\ch10\LoginHandler.java (3869, 2002-08-23)
JAVA P2P技术内幕\code\ch10\LoginModule.java (183, 2002-08-23)
JAVA P2P技术内幕\code\ch10\WorkPlaceAction.java (484, 2002-08-23)
JAVA P2P技术内幕\code\ch10\WorkPlaceLoginModule.java (5074, 2002-08-23)
JAVA P2P技术内幕\code\ch10\WorkPlacePrincipal.java (1036, 2002-08-23)
JAVA P2P技术内幕\code\ch10 (0, 2002-10-02)
JAVA P2P技术内幕\code\ch11\BookSellers.xml (797, 2002-08-23)
JAVA P2P技术内幕\code\ch11\BookSellers.xsd (1380, 2002-08-23)
JAVA P2P技术内幕\code\ch11\BookSellers2.xml (927, 2002-08-23)
JAVA P2P技术内幕\code\ch11\GetBookPrice.wsdl (2718, 2002-08-23)
JAVA P2P技术内幕\code\ch11\SOAPMsgRequest.SOAP (628, 2002-08-23)
JAVA P2P技术内幕\code\ch11\SOAPMsgResponse.SOAP (665, 2002-08-23)
JAVA P2P技术内幕\code\ch11 (0, 2002-10-02)
JAVA P2P技术内幕\code\ch12\JAXMSOAPClient.java (2158, 2002-08-23)
JAVA P2P技术内幕\code\ch12\MessageConsumer.java (5560, 2002-08-23)
JAVA P2P技术内幕\code\ch12\MessageProducer.java (4008, 2002-08-23)
JAVA P2P技术内幕\code\ch12\SOAPRequest.java (5064, 2002-08-23)
JAVA P2P技术内幕\code\ch12\SoapRequest.xml (512, 2002-08-23)
JAVA P2P技术内幕\code\ch12\SoapResponse.html (197, 2002-08-22)
JAVA P2P技术内幕\code\ch12\SOAPResponse.java (3526, 2002-08-23)
... ...
PrimeCruncher: A Prime Number Finding Service
Java P2P Unleashed (Sams, 2002)
1. Description
PrimeCruncher defines a JXTA service that computes a list of prime numbers between
two integers in a distributed manner. This implementation uses the Java JXTA
bindings, and is defined in the Java class PrimePeer.
A client of this service is also provided, specified in the class PrimeClient. That
client asynchronously discovers peers that advertise the prime number searching
service via JXTA ModuleSpecAdvertisements. When a user specifies two integers, the
client program distributes the task of calculating prime numbers between those
integers among all the PrimeCruncher peers it knows of at the time of a job's
submission. The client opens a JXTA pipe to each such peer, and sends each a message
containing a peer's segment boundary integers. That message also contains the
client's PipeAdvertisement to allow the prime searching peer to send its response
back to the requesting peer.
A prime searching peer computes the list of primes between those boundary numbers,
opens a JXTA pipe back to the requesting peer, and sends a response message
containing the result as a comma-separated integer list. The client peer waits for
all peers to send back their responses, and it then assembles the complete primes
list from the partial results, and displays that list back to the user.
2. Limitations
This example focuses on JXTA programming features, and does not attempt to distribute
the computation fairly between peers. Rather, it provides a framework upon which a
more sophisticated scheduling mechanism may be built.
3. How to compile and run the examples
To compile and run this service with the included Ant build file, you need to have
the following software installed:
* JDK 1.3 or higher
* JXTA Java binding
* Ant 1.4 or higher
The JDK may be downloaded from http://java.sun.com. You may obtain the most
up-to-date JXTA release from http://www.jxta.org, and the current Ant distribution
from http://jakarta.apache.org.
Once you've installed these packages (installation instructions for each package are
available at their respective Web sites), you can use Ant to compile and run the
service. To build the classes from the source directory, open a command window on
your favorite operating system, and type:
> ant
To build the documentation, type:
> ant javadoc
To run the service, enter:
>ant runservice
To run another instance of the service (to simulate a multi-machine environment),
type:
>ant runservice2
Finally, to run the client, enter:
>ant runclient
4. Questions or comments
Please check the Java P2P Unleashed Web site for updates and further details
http://www.samspublishing.com
近期下载者:
相关文件:
收藏者: