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

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

?? server.java

?? Hadoop是一個(gè)用于運(yùn)行應(yīng)用程序在大型集群的廉價(jià)硬件設(shè)備上的框架。Hadoop為應(yīng)用程序透明的提供了一組穩(wěn)定/可靠的接口和數(shù)據(jù)運(yùn)動(dòng)。在 Hadoop中實(shí)現(xiàn)了Google的MapReduce算法
?? JAVA
字號(hào):
/** * Copyright 2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.hadoop.ipc;import java.io.IOException;import java.io.EOFException;import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.StringWriter;import java.io.PrintWriter;import java.net.Socket;import java.net.ServerSocket;import java.net.SocketException;import java.net.SocketTimeoutException;import java.util.LinkedList;import java.util.logging.Logger;import java.util.logging.Level;import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configurable;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.io.Writable;import org.apache.hadoop.io.UTF8;/** An abstract IPC service.  IPC calls take a single {@link Writable} as a * parameter, and return a {@link Writable} as their value.  A service runs on * a port and is defined by a parameter class and a value class. *  * @author Doug Cutting * @see Client */public abstract class Server {  public static final Logger LOG =    LogFormatter.getLogger("org.apache.hadoop.ipc.Server");  private static final ThreadLocal SERVER = new ThreadLocal();  /** Returns the server instance called under or null.  May be called under   * {@link #call(Writable)} implementations, and under {@link Writable}   * methods of paramters and return values.  Permits applications to access   * the server context.*/  public static Server get() {    return (Server)SERVER.get();  }  private int port;                               // port we listen on  private int handlerCount;                       // number of handler threads  private int maxQueuedCalls;                     // max number of queued calls  private Class paramClass;                       // class of call parameters  private Configuration conf;  private int timeout;  private boolean running = true;                 // true while server runs  private LinkedList callQueue = new LinkedList(); // queued calls  private Object callDequeued = new Object();     // used by wait/notify  /** A call queued for handling. */  private static class Call {    private int id;                               // the client's call id    private Writable param;                       // the parameter passed    private Connection connection;                // connection to client    public Call(int id, Writable param, Connection connection) {      this.id = id;      this.param = param;      this.connection = connection;    }  }  /** Listens on the socket, starting new connection threads. */  private class Listener extends Thread {    private ServerSocket socket;    public Listener() throws IOException {      this.socket = new ServerSocket(port);      socket.setSoTimeout(timeout);      this.setDaemon(true);      this.setName("Server listener on port " + port);    }    public void run() {      LOG.info(getName() + ": starting");      while (running) {        try {          new Connection(socket.accept()).start(); // start a new connection        } catch (SocketTimeoutException e) {      // ignore timeouts        } catch (Exception e) {                   // log all other exceptions          LOG.log(Level.INFO, getName() + " caught: " + e, e);        }      }      try {        socket.close();      } catch (IOException e) {        LOG.info(getName() + ": e=" + e);      }      LOG.info(getName() + ": exiting");    }  }  /** Reads calls from a connection and queues them for handling. */  private class Connection extends Thread {    private Socket socket;    private DataInputStream in;    private DataOutputStream out;    public Connection(Socket socket) throws IOException {      this.socket = socket;      socket.setSoTimeout(timeout);      this.in = new DataInputStream        (new BufferedInputStream(socket.getInputStream()));      this.out = new DataOutputStream        (new BufferedOutputStream(socket.getOutputStream()));      this.setDaemon(true);      this.setName("Server connection on port " + port + " from "                   + socket.getInetAddress().getHostAddress());    }    public void run() {      LOG.info(getName() + ": starting");      SERVER.set(Server.this);      try {        while (running) {          int id;          try {            id = in.readInt();                    // try to read an id          } catch (SocketTimeoutException e) {            continue;          }                  if (LOG.isLoggable(Level.FINE))            LOG.fine(getName() + " got #" + id);                  Writable param = makeParam();           // read param          param.readFields(in);                          Call call = new Call(id, param, this);                  synchronized (callQueue) {            callQueue.addLast(call);              // queue the call            callQueue.notify();                   // wake up a waiting handler          }                  while (running && callQueue.size() >= maxQueuedCalls) {            synchronized (callDequeued) {         // queue is full              callDequeued.wait(timeout);         // wait for a dequeue            }          }        }      } catch (EOFException eof) {          // This is what happens on linux when the other side shuts down      } catch (SocketException eof) {          // This is what happens on Win32 when the other side shuts down      } catch (Exception e) {        LOG.log(Level.INFO, getName() + " caught: " + e, e);      } finally {        try {          socket.close();        } catch (IOException e) {}        LOG.info(getName() + ": exiting");      }    }  }  /** Handles queued calls . */  private class Handler extends Thread {    public Handler(int instanceNumber) {      this.setDaemon(true);      this.setName("Server handler "+ instanceNumber + " on " + port);    }    public void run() {      LOG.info(getName() + ": starting");      SERVER.set(Server.this);      while (running) {        try {          Call call;          synchronized (callQueue) {            while (running && callQueue.size()==0) { // wait for a call              callQueue.wait(timeout);            }            if (!running) break;            call = (Call)callQueue.removeFirst(); // pop the queue          }          synchronized (callDequeued) {           // tell others we've dequeued            callDequeued.notify();          }          if (LOG.isLoggable(Level.FINE))            LOG.fine(getName() + ": has #" + call.id + " from " +                     call.connection.socket.getInetAddress().getHostAddress());                    String error = null;          Writable value = null;          try {            value = call(call.param);             // make the call          } catch (IOException e) {            LOG.log(Level.INFO, getName() + " call error: " + e, e);            error = getStackTrace(e);          } catch (Exception e) {            LOG.log(Level.INFO, getName() + " call error: " + e, e);            error = getStackTrace(e);          }                      DataOutputStream out = call.connection.out;          synchronized (out) {            out.writeInt(call.id);                // write call id            out.writeBoolean(error!=null);        // write error flag            if (error != null)              value = new UTF8(error);            value.write(out);                     // write value            out.flush();          }        } catch (Exception e) {          LOG.log(Level.INFO, getName() + " caught: " + e, e);        }      }      LOG.info(getName() + ": exiting");    }    private String getStackTrace(Throwable throwable) {      StringWriter stringWriter = new StringWriter();      PrintWriter printWriter = new PrintWriter(stringWriter);      throwable.printStackTrace(printWriter);      printWriter.flush();      return stringWriter.toString();    }  }    /** Constructs a server listening on the named port.  Parameters passed must   * be of the named class.  The <code>handlerCount</handlerCount> determines   * the number of handler threads that will be used to process calls.   */  protected Server(int port, Class paramClass, int handlerCount, Configuration conf) {    this.conf = conf;    this.port = port;    this.paramClass = paramClass;    this.handlerCount = handlerCount;    this.maxQueuedCalls = handlerCount;    this.timeout = conf.getInt("ipc.client.timeout",10000);   }  /** Sets the timeout used for network i/o. */  public void setTimeout(int timeout) { this.timeout = timeout; }  /** Starts the service.  Must be called before any calls will be handled. */  public synchronized void start() throws IOException {    Listener listener = new Listener();    listener.start();        for (int i = 0; i < handlerCount; i++) {      Handler handler = new Handler(i);      handler.start();    }  }  /** Stops the service.  No new calls will be handled after this is called.  All   * subthreads will likely be finished after this returns.   */  public synchronized void stop() {    LOG.info("Stopping server on " + port);    running = false;    try {      Thread.sleep(timeout);     //  inexactly wait for pending requests to finish    } catch (InterruptedException e) {}    notifyAll();  }  /** Wait for the server to be stopped.   * Does not wait for all subthreads to finish.   *  See {@link #stop()}.   */  public synchronized void join() throws InterruptedException {    while (running) {      wait();    }  }  /** Called for each call. */  public abstract Writable call(Writable param) throws IOException;    private Writable makeParam() {    Writable param;                               // construct param    try {      param = (Writable)paramClass.newInstance();      if (param instanceof Configurable) {        ((Configurable)param).setConf(conf);      }    } catch (InstantiationException e) {      throw new RuntimeException(e.toString());    } catch (IllegalAccessException e) {      throw new RuntimeException(e.toString());    }    return param;  }}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费看| 日本一不卡视频| 在线综合亚洲欧美在线视频| 国产精品一区二区三区乱码| 亚洲高清久久久| 国产精品免费丝袜| 日韩美女天天操| 日本韩国欧美在线| 久久免费电影网| 777奇米四色成人影色区| 成人黄色综合网站| 久久狠狠亚洲综合| 亚洲超碰97人人做人人爱| 国产欧美一区二区精品久导航| 欧美日韩成人综合在线一区二区| www.亚洲国产| 国产91丝袜在线播放0| 日韩电影一区二区三区| 亚洲精品一二三| 国产精品久久久久影院色老大| 久久综合狠狠综合| 欧美肥妇free| 欧美特级限制片免费在线观看| 北条麻妃一区二区三区| 国产成人在线视频网址| 九九视频精品免费| 奇米影视一区二区三区| 亚洲va欧美va人人爽午夜| 国产精品美女一区二区三区| xfplay精品久久| 精品欧美黑人一区二区三区| 日韩一区二区免费在线观看| 欧美日韩成人综合在线一区二区| 91精彩视频在线| 91福利在线观看| 色美美综合视频| 一本到不卡精品视频在线观看| youjizz国产精品| 成人av中文字幕| www.欧美日韩| 日本高清不卡一区| 欧美三级中文字幕| 欧美精品高清视频| 欧美一区二区三区免费| 正在播放一区二区| 欧美一二区视频| 日韩亚洲欧美高清| 久久男人中文字幕资源站| 国产网站一区二区| 国产精品毛片a∨一区二区三区| 国产精品美女久久久久高潮| 综合欧美亚洲日本| 亚洲电影中文字幕在线观看| 亚洲成av人片观看| 蜜臀av性久久久久蜜臀av麻豆| 另类小说综合欧美亚洲| 国产一区二区三区久久悠悠色av| 国产精品一区二区你懂的| 成人国产免费视频| 在线观看91精品国产入口| 91精品一区二区三区在线观看| 日韩精品资源二区在线| 久久综合久久久久88| 中文字幕中文字幕中文字幕亚洲无线| 18成人在线观看| 亚洲国产成人av好男人在线观看| 蜜桃av一区二区在线观看| 国产一区二区女| 91在线观看美女| 欧美群妇大交群中文字幕| 精品国产sm最大网站| 中文字幕一区二区三区乱码在线| 亚洲一二三四在线| 狠狠色综合色综合网络| 成人18精品视频| 欧美日韩国产123区| 国产色产综合色产在线视频| 亚洲精品视频免费观看| 看片的网站亚洲| 播五月开心婷婷综合| 在线观看一区不卡| 国产亚洲精品超碰| 亚洲国产日韩a在线播放性色| 久久精品免费观看| 日本久久一区二区三区| 26uuu精品一区二区| 亚洲精品午夜久久久| 狠狠色丁香婷婷综合久久片| 99久久国产综合精品色伊| 日韩视频一区二区三区在线播放| 中文字幕一区二区三区四区不卡| 免费人成在线不卡| 99国产精品久久久久| 精品乱码亚洲一区二区不卡| 一区二区三区国产精品| 国产成人av一区二区三区在线观看| 在线观看日韩av先锋影音电影院| 久久综合九色综合欧美就去吻| 亚洲永久免费av| 国产.欧美.日韩| 欧美一卡二卡在线| 有坂深雪av一区二区精品| 国产精品2024| 欧美va亚洲va香蕉在线| 亚洲成人av在线电影| www.亚洲在线| 久久精品在线观看| 精品一区二区三区日韩| 欧美日本乱大交xxxxx| 亚洲免费av网站| 懂色av中文一区二区三区| 欧美一区二区三区在线观看 | 国产欧美一区二区三区沐欲| 亚瑟在线精品视频| 欧美在线播放高清精品| 一区在线观看免费| 国产69精品久久777的优势| 日韩欧美电影一二三| 一区av在线播放| 一本大道久久精品懂色aⅴ | 中文一区在线播放| 麻豆成人91精品二区三区| 欧美乱妇23p| 亚洲综合成人在线| 色狠狠av一区二区三区| 中文字幕在线观看不卡| 国产 欧美在线| 国产精品私人自拍| 成人h动漫精品| 亚洲欧洲一区二区在线播放| 成人免费毛片嘿嘿连载视频| 久久精品一区四区| 国产精品乡下勾搭老头1| 久久久久国产精品人| 国产一二三精品| 久久久国产精华| 风间由美一区二区三区在线观看 | 中文字幕高清一区| 国产91精品一区二区麻豆亚洲| 久久噜噜亚洲综合| 国产成人精品免费看| 欧美激情在线一区二区| 成人看片黄a免费看在线| 国产精品福利av| 在线精品视频一区二区三四| 亚洲国产wwwccc36天堂| 制服丝袜中文字幕亚洲| 免费高清不卡av| 久久网这里都是精品| 成人自拍视频在线观看| 中文字幕一区二区三区精华液| 一本大道久久a久久精品综合| 亚洲一区二区影院| 日韩午夜激情电影| 国产乱子轮精品视频| 亚洲欧美综合色| 欧美午夜不卡视频| 久久电影网站中文字幕| 欧美激情在线看| 在线观看亚洲一区| 免费久久精品视频| 国产精品区一区二区三| 日本久久电影网| 久久99精品国产91久久来源| 国产欧美日韩在线看| 日本高清不卡一区| 久久机这里只有精品| 综合欧美亚洲日本| 91精品蜜臀在线一区尤物| 国产乱国产乱300精品| 亚洲日本va午夜在线电影| 欧美精品vⅰdeose4hd| 国产一区二区在线观看视频| 一区在线观看视频| 日韩欧美在线一区二区三区| 春色校园综合激情亚洲| 亚洲午夜在线观看视频在线| 精品国产一区二区精华| aaa亚洲精品| 强制捆绑调教一区二区| 国产精品午夜电影| 欧美一区二区三区婷婷月色| 国产福利视频一区二区三区| 亚洲一二三四在线观看| 久久精品欧美一区二区三区不卡 | 中文字幕在线视频一区| 欧美日韩国产首页在线观看| 国产一区二区导航在线播放| 亚洲国产日韩a在线播放性色| 国产网红主播福利一区二区| 欧美日韩中文精品| 国产成人亚洲综合a∨婷婷 | 中文字幕欧美一区| 日韩一级完整毛片| 在线免费观看视频一区| 成人在线综合网| 久久精品国产第一区二区三区| 亚洲综合视频在线观看| 国产精品三级在线观看| 日韩一区二区在线观看视频|