亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? restopeer.java

?? JXTA技術(shù)手冊 書上3.4.5章的源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
import java.io.*;import java.util.*;import java.net.URL; import net.jxta.peergroup.PeerGroup;import net.jxta.peergroup.PeerGroupFactory;import net.jxta.peergroup.PeerGroupID;import net.jxta.exception.PeerGroupException;import net.jxta.discovery.DiscoveryService;import net.jxta.document.AdvertisementFactory;import net.jxta.document.Advertisement;import net.jxta.document.Element;import net.jxta.document.MimeMediaType;import net.jxta.document.StructuredTextDocument;import net.jxta.document.StructuredDocumentFactory;import net.jxta.document.StructuredDocument;import net.jxta.document.StructuredDocumentUtils;import net.jxta.pipe.PipeService;import net.jxta.pipe.PipeID;import net.jxta.protocol.PipeAdvertisement;import net.jxta.protocol.PeerGroupAdvertisement;import net.jxta.protocol.ModuleSpecAdvertisement;import net.jxta.protocol.ModuleImplAdvertisement;import net.jxta.id.IDFactory;import net.jxta.id.ID;import net.jxta.platform.ModuleClassID;import net.jxta.platform.ModuleSpecID;import net.jxta.impl.peergroup.StdPeerGroupParamAdv;// RestoPeer represents a restaurant that receives auction requests// for french fries from HungryPeers. RestoPeers offers three sizes of// french fries (small, large, medium). Each restaurant assignes a// different price to each size. Each restaurant also offers a special// offering.//// Each resturant is uniquely identified by its brand name.//public class RestoPeer {    private PeerGroup netpg = null;      // The NetPeerGroup    private PeerGroup restoNet = null;   // The restoNet Peergroup    private String brand = "Chez JXTA";        // Brand of this restaurant    // Services within the RestoNet peergroup    private DiscoveryService disco = null;  // Discovery service    private PipeService pipes = null;       // Pipe service    private PipeAdvertisement myAdv = null; // My RestoPeer pipe advertisement    private int timeout = 3000;          // discovery wait timeout    // IDs within RestoNet    private ModuleClassID mcID = IDFactory.newModuleClassID();    private ModuleSpecID  msID = IDFactory.newModuleSpecID(mcID);    private static PeerGroupID restoPeerGroupID;   // main method to start our RestoPeer    public static void main(String args[]) {	RestoPeer myapp = new RestoPeer();	myapp.startJxta();	System.exit(0);    }        // Method to start the JXTA platform, join the RestoNet peergroup and    // advertise the RestoPeer service    private void startJxta() {        try {            //Discover and join (or start) the default peergroup            netpg = PeerGroupFactory.newNetPeerGroup();        } catch (PeerGroupException e) {            //Couldn't initialize; can't continue            System.out.println("Fatal error : creating the NetPeerGroup");            System.exit(1);        }        // Discover (or create) and join the RestoNet peergroup        try {            joinRestoNet();        } catch (Exception e) {            System.out.println("Can't join or create RestoNet");            System.exit(1);        }        // Wait while we process requests        synchronized(RestoPeer.class) {            try {                RestoPeer.class.wait();	    } catch (InterruptedException ie) {	        System.out.println("Interrupted; exiting");	    }        }    }        // Discover (or create) and join the RestoNet peergroup    private void joinRestoNet() throws Exception {        int count = 3;   // maximun number of attempts to discover        System.out.println("Attempting to Discover the RestoNet PeerGroup");        // Get the discovery service from the NetPeergroup        DiscoveryService hdisco = netpg.getDiscoveryService();        Enumeration ae = null;   // Holds the discovered peers        // Loop until wediscover the RestoNet or        // until we've exhausted the desired number of attempts        while (count-- > 0) {            try {                // search first in the peer local cache to find                // the RestoNet peergroup advertisement                ae = hdisco.getLocalAdvertisements(DiscoveryService.GROUP,                                          "Name", "RestoNet");                // If we found the RestoNet advertisement we are done                if ((ae != null) && ae.hasMoreElements())                    break;                // If we did not find it, we send a discovery request                hdisco.getRemoteAdvertisements(null,                       DiscoveryService.GROUP, "Name", "RestoNet", 1, null);                // Sleep to allow time for peers to respond to the                // discovery request                try {                    Thread.sleep(timeout);                } catch (InterruptedException ie) {}            } catch (IOException e){                // Found nothing! Move on            }        }        PeerGroupAdvertisement restoNetAdv = null;        // Check if we found the RestoNet advertisement.        // If we didn't, then either        //       we are the first peer to join or        //       no other RestoNet peers are up.        // In either case, we must create the RestoNet peergroup        if (ae == null || !ae.hasMoreElements()) {            System.out.println(                 "Could not find the RestoNet peergroup; creating one");            try {		// Create the RestoNetPeerGroup		restoNet = createRestoPeerGroup();				// Get the PeerGroup Advertisement		restoNetAdv = netpg.getPeerGroupAdvertisement();            } catch (Exception e) {                System.out.println("Error in creating RestoNet Peergroup");                throw e;            }        } else {            // The RestoNet advertisement was found in the cache;            // that means we can join the existing RestoNet peergroup            try {                restoNetAdv = (PeerGroupAdvertisement) ae.nextElement();                restoNet = netpg.newGroup(restoNetAdv);                System.out.println(                    "Found the RestoNet Peergroup advertisement");            } catch (Exception e) {                System.out.println("Error in creating RestoNet PeerGroup from existing adv");                throw e;            }        }        try {            // Get the discovery and pipe services for the RestoNet Peergroup            disco = restoNet.getDiscoveryService();            pipes = restoNet.getPipeService();        } catch (Exception e) {            System.out.println("Error getting services from RestoNet");            throw e;        }        System.out.println("RestoNet Restaurant (" + brand + ") is on-line");        return;    }    // This method is used to create a new instance of    // the RestoNet peergroup.    // Peergroups are implemented as modules.    // Modules are used in JXTA  to load and manage dynamic code on a peer.    //    // A peergroup is represented by a set of advertisements:     //  1) A peergroup advertisement that advertises the peergroup    //  2) A module spec advertisement that uniquely    //         specifies the peergroup (set of peergroup services)    //  3) A module impl advertisement that describes a    //         peergroup implementation    // This method must create all these advertisements    private PeerGroup createRestoPeerGroup() {	// Use a unique PeerGroup id as a constant so that the same	// peergroup ID is used each time the RestoNet Peergroup is created.	// It is essential that each RestoPeer use the same unique ID	// so that two peers do not create different IDs for the	// RestoNet peergroup. 	//	// The UUID in the URL constructor was generated via the	// Shell mkpgrp command that created a new peergroup with a	// unique peergroup ID.        try {            restoPeerGroupID = (PeerGroupID) IDFactory.fromURL(                  new URL("urn", "",                          "jxta:uuid-4d6172676572696e204272756e6f202002"));        } catch (java.net.MalformedURLException e) {            System.err.println("Can't create restoPeerGroupID: " + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println("Can't create restoPeerGroupID: " + e);            System.exit(1);        }	// Create a new Module Implementation advertisement that will	// represent the new RestoPeer peergroup service	// Assign a new SpecID that uniquely identifies the RestoPeer	// peergroup service. Ths spec ID must be shared between all	// instances of the RestoNet peergroup; it again is created via	// the mkpgrp Shell command.	ModuleSpecID  msrvID = null;	try {	    msrvID = (ModuleSpecID) IDFactory.fromURL(new URL("urn","",		"jxta:uuid-737D1ED776B043E7A8718B102B62055A614CAC047AD240A8960ABDE6F7847C2306"));	} catch (java.net.MalformedURLException e) {             System.err.println("Can't create restoPeer Spec Id:" + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println("Can't create restoPeer Spec Id:" + e);            System.exit(1);        }        	// Create a pipe advertisement to be used by Hungry Peers	// to communicate with the RestoNet peergroup service	PipeAdvertisement myAdv = (PipeAdvertisement)	    AdvertisementFactory.newAdvertisement(	    PipeAdvertisement.getAdvertisementType());			// Again we assign a hardwired ID to the pipe, so everytime a	// peer recreates the RestoNet peergroup, the same pipe id	// is used.	try {	    myAdv.setPipeID((PipeID) IDFactory.fromURL(new URL("urn","",              "jxta:uuid-9CCCDF5AD8154D3D87A391210404E59BE4B888209A2241A4A162A10916074A9504")));	} catch (java.net.MalformedURLException e) {            System.err.println("Can't create restoPeer PipeID: " + e);            System.exit(1);        } catch (java.net.UnknownServiceException e) {            System.err.println(" Can't create restoPeer PipeID: " + e);            System.exit(1);        }        	// The symbolic name of the pipe is built from

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产精品1区| 欧美三级电影网| 久久久久久日产精品| 激情图区综合网| 亚洲国产精品激情在线观看| 国产一区二区不卡| 亚洲国产精品t66y| 不卡一区二区中文字幕| 国产精品精品国产色婷婷| 色综合天天综合在线视频| 亚洲国产色一区| 3atv在线一区二区三区| 日本午夜精品视频在线观看| 26uuu亚洲婷婷狠狠天堂| 国产99久久久国产精品潘金网站| 久久亚洲精品小早川怜子| 粉嫩高潮美女一区二区三区| 亚洲色图欧美激情| 欧美在线一二三四区| 日本三级韩国三级欧美三级| 久久综合资源网| 91在线精品一区二区三区| 亚洲亚洲人成综合网络| 欧美一级二级三级乱码| 国产成人h网站| 亚洲国产裸拍裸体视频在线观看乱了| 欧美理论片在线| 国产伦精品一区二区三区免费迷| 国产精品三级在线观看| 91同城在线观看| 日本强好片久久久久久aaa| 欧美国产精品一区二区三区| 色成人在线视频| 免费在线成人网| 中文字幕一区二区三区视频| 欧美性三三影院| 国内精品写真在线观看| 亚洲综合一区在线| 国产亚洲欧洲997久久综合| 欧美视频一区二区三区四区 | 国产精品久久精品日日| 欧美日韩免费观看一区三区| 国产精品99久久久久久有的能看 | 91精品国产高清一区二区三区蜜臀| 国产在线不卡视频| 亚洲chinese男男1069| 国产精品国产三级国产普通话99| 欧美日韩成人一区| 波多野结衣亚洲一区| 麻豆国产欧美一区二区三区| 亚洲一区二区三区三| 国产色91在线| 日韩精品专区在线影院重磅| 欧美亚洲禁片免费| 99久久99久久精品国产片果冻| 麻豆91在线播放| 亚洲国产精品久久久久秋霞影院 | 中文字幕一区二区三区精华液| 91精品麻豆日日躁夜夜躁| 在线亚洲一区观看| 99久久综合精品| 大胆欧美人体老妇| 国产老妇另类xxxxx| 免费在线看一区| 日韩av午夜在线观看| 午夜欧美在线一二页| 一区二区三区日韩欧美| 国产精品国产三级国产aⅴ中文| 久久影院视频免费| 精品少妇一区二区三区 | 久久久国产一区二区三区四区小说 | 欧美成人伊人久久综合网| 欧美电影在哪看比较好| 欧美在线观看你懂的| 色婷婷综合久久久久中文一区二区 | 精品国产乱码久久久久久影片| 欧美日韩成人一区| 在线不卡中文字幕播放| 欧美日本在线播放| 91麻豆精品91久久久久久清纯| 欧美午夜精品久久久久久孕妇| 色综合激情五月| 欧美私模裸体表演在线观看| 欧美影院午夜播放| 欧美人妖巨大在线| 日韩视频一区在线观看| 精品蜜桃在线看| 国产欧美日韩精品一区| 中文字幕中文字幕中文字幕亚洲无线| 欧美国产精品专区| 亚洲欧洲综合另类在线| 一区二区不卡在线播放 | 欧美午夜精品免费| 欧美日韩午夜影院| 3d成人动漫网站| 久久亚洲二区三区| 国产精品麻豆一区二区| 一区二区三区久久| 日本中文一区二区三区| 国产精品77777竹菊影视小说| 国产一区欧美二区| 99精品国产视频| 欧美三片在线视频观看| 精品伦理精品一区| 亚洲欧美日韩中文字幕一区二区三区| 亚洲伊人伊色伊影伊综合网| 午夜影视日本亚洲欧洲精品| 精品一区二区三区在线视频| 国产激情91久久精品导航| 在线看不卡av| 精品国产免费一区二区三区香蕉| 国产精品污污网站在线观看| 亚洲一区在线视频观看| 另类成人小视频在线| 99在线精品免费| 日韩一级完整毛片| 中文字幕一区二区三区不卡在线 | 亚洲一区二区在线免费看| 午夜精品久久久久久久99水蜜桃| 国产一区 二区| 欧美性一级生活| 久久蜜桃av一区精品变态类天堂| 亚洲啪啪综合av一区二区三区| 蜜桃在线一区二区三区| 99re在线精品| 久久毛片高清国产| 亚洲国产va精品久久久不卡综合| 国内精品伊人久久久久av影院| 色综合久久久久网| 精品国产乱码久久久久久1区2区 | 日本色综合中文字幕| 波多野结衣在线一区| 日韩女优电影在线观看| 亚洲蜜臀av乱码久久精品| 国产精品中文有码| 在线电影一区二区三区| 亚洲裸体在线观看| 国产成人在线网站| 日韩一区二区三区av| 一区二区三区在线视频观看58| 国产精品综合在线视频| 日韩一区二区三区在线| 一区二区三区欧美久久| 成人a区在线观看| 26uuu精品一区二区三区四区在线| 亚洲午夜久久久久久久久电影院| 成人夜色视频网站在线观看| 欧美v国产在线一区二区三区| 亚洲国产日产av| 色香色香欲天天天影视综合网| 日本一区二区三级电影在线观看 | 国产色婷婷亚洲99精品小说| 免费精品视频在线| 欧美日韩国产在线播放网站| 亚洲欧美偷拍卡通变态| 粉嫩av亚洲一区二区图片| 精品成人私密视频| 人人狠狠综合久久亚洲| 337p亚洲精品色噜噜| 亚洲第一精品在线| 精品视频一区二区不卡| 一区二区三区日韩欧美| 91国偷自产一区二区三区观看 | 精品视频999| 亚洲电影欧美电影有声小说| 色94色欧美sute亚洲线路一ni| 中文字幕一区二区三中文字幕| 国产成人精品1024| 国产精品久久久久久妇女6080| 粉嫩一区二区三区性色av| 国产三级一区二区三区| 国产成人综合亚洲网站| 国产目拍亚洲精品99久久精品| 国产精品一区二区在线观看网站| 久久久蜜桃精品| 成人毛片老司机大片| 国产精品久久福利| 色女孩综合影院| 亚洲成人午夜影院| 777xxx欧美| 久久99精品国产.久久久久 | 678五月天丁香亚洲综合网| 亚洲一区二三区| 欧美一区三区四区| 精品一二三四区| 国产精品水嫩水嫩| 91在线免费播放| 婷婷六月综合网| 精品美女一区二区三区| 成人美女视频在线看| 亚洲欧美怡红院| 欧美性生活一区| 久久精品国产亚洲高清剧情介绍| 久久青草欧美一区二区三区| 国产成人免费视频| 亚洲小说欧美激情另类| 日韩精品在线网站| 成人天堂资源www在线| 亚洲视频一区二区在线观看| 欧洲一区在线观看|