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

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

?? dispatcherjob.java

?? javaP2P技術內幕課程111213141516源代碼
?? JAVA
字號:
/* * Created by IntelliJ IDEA. * User: fsommers * Date: Apr 10, 2002 * Time: 10:00:18 PM * To change template for new class use * Code Style | Class Templates options (Tools | IDE Options). */package primecruncher;import net.jxta.endpoint.Message;import net.jxta.endpoint.MessageElement;import net.jxta.pipe.*;import net.jxta.peergroup.PeerGroup;import net.jxta.protocol.PipeAdvertisement;import net.jxta.protocol.ModuleSpecAdvertisement;import net.jxta.document.*;import net.jxta.id.IDFactory;import java.util.ArrayList;import java.util.HashMap;import java.util.Enumeration;import java.io.PrintWriter;import java.io.IOException;import java.io.InputStream;/** * An instance of this object is created for each client request. This object * does the following: * <ol> * <li>Extract the high, low numbers of the list of primes to be produced. DONE</li> * <li>Divide the list into subtasks, one subtask corresponding to each peer *      specified in the peers array of the constructor. How the work is divided *      is handled by an instance of <code>JobPartitioner</code>, which returns *      an array of <code>StructuredTextDocument</code> s corresponding to a piece of the list *      to be computed by each peer.</li> * <li>Create an input pipe for the results. Add that pipe's advertisement to the *     <code>StructuredTextDocument</code>s produced by <code>JobPartitioner</code>.</li> * <li>For each peer, create a Message that contains the *     <code>StructuredTextDocument</code>. Assign a message ID to each message.</li> * <li>Send that message to the peer, and mark when the message was sent. * <li>When a response arrives via the pipe, mark the message corresponding to that result *     as being answered.</li> * <li>When all messages are answered, sort the sublists to a master list. Create a *     result document, and call the <code>ResultListener</code> with that message.</li> * </ul> * REMIND: What to do if not all the requests are anwered before the timeout? */class DispatcherJob implements Runnable, PipeMsgListener, OutputPipeListener, Comparable  {    private int low = 0;    private int high = 0;    private String jobID;    private PeerInfoBundle peerInfoBundle;    private PendingJob pendingJob;    private int count = 0;    private PeerGroup group;    private static PipeService pService = null;    private InputPipe inPipe = null;    private PipeAdvertisement inPipeAdv = null;    /**     * Start a new job for a compute request.     *     * @param request this document contains the HIGH, LOW, and JobID     * @param peers the working set of peers     * @param listener what to notify when we have all the results in     * @param our current peer group     */    public DispatcherJob(String jobID, int count, int low, int high, PeerInfoBundle peerInfoBundle,                         PendingJob job,                         PeerGroup group) {        this.high = high;        this.low = low;        this.jobID = jobID;        this.count = count;        this.group = group;        this.peerInfoBundle = peerInfoBundle;        this.pendingJob = job;        pService = group.getPipeService();    }    /**     * Create a pipe advert for an input pipe so that the other side can get back to us     * Open an outpipe into each peer, and send that Message     * The peer would then send a message back with the response via the input pipe     * When we get an event from the input pipe, we process it, then call call     * pending job's gotResult     */    public void run() {        System.out.println("Starting dispatcher job execution with low=" + low +                " and high=" + high);        //create input pipe that the other peer will use to send back a result        //add ourselves as a listener on that pipe        inPipeAdv =                (PipeAdvertisement) AdvertisementFactory.newAdvertisement(                        PipeAdvertisement.getAdvertisementType());        final PipeService pService = group.getPipeService();        PipeID pid = IDFactory.newPipeID(group.getPeerGroupID());        inPipeAdv.setPipeID(pid);        try {            inPipe = pService.createInputPipe(inPipeAdv, this);            //open a pipe to the other peer, create a request message,            //add this peer's pipe adv to that message, and send that message            ModuleSpecAdvertisement adv = peerInfoBundle.getModuleSpecAdvertisement();            PipeAdvertisement otherPipe = adv.getPipeAdvertisement();            pService.createOutputPipe(otherPipe, this);        } catch (IOException e) {            System.out.println("An IO Exception occured:" + e.getMessage());            e.printStackTrace();        }        //pendingJob.gotResult(this, result);    }    public void outputPipeEvent(OutputPipeEvent event) {        System.out.println("Connected to other peer's pipe");        try {            Message message = pService.createMessage();            //add the high, low, and the input pipe advert to the message            StructuredTextDocument doc = (StructuredTextDocument)                    inPipeAdv.getDocument(new MimeMediaType("text/xml"));            InputStream is = doc.getStream();            MessageElement advElement = message.newMessageElement(                    ServiceConstants.PIPEADV,                    new MimeMediaType("text/xml"), is);            MessageElement highNum = message.newMessageElement(ServiceConstants.HIGH_INT,                    new MimeMediaType("text/plain"),                    new Integer(high).toString().getBytes());            MessageElement lowNum = message.newMessageElement(ServiceConstants.LOW_INT,                    new MimeMediaType("text/plain"),                    new Integer(low).toString().getBytes());            MessageElement idEl = message.newMessageElement(ServiceConstants.JOBID,                    new MimeMediaType("text/plain"),                    jobID.getBytes());            message.addElement(advElement);            message.addElement(highNum);            message.addElement(lowNum);            message.addElement(idEl);            event.getOutputPipe().send(message);            System.out.println("Sent the message");        } catch (IOException e) {            e.printStackTrace();        }    }    public int compareTo(Object o) {        if (o instanceof DispatcherJob) {            DispatcherJob other = (DispatcherJob)o;            if (count < other.count) return -1;            else if (count > other.count) return 1;        }        return 0;    }    public void pipeMsgEvent(PipeMsgEvent event) {        //here's where we listen for results coming from other peers        System.out.println("Received a message!");        Message mes = event.getMessage();        pendingJob.gotResult(this, new Result(mes));    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆成人久久精品二区三区红| 欧美极品xxx| 日一区二区三区| 91精品国产综合久久香蕉麻豆| 午夜国产精品影院在线观看| 3d动漫精品啪啪| 国产一区 二区 三区一级| 久久久精品欧美丰满| 懂色av中文字幕一区二区三区 | 日韩免费视频一区二区| 久久精品国内一区二区三区| 久久精品亚洲乱码伦伦中文| 成人激情校园春色| 亚洲一级片在线观看| 91麻豆精品国产91久久久久久| 麻豆视频一区二区| 中文字幕成人在线观看| 欧美性xxxxxx少妇| 极品少妇xxxx精品少妇| 中文字幕色av一区二区三区| 欧美色图片你懂的| 狠狠色丁香久久婷婷综| 椎名由奈av一区二区三区| 欧美日韩精品欧美日韩精品一 | 欧美午夜一区二区| 国模一区二区三区白浆| 亚洲女与黑人做爰| 久久亚洲二区三区| 日本黄色一区二区| 国产精品88av| 亚洲国产一区二区三区青草影视| 91精品久久久久久久久99蜜臂| 成人一区二区三区| 日韩av电影天堂| 亚洲男同性视频| 久久久综合激的五月天| 色欧美片视频在线观看| 国产一区二区三区在线看麻豆| 亚洲一区影音先锋| 国产欧美精品在线观看| 欧美一区中文字幕| 色94色欧美sute亚洲线路二| 国产乱码一区二区三区| 午夜欧美电影在线观看| 国产精品久久久久久久浪潮网站 | 91久久一区二区| 国产福利一区二区三区在线视频| 亚洲成av人片一区二区| 亚洲视频狠狠干| 久久久亚洲精品石原莉奈| 欧美电影一区二区| av福利精品导航| 国产在线麻豆精品观看| 五月激情综合色| 夜夜嗨av一区二区三区网页| 中文字幕一区三区| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美二区三区91| 欧美亚洲国产一区二区三区| 91麻豆免费视频| av一区二区三区四区| 国产高清一区日本| 国产在线麻豆精品观看| 日本不卡的三区四区五区| 亚洲二区视频在线| 亚洲男人的天堂在线观看| 国产精品嫩草影院av蜜臀| 337p粉嫩大胆色噜噜噜噜亚洲| 678五月天丁香亚洲综合网| 欧美三日本三级三级在线播放| 色呦呦日韩精品| 91麻豆产精品久久久久久| 成人免费毛片片v| 成人aa视频在线观看| 岛国精品一区二区| 不卡的电视剧免费网站有什么| 国产精品一区免费在线观看| 久久精品国产久精国产爱| 蜜桃视频免费观看一区| 蜜桃91丨九色丨蝌蚪91桃色| 久久av老司机精品网站导航| 捆绑调教美女网站视频一区| 极品少妇xxxx偷拍精品少妇| 国产精品一二三区在线| 国产白丝网站精品污在线入口| 成人网页在线观看| 日本乱码高清不卡字幕| 欧美日韩一区视频| 91精品国产麻豆国产自产在线 | 日产国产欧美视频一区精品| 日韩电影在线观看一区| 另类的小说在线视频另类成人小视频在线 | 欧美午夜精品电影| 欧美日韩一区二区三区视频| 精品视频在线看| 欧美xfplay| 国产免费观看久久| 国产精品乱人伦一区二区| 亚洲激情图片qvod| 日韩在线卡一卡二| 韩日av一区二区| 一本色道久久综合亚洲91| 欧美日韩不卡一区| 精品国产一区二区精华| 国产精品免费人成网站| 一区二区免费看| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产电影精品久久禁18| 在线观看91视频| 精品国产一区二区三区久久影院| 国产女人18水真多18精品一级做| 一区二区三区加勒比av| 日韩在线a电影| 国产.精品.日韩.另类.中文.在线.播放| 99精品一区二区| 88在线观看91蜜桃国自产| 久久无码av三级| 一区二区三区日韩精品| 男女性色大片免费观看一区二区 | 日韩一区欧美二区| 国产美女精品在线| 欧美一二区视频| 国产精品色噜噜| 奇米影视一区二区三区| 北岛玲一区二区三区四区| 欧美日韩一区二区不卡| 国产欧美一区二区在线| 日韩电影在线观看电影| 丁香天五香天堂综合| 欧美日韩高清一区二区三区| 国产精品美女一区二区| 免费成人在线网站| 欧美在线不卡一区| 国产日韩欧美精品电影三级在线| 天天综合天天综合色| av电影在线观看不卡| 精品久久人人做人人爽| 丝袜亚洲精品中文字幕一区| 99精品视频中文字幕| 精品国产在天天线2019| 首页国产丝袜综合| 99久久婷婷国产综合精品电影| 精品国产乱码久久久久久1区2区 | 久久精品欧美一区二区三区麻豆| 一区二区三区在线观看欧美| 国产成人亚洲综合色影视| 91精品国产综合久久福利软件 | 国产suv精品一区二区三区| 欧美肥妇毛茸茸| 亚洲午夜私人影院| 欧美专区日韩专区| 亚洲女子a中天字幕| 99r精品视频| 国产精品乱码人人做人人爱| 国产一区二区不卡在线| 日韩视频在线一区二区| 日韩精品国产欧美| 欧美精品18+| 性做久久久久久久久| 在线视频你懂得一区| 亚洲激情成人在线| 欧美性受xxxx黑人xyx性爽| 亚洲老妇xxxxxx| 色婷婷精品大在线视频| 一区二区三区免费网站| 色婷婷综合久久久中文字幕| 亚洲欧美综合网| 91偷拍与自偷拍精品| 中文字幕一区二区在线观看| av中文字幕不卡| 亚洲精品视频自拍| 色噜噜狠狠色综合欧洲selulu| 亚洲人亚洲人成电影网站色| 91在线码无精品| 一区二区三区日韩在线观看| 欧美日韩一区在线| 免费看日韩精品| 精品国产一区二区三区四区四 | 北岛玲一区二区三区四区| 国产精品美女久久久久av爽李琼| 成人网在线播放| 亚洲黄网站在线观看| 911精品产国品一二三产区| 久久精品国产精品青草| 国产欧美日韩久久| 91丨国产丨九色丨pron| 亚洲女同一区二区| 欧美日本精品一区二区三区| 免费的国产精品| 中文子幕无线码一区tr| 色94色欧美sute亚洲线路一久| 视频在线观看91| 国产亚洲制服色| 色综合一区二区| 亚洲国产视频a| 精品国产乱码久久久久久免费| 成人免费毛片a| 亚洲第一福利一区| 久久午夜老司机| 在线视频中文字幕一区二区|