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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? restopeerservice.java

?? 冒險島游戲的flash版本的函數
?? JAVA
字號:
import java.io.*;import java.util.*;import java.net.URL;import net.jxta.service.Service;import net.jxta.peergroup.PeerGroup;import net.jxta.peergroup.PeerGroupFactory;import net.jxta.exception.PeerGroupException;import net.jxta.document.AdvertisementFactory;import net.jxta.document.StructuredDocumentFactory;import net.jxta.document.Advertisement;import net.jxta.document.Element;import net.jxta.document.TextElement;import net.jxta.document.MimeMediaType;import net.jxta.document.StructuredDocument;import net.jxta.document.StructuredTextDocument;import net.jxta.discovery.DiscoveryService;import net.jxta.pipe.PipeService;import net.jxta.pipe.InputPipe;import net.jxta.pipe.OutputPipe;import net.jxta.pipe.PipeID;import net.jxta.protocol.PipeAdvertisement;import net.jxta.protocol.PeerGroupAdvertisement;import net.jxta.protocol.ModuleImplAdvertisement;import net.jxta.endpoint.Message;import net.jxta.id.IDFactory;import net.jxta.id.ID;// The class RestoPeerService is an example of a PeerGroup Service.// This service is registered as a RestoNet Peergroup service.// This service implements the RestoPeer service for Chez JXTA.public class RestoPeerService implements Service {    // Service Module Spec Index ID    public static String Module_Spec_ID =        "jxta:uuid-737D1ED776B043E7A8718B102B62055A05";    private String brand = "Chez JXTA";         // Brand of this restaurant    private String specials = "large ($3.00)";  // Current restaurant Special    private PeerGroup restoNet = null;   // The RestoNet Peergroup    private PipeService pipes = null;    // Pipe service in the RestoNet    private ModuleImplAdvertisement srvImpl = null;    private PipeAdvertisement myAdv = null;  // My pipe advertisement    private InputPipe pipeIn = null;         // Input pipe that we listening                                             // to for requests    private int rtimeout = 8000;             // Resolver pipe timeout    // Service objects are not manipulated directly to protect usage    //of the service. A Service interface is returned to access the service    public Service getInterface() {        return this;    }    // Returns the module impl advertisement for this service.    public Advertisement getImplAdvertisement() {        return srvImpl;    }    // Called when the peergroup initializes the service    public void init(PeerGroup group, ID assignedID, Advertisement impl) {        // Save the RestoNet pointer, the pipe and the RestoPeer Service        restoNet = group;        srvImpl = (ModuleImplAdvertisement) impl;        System.out.println("Initialization RestoPeer Special Service: " +                           srvImpl.getModuleSpecID());        // Extract the service pipe advertisement from the service        // module impl Advertisement. The client MUST use the same pipe        // advertisement to talk to the service. When the client        // discovers the peergroup advertisement, it will extract the        // pipe advertisement to create the connecting pipe by getting        // the module impl advertisement associated with the RestoPeer        // service.        System.out.println("Extract the pipe advertisement from the Service");        PipeAdvertisement pipeadv = null;        try {            // Extract the pipe adv from the Module impl param section            myAdv = (PipeAdvertisement)                AdvertisementFactory.newAdvertisement((TextElement)                      srvImpl.getParam().getChildren().nextElement());        } catch (Exception e) {            System.out.println("failed to read/parse pipe advertisement");            e.printStackTrace();            System.exit(-1);        }        // Start the RestoPeer service loop thread to respond to Hungry peers        // fries requests. Start a new thread for processing all the        // requests        HandleFriesRequest peerRequest = new HandleFriesRequest();        peerRequest.start();    }    // Called when the service is started    public int startApp (String args[]) {        // nothing to do here        return 0;    }    // Called just before the service is stopped    public void stopApp() {    }    // Thread to handle fries auction requests from HungryPeers.    // The method waits for HungryPeer requests pipe messages to arrive.    // Incoming requests contain a pipe advertisement to respond to the    // HungryPeers requester and a fries size.    // The method generates a bid offer for the request, opens an output    // pipe to the HungryPeer requester and send the response.    private class HandleFriesRequest extends Thread {        InputStream ip = null;               // Input Stream of message        PipeAdvertisement hungryPipe = null; // HungryPeer Requester pipe        StructuredDocument request = null;   // Request document        StructuredDocument bid = null;       // Bid response        MimeMediaType mimeType = new MimeMediaType("text", "xml");        Element el = null;                   // Element in document        String name = null;                  // Name of the sender        String size = null;                  // Fries size Requested        OutputPipe pipeOut = null;           // Output pipe to respond to                                             // HungryPeer requester        public void run() {            // Need to check that the Pipe peergroup service of            // RestoNet is initialized. Peergroup services are loaded            // dynamically. Here we just wait until the pipe service            // is initialized so we can create a new pipe.            try {                while (pipes == null) {                    Thread.sleep(2000);                    pipes = restoNet.getPipeService();                }                // Create the input pipe to receive incoming request                if (!createRestoPipe()) {                    System.out.println(                        "Aborting due to failure to create RestoPeer pipe");                    return;                }            } catch (Exception ex) {                    System.out.println(                           "Exception while creating RestoPeer pipe");                    return;            }            System.out.println("RestoNet Restaurant (" + brand +                           ") waiting for HungryPeer requests");            // Loop waiting for HungryPeer Requests            while (true) {                Message msg = null;          // incoming pipe message                try {                    // Block until a message arrive on the RestoPeer pipe                    msg = pipeIn.waitForMessage();                    // If message is null, discard message                    if (msg == null) {                        if (Thread.interrupted()) {                            // We have been asked to stop                            System.out.println("Abort: RestoPeer interrupted");                            return;                        }                    }                    // We received a message; extract the request                    try {                        // Extract the HungryPipe pipe information                        // to reply to the sender                        ip = msg.getElement("HungryPeerPipe").getStream();                        // Construct the associated pipe advertisement                        // via the AdvertisementFactory                        hungryPipe = (PipeAdvertisement)                        AdvertisementFactory.newAdvertisement(mimeType, ip);                        // Extract the sender name and fries size requested                        // building a StructuredDocument                        ip = msg.getElement("Request").getStream();                        request = StructuredDocumentFactory.                                    newStructuredDocument(mimeType, ip);                        // Extract the fields from the structured Document                        Enumeration enum = request.getChildren();                        // Loop over all the elements of the document                        while (enum.hasMoreElements()) {                            el = (Element) enum.nextElement();                            String attr = (String) el.getKey();                            String value = (String) el.getValue();                            // Extract the HungryPeer Requester Name                            if (attr.equals("Name")) {                                name = value;                                continue;                            }                            // Extract the Fries  size requested                            if (attr.equals("Fries")) {                                size = value;                                continue;                            }                        }                    } catch (Exception e) {                        // Broken Content                        continue;                    }                    System.out.println("Received Request from HungryPeer "                               + name + " for " + size + " Fries.");                    // The auction request is valid. We can                    // create the output pipe to send the response bid to                    // the HungryPeer requester                    try {                        System.out.println(                           "Attempting to create Output Pipe to HungryPeer " +                            name);                        // Create an output pipe connection to the HungryPeer                        // requester                        pipeOut = pipes.createOutputPipe(hungryPipe, rtimeout);                        // Check if we have a pipe                        if (pipeOut == null) {                            // Cannot conect the pipe                            System.out.println(                                "Could not find HungryPeer pipe");                            continue;                        }                    } catch (Exception e) {                        // Pipe creation exception                        System.out.println(                            "HungryPeer may not be listening anymore");                        continue;                    }                    // We have a pipe connection to the HungryPeer. Now                    // create the bid response document                    try {                        bid = StructuredDocumentFactory.newStructuredDocument(                                     mimeType, "RestoNet:Bid");                        // Set the Bid values (Brand, price, special)                        // in the response document                        el = bid.createElement("Brand", brand);                        bid.appendChild(el);                        el = bid.createElement("Price", ""+ friesPrice(size));                        bid.appendChild(el);                        el = bid.createElement("Specials", specials);                        bid.appendChild(el);                        // Create a new pipe message                        msg = pipes.createMessage();                        // Add the Bid offer to the message                        msg.addElement(msg.newMessageElement(                                   "Bid", mimeType, bid.getStream()));                        pipeOut.send(msg);                        pipeOut.close();                    } catch (Exception ex) {                        System.out.println(                            "Error sending bid offer to HungryPeer " + name);                    }                    System.out.println("Sent Bid Offer to HungryPeer ("                        + name  + ") Fries price = "  + friesPrice(size) +                        ", special = " + specials);                } catch (Exception e) {                    System.out.println("Abort RestoPeer interrupted");                    return;                }            }        }    }    // Determine the price of the French fries depending on the size    private String friesPrice(String size) {        if (size.equals("small"))              return "$1.50";        if (size.equals("medium"))              return "2.50";        if (size.equals("large"))              return "3.00";        return "error";    }    // Create the input endpoint    private boolean createRestoPipe() {        try {            // Create my input pipe to listen for hungry peers            // requests            pipeIn = pipes.createInputPipe(myAdv);        } catch (Exception e) {            System.out.println(                "Could not initialize the Restaurant pipe" + e.getMessage());            return false;        }        return true;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品无人区| 久久综合色天天久久综合图片| 久久久九九九九| 99国产精品国产精品久久| 亚洲午夜精品网| www一区二区| 一区二区三区精品视频在线| 色哟哟精品一区| 成人动漫精品一区二区| 99re成人精品视频| 中文字幕一区二区三区不卡在线| 中文字幕一区二区三区四区不卡| 亚洲日本在线观看| 国产精品久久久久久久久免费桃花| 欧美一区二区三区免费| 欧美性受极品xxxx喷水| 91同城在线观看| 成人动漫一区二区三区| 日韩精品在线看片z| 欧美日韩国产免费| 色噜噜狠狠成人中文综合| 91理论电影在线观看| 欧美精品一区二区不卡| 日韩精品午夜视频| 亚洲一区二区黄色| 性做久久久久久免费观看欧美| 午夜视频一区在线观看| 日日噜噜夜夜狠狠视频欧美人 | 国产中文一区二区三区| 亚洲男人电影天堂| 一区二区三区免费在线观看| 国产白丝精品91爽爽久久| 成人一级片网址| 精品视频免费在线| 欧美大胆人体bbbb| 日韩精品91亚洲二区在线观看| 色狠狠色狠狠综合| 亚洲蜜桃精久久久久久久| 91视频免费看| 亚洲综合激情另类小说区| 91国内精品野花午夜精品| 亚洲欧美日韩国产另类专区| 日本乱码高清不卡字幕| 午夜精品福利一区二区三区av | 国产欧美一区二区精品秋霞影院| 日韩视频在线观看一区二区| 欧美韩国一区二区| 精品一二三四在线| 欧美日韩精品一区二区在线播放| 老司机免费视频一区二区三区| 91丨porny丨最新| 另类人妖一区二区av| 亚洲男人天堂一区| 欧美岛国在线观看| 欧美人与禽zozo性伦| 粉嫩av一区二区三区粉嫩 | 亚洲成人你懂的| 精品国产人成亚洲区| 日本成人中文字幕在线视频| 成人精品视频一区二区三区 | 99久久er热在这里只有精品15| 亚洲卡通欧美制服中文| 91社区在线播放| 久久狠狠亚洲综合| 亚洲精品国产成人久久av盗摄| 日韩片之四级片| 日本电影欧美片| 成人免费视频网站在线观看| 久久av老司机精品网站导航| 亚洲综合无码一区二区| 国产精品麻豆久久久| 国产欧美日本一区二区三区| 日韩天堂在线观看| 欧美日韩国产小视频| 色素色在线综合| 在线影视一区二区三区| 91视频观看免费| 欧美视频你懂的| 欧美在线观看视频在线| 亚洲成人福利片| 亚洲成人在线网站| 日韩精品欧美成人高清一区二区| 日韩电影在线免费看| 免费在线观看视频一区| 日韩欧美国产wwwww| 精品粉嫩aⅴ一区二区三区四区 | 爽好久久久欧美精品| 日本不卡1234视频| 国产成人综合自拍| 亚洲欧美日韩在线| 亚洲成人免费视频| 男女视频一区二区| 99在线精品一区二区三区| 久草在线在线精品观看| 国产裸体歌舞团一区二区| 日本欧美一区二区三区| 久久成人免费电影| aaa亚洲精品| 久久综合精品国产一区二区三区| 中文字幕乱码日本亚洲一区二区| 国产精品高潮呻吟久久| 视频精品一区二区| 成人h精品动漫一区二区三区| 26uuu久久综合| 亚洲主播在线播放| 99久久精品国产一区二区三区| 在线播放一区二区三区| 精品婷婷伊人一区三区三| 国产亚洲欧美在线| 中文字幕免费观看一区| 久久成人久久爱| 欧美图区在线视频| 亚洲另类色综合网站| 国产激情一区二区三区四区 | 亚洲天堂a在线| 久久国产日韩欧美精品| 91精品国产麻豆| 午夜伦欧美伦电影理论片| 色综合婷婷久久| 欧美美女一区二区| 午夜精品久久一牛影视| 欧美在线观看视频一区二区| 国产精品久久久久久久久久免费看 | 大桥未久av一区二区三区中文| 欧美在线播放高清精品| 国产精品女同一区二区三区| 国产精品香蕉一区二区三区| 粉嫩一区二区三区性色av| 国产在线播放一区三区四| 一区二区三区精品在线观看| 欧美日韩精品免费观看视频| 欧美亚洲动漫另类| 日韩午夜激情视频| 一区二区免费视频| 国产成人午夜视频| 日韩一级大片在线观看| 亚洲人123区| 国产成人综合精品三级| 欧美裸体一区二区三区| 亚洲一区欧美一区| 久久99日本精品| 欧美三级电影网| 亚洲色图另类专区| 国产乱人伦精品一区二区在线观看| 欧美亚一区二区| 亚洲视频 欧洲视频| 高清在线成人网| 久久婷婷综合激情| 韩国av一区二区三区| 7777精品伊人久久久大香线蕉经典版下载| 色激情天天射综合网| 国产偷国产偷精品高清尤物| 久久97超碰国产精品超碰| 欧美精品 国产精品| 亚洲一二三四久久| 一道本成人在线| 国产精品久久久久婷婷| 床上的激情91.| 中文字幕不卡在线| 国产一区二区日韩精品| 精品国产伦理网| 国产在线播放一区| 2021中文字幕一区亚洲| 精品亚洲成av人在线观看| 欧美变态tickle挠乳网站| 欧美韩国日本一区| 成人美女在线视频| 国产精品久久免费看| 99久久婷婷国产综合精品| 欧美国产精品专区| 99国产精品久久久久久久久久| 国产精品久线在线观看| 波多野结衣视频一区| 中文字幕在线一区| 色综合色狠狠天天综合色| 一区二区三区在线不卡| 日本高清不卡在线观看| 亚洲午夜免费电影| 欧美日韩国产bt| 蜜桃一区二区三区四区| 色婷婷激情综合| 亚洲午夜久久久久久久久电影网| 欧美色综合网站| 免费高清在线视频一区·| 欧美变态口味重另类| 风间由美一区二区av101| 亚洲图片欧美激情| 欧美视频日韩视频| 国产一区二区三区香蕉| 中文字幕欧美激情一区| 91福利视频久久久久| 免费看日韩精品| 国产午夜亚洲精品午夜鲁丝片| 不卡一区二区三区四区| 一区二区三区日韩欧美| 日韩欧美一二三区| 99久久精品久久久久久清纯| 日韩精品91亚洲二区在线观看 | 777亚洲妇女| 韩国av一区二区三区在线观看|