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

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

?? mpjrun.java

?? MPI for java for Distributed Programming
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
      reader = new BufferedReader(new FileReader( machinesFile ));
    }
    catch (FileNotFoundException fnfe) {
      throw new MPJRuntimeException ( "<"+ machinesFile + "> file cannot "+
                            " be found." +
                            " The starter module assumes "+
                            "it to be in the current directory.");
    }

    boolean loop = true;
    String line = null;
    int machineCount = 0 ; 

    while (machineCount < nprocs) {

      line = reader.readLine();

      if(DEBUG && logger.isDebugEnabled()) {
        logger.debug("line <" + line + ">");
      }

      if(line == null) { 
        break ; 
      }

      if (line.startsWith("#") || line.equals("") ||
          (machineVector.size() == nprocs)) {
        //loop = false;
        continue ;
      }


      machineCount ++ ;

      line = line.trim();

      InetAddress address = InetAddress.getByName(line);
      String addressT = address.getHostAddress();
      String nameT = address.getHostName();

      if(DEBUG && logger.isDebugEnabled()) {
        logger.debug("nameT " + nameT);
        logger.debug("addressT " + addressT);
      } 
     
      boolean alreadyPresent = false;
      
      for(int i=0 ; i<machineVector.size() ; i++) {

        String machine = (String) machineVector.get(i); 

        if(machine.equals(nameT) || machine.equals(addressT)) {  
           alreadyPresent = true;
           break ;
        }

      }

      if(!alreadyPresent) { 

        //if( addressT or nameT already present, then you are buggered ) {
        //}
      
        /* What is the solution for this? */
        //machineVector.add(addressT);
        machineVector.add(nameT);

        if(DEBUG && logger.isDebugEnabled()) {
          logger.debug("Line " + line.trim() +
                    " added to vector " + machineVector);
        }

      }

    }//end while.
  
  }

  private void clientSocketInit() throws Exception {
      	  
    SocketChannel[] clientChannels = new SocketChannel[machineVector.size()];
    for (int i = 0; i < machineVector.size(); i++) {
      boolean connected = false ; 	    
      String daemon = (String) machineVector.get(i);
      try {
        clientChannels[i] = SocketChannel.open();
        clientChannels[i].configureBlocking(true);
        logger.debug("Connecting to " + daemon + "@" + D_SER_PORT);
        connected = clientChannels[i].connect(
			new InetSocketAddress(daemon, D_SER_PORT));

	if(!connected) {
	  System.out.println(" home-made ...");

          if(System.getProperty("os.name").startsWith("Windows")) {   
            CONF_FILE.delete() ;
          }

          throw new MPJRuntimeException("Cannot connect to the daemon "+
			  "at machine <"+daemon+"> and port <"+
			  D_SER_PORT+">."+
			  "Please make sure that the machine is reachable "+
			  "and running the daemon in 'sane' state"); 
	}

	doConnect(clientChannels[i]); 
      }
      catch(IOException ioe) {
        if(System.getProperty("os.name").startsWith("Windows")) {   
          CONF_FILE.delete() ;
        }

	System.out.println(" IOException in doConnect");
        throw new MPJRuntimeException("Cannot connect to the daemon "+
			"at machine <"+daemon+"> and port <"+
			D_SER_PORT+">."+
			"Please make sure that the machine is reachable "+
			"and running the daemon in 'sane' state"); 
      }
      catch (Exception ccn1) {
	  System.out.println(" rest of the exceptions ");
        throw ccn1;
      }
    }
  }

  /**
   * This method cleans up the device environments, closes the selectors, serverSocket, and all the other socketChannels
   */
  public void finish() {
    logger.debug("\n---finish---");

    try {
      cfos.close();
      
      if(server != null) {
        server.stop();
        server.destroy();
      }
      
      if(mpjServer != null) {
        mpjServer.stop();
        mpjServer.destroy();
      }

      logger.debug("Waking up the selector");
      selector.wakeup();
      selectorFlag = false;
      logger.debug("Closing the selector");
      selector.close();

      SocketChannel peerChannel = null;

      for (int i = 0; i < peerChannels.size(); i++) {
        peerChannel = peerChannels.get(i);
        logger.debug("Closing the channel " + peerChannel);

        if (peerChannel.isOpen()) {
          peerChannel.close();
        }


      }

      peerChannel = null;
    }
    catch (Exception e) {
      //e.printStackTrace();
    }
  }

  private void doConnect(SocketChannel peerChannel) {
    logger.debug("---doConnect---");
    try {
      logger.debug("Configuring it to be non-blocking");
      peerChannel.configureBlocking(false);
    }
    catch (IOException ioe) {
      logger.debug("Closed Channel Exception in doConnect");
      System.exit(0);
    }

    try {
      logger.debug("Registering for OP_READ & OP_WRITE event");
      peerChannel.register(selector,
                           SelectionKey.OP_READ | SelectionKey.OP_WRITE);
    }
    catch (ClosedChannelException cce) {
      logger.debug("Closed Channel Exception in doConnect");
      System.exit(0);
    }

    try {
      peerChannel.socket().setTcpNoDelay(true);
    }
    catch (Exception e) {}
    peerChannels.add(peerChannel);
    logger.debug("Adding the channel " + peerChannel + " to " + peerChannels);
    logger.debug("Size of Peer Channels vector " + peerChannels.size());
    peerChannel = null;
    if (peerChannels.size() == machineVector.size()) {
      Notify();
    }
  }
  
  /**
   * Entry point to the class 
   */
  public static void main(String args[]) throws Exception {

    try {
      MPJRun client = new MPJRun(args);
    }
    catch (Exception e) {
      throw e;
    }

  }

  private void addShutdownHook() {
    Runtime.getRuntime().addShutdownHook(new Thread() {
      public void run() {
        try {
          for (int j = 0; j < peerChannels.size(); j++) {
            SocketChannel socketChannel = null;
            socketChannel = peerChannels.get(j);
            buffer.clear();
            buffer.put( (new String("kill")).getBytes());
            buffer.flip();
            socketChannel.write(buffer);
            buffer.clear();
          }

          if(server != null) {
            server.stop();
            server.destroy();
	  }

          if(mpjServer != null) {
            mpjServer.stop();
            mpjServer.destroy();
          }
	  
          cfos.close();
        }
        catch(Exception e){
        }
      }
    });
  }

  Runnable selectorThread = new Runnable() {

    /* This is selector thread */
    public void run() {
      logger.debug("selector Thread started ");
      Set readyKeys = null;
      Iterator readyItor = null;
      SelectionKey key = null;
      SelectableChannel keyChannel = null;
      SocketChannel socketChannel = null;
      ByteBuffer lilBuffer = ByteBuffer.allocateDirect(4);
      ByteBuffer bigBuffer = ByteBuffer.allocateDirect(10000);

      try {
        while (selector.select() > -1 && selectorFlag == true) {

          readyKeys = selector.selectedKeys();
          readyItor = readyKeys.iterator();

          while (readyItor.hasNext()) {

            key = (SelectionKey) readyItor.next();
            readyItor.remove();
            keyChannel = (SelectableChannel) key.channel();
            logger.debug("\n---selector EVENT---");

            if (key.isAcceptable()) {
              //doAccept(keyChannel);
              logger.debug("ACCEPT_EVENT");
            }

            else if (key.isConnectable()) {

              logger.debug("CONNECT_EVENT");
              try {
                socketChannel = (SocketChannel) keyChannel;
              }
              catch (NoConnectionPendingException e) {
                continue;
              }

              if (socketChannel.isConnectionPending()) {
                try {
                  socketChannel.finishConnect();
                }
                catch (IOException e) {
                  continue;
                }
              }

              doConnect(socketChannel);
            }

            else if (key.isReadable()) { 
 
              //logger.debug("READ_EVENT");
              socketChannel = (SocketChannel) keyChannel;
              int read = socketChannel.read(bigBuffer);  

              /* 
               * It would be ideal if this piece of code is called ...
               * but it appears ..its never callled ..maybe the behaviour
               * of closing down that we saw was Linux dependant ????
               */ 

              if (read == -1) {
                logger.debug("END_OF_STREAM signal at starter from "+
                             "channel "+socketChannel) ;  
                streamEndedCount ++ ;  

                if (streamEndedCount == machineVector.size()) {
                  logger.debug("The starter has received "+ 
                               machineVector.size() +"signals"); 
                  logger.debug("This means its time to exit"); 
                  Notify();
                }
                
              } 

              bigBuffer.flip();

              if(read == -1) { 
                System.exit(0);  
              }

              byte[] tempArray = new byte[read];
              //logger.debug("bigBuffer " + bigBuffer);
              bigBuffer.get(tempArray, 0, read);
              String line = new String(tempArray);
              bigBuffer.clear();
              //RECEIVED
              //logger.debug("line <" + line + ">");

              System.out.print(line);
              //logger.debug("Does it endup with EXIT ? ==>" +
              //            line.endsWith("EXIT"));

              if (line.endsWith("EXIT")) {
                endCount++;
                logger.debug("endCount " + endCount);
                logger.debug("machineVector.size() " + machineVector.size());

                if (endCount == machineVector.size()) {
                  logger.debug("Notify and exit"); 
                  Notify();
                }
              }

            } //end if key.isReadable()

            else if (key.isWritable()) {
              logger.debug(
                  "In, WRITABLE, so changing the interestOps to READ_ONLY");
              key.interestOps(SelectionKey.OP_READ);
            }
          }
        }
      }
      catch (Exception ioe1) {
        logger.debug("Exception in selector thread ");
        ioe1.printStackTrace();
        System.exit(0);
      }
      logger.debug("Thread getting out");
    }
  };
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品成人午夜| 国产午夜精品久久| 91丨porny丨最新| 国产精品18久久久久| 韩国成人在线视频| 激情六月婷婷综合| 国产91对白在线观看九色| 精品午夜久久福利影院| 韩国v欧美v亚洲v日本v| 国产一区二区在线观看视频| 国产乱国产乱300精品| 国产精品一区二区在线观看不卡| 国产综合色产在线精品| 成人性视频网站| 91视频观看免费| 4438x成人网最大色成网站| 日韩精品一区二区三区四区| 精品久久国产字幕高潮| 国产女同性恋一区二区| 成人欧美一区二区三区小说| 亚洲最快最全在线视频| 午夜视频久久久久久| 久久99国产精品免费网站| 国产a精品视频| 色综合久久综合网97色综合| 欧美精品一级二级三级| 久久一日本道色综合| 亚洲色图一区二区三区| 日韩在线a电影| 国产91丝袜在线播放九色| 91老师片黄在线观看| 欧美一区二区三区男人的天堂| 久久久亚洲精华液精华液精华液 | 夜色激情一区二区| 男人的天堂久久精品| 成人精品高清在线| 欧美午夜精品理论片a级按摩| 精品国产免费人成在线观看| 国产精品久久久久久久久免费樱桃| 偷拍与自拍一区| 成人手机电影网| 日韩视频一区二区三区 | 日本韩国欧美在线| 日韩美女视频在线| 亚洲在线视频网站| 成人午夜免费视频| 欧美大肚乱孕交hd孕妇| 亚洲一区在线观看网站| 成人美女视频在线看| 日韩一区二区电影| 亚洲一区二区三区视频在线| 国产成人三级在线观看| 91精品国产色综合久久ai换脸| 中文字幕在线观看不卡| 国内精品伊人久久久久av影院| 欧美手机在线视频| 亚洲人妖av一区二区| 国产在线不卡视频| 日韩美一区二区三区| 婷婷中文字幕一区三区| 色诱视频网站一区| 综合久久国产九一剧情麻豆| 精品一区二区免费视频| 欧美一区二区在线不卡| 亚洲国产成人porn| 欧美视频中文字幕| 日韩伦理免费电影| 成人高清视频在线观看| 久久精品一区二区三区不卡 | 国产成人免费xxxxxxxx| 精品区一区二区| 老司机精品视频一区二区三区| 欧美电影在哪看比较好| 一区二区不卡在线视频 午夜欧美不卡在| 成人夜色视频网站在线观看| 国产日韩v精品一区二区| 精品一区二区三区久久| 久久婷婷综合激情| 激情小说欧美图片| 欧美精品一区二区三区久久久| 久久精品国产网站| 久久日韩精品一区二区五区| 久久精品免费看| 2023国产精品自拍| 国产aⅴ精品一区二区三区色成熟| 精品久久人人做人人爰| 狠狠色丁香婷婷综合久久片| 久久久不卡网国产精品二区| 国产毛片一区二区| 国产精品嫩草久久久久| 91婷婷韩国欧美一区二区| 一区二区欧美在线观看| 欧美猛男gaygay网站| 日韩av不卡一区二区| 精品国产免费久久| 国产suv一区二区三区88区| 中文字幕在线不卡| 国产乱码精品一区二区三区忘忧草 | 欧美日韩精品一区二区三区| 欧美午夜影院一区| 色综合久久99| 免费成人av资源网| 久久精品亚洲麻豆av一区二区| 91免费版pro下载短视频| 国产精品麻豆久久久| 亚洲美女视频在线| 亚洲永久精品国产| 国产成人午夜精品影院观看视频| 欧美日韩国产综合草草| 久久久高清一区二区三区| 国产精品久久久久aaaa| 午夜成人免费视频| 色综合天天天天做夜夜夜夜做| 欧美一区二区三区公司| 一区二区三区中文在线| 色系网站成人免费| 亚洲一区欧美一区| 欧美群妇大交群中文字幕| 综合久久给合久久狠狠狠97色| 国产做a爰片久久毛片| 欧美xxxxx牲另类人与| 五月婷婷另类国产| 日韩亚洲欧美一区二区三区| 亚洲制服丝袜av| 91精品国产综合久久精品性色| 精品在线播放免费| 亚洲色图.com| 久久中文娱乐网| 欧美色图免费看| 国产专区欧美精品| 精品999久久久| 99视频一区二区| 蜜臀99久久精品久久久久久软件| 国产人成亚洲第一网站在线播放| 欧美视频一区二区在线观看| 麻豆精品视频在线观看免费| 亚洲精品久久7777| 久久精品一区蜜桃臀影院| 97久久超碰精品国产| 精品亚洲aⅴ乱码一区二区三区| 欧美经典一区二区| 欧美日韩高清在线播放| 一本色道久久综合亚洲aⅴ蜜桃| 久久疯狂做爰流白浆xx| 全国精品久久少妇| 一区二区三区欧美日| 久久这里只精品最新地址| 欧美主播一区二区三区| 99精品久久只有精品| 国产精品综合网| 不卡一区中文字幕| 96av麻豆蜜桃一区二区| 国内精品国产成人国产三级粉色| 一区二区三区四区不卡在线 | 精品三级在线看| 欧美精品乱码久久久久久 | 久久精品视频在线免费观看| 欧美日本一区二区三区四区| 这里只有精品电影| 欧美午夜在线观看| 精品乱人伦小说| 欧美zozo另类异族| www日韩大片| 中文字幕免费一区| 亚洲色图清纯唯美| 日韩精品视频网站| 成人美女视频在线观看| 欧美精品精品一区| 久久久久久免费毛片精品| 国产精品人人做人人爽人人添| 中文字幕在线不卡一区| 亚洲午夜私人影院| 久久精品国产成人一区二区三区| 国产91丝袜在线播放| 欧美午夜不卡在线观看免费| 久久综合色之久久综合| 亚洲综合av网| eeuss鲁片一区二区三区在线看| 在线看日韩精品电影| 精品国产一区二区在线观看| 五月天欧美精品| 在线观看91av| 日韩成人精品在线观看| av亚洲产国偷v产偷v自拍| 精品国产凹凸成av人网站| 亚洲最大成人综合| 91天堂素人约啪| 中文字幕av一区二区三区高| 午夜精品一区二区三区免费视频| 色系网站成人免费| 亚洲欧美区自拍先锋| 成人三级在线视频| 国产精品乱子久久久久| 色婷婷激情久久| 亚洲一区二区三区在线播放| 欧美性xxxxx极品少妇| 亚洲国产成人porn| 日韩午夜电影在线观看| 奇米影视7777精品一区二区| 国产午夜精品福利|