Examples of Sleeper


Examples of net.grinder.util.Sleeper

    m_testRegistryImplementation.setInstrumenter(instrumenter);

    final Logger externalLogger = new ExternalLogger(LOGGER, m_threadContexts);

    Sleeper m_sleeper = new SleeperImplementation(m_times.getTimeAuthority(), externalLogger, 1.0d, 0.2d);

    final Statistics scriptStatistics = new ScriptStatisticsImplementation(m_threadContexts, m_statisticsServices,
        new NullSender());

    final InternalScriptContext scriptContext = new ScriptContextImplementation(new SimpleWorkerIdentity(
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    this.numRetries = conf.getInt("hbase.client.retries.number", 10);
    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
      10 * 1000);
    this.msgInterval = conf.getInt("hbase.regionserver.msginterval", 3 * 1000);

    this.sleeper = new Sleeper(this.msgInterval, this);

    this.maxScannerResultSize = conf.getLong(
      HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE);

View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    this.connection = ServerConnectionManager.getConnection(conf);

    this.metaRescanInterval =
      conf.getInt("hbase.master.meta.thread.rescanfrequency", 60 * 1000);

    this.sleeper = new Sleeper(this.threadWakeFrequency, this.closed);
   
    zooKeeperWrapper = new ZooKeeperWrapper(conf, this);
    zkMasterAddressWatcher = new ZKMasterAddressWatcher(this);
    serverManager = new ServerManager(this);
    regionManager = new RegionManager(this);
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    this.numRetries = conf.getInt("hbase.client.retries.number", 10);
    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
      10 * 1000);
    this.msgInterval = conf.getInt("hbase.regionserver.msginterval", 3 * 1000);

    this.sleeper = new Sleeper(this.msgInterval, this);

    this.maxScannerResultSize = conf.getLong(
      HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE);

View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

   * @param stopper When {@link Stoppable#isStopped()} is true, this thread will
   * cleanup and exit cleanly.
   */
  public Chore(String name, final int p, final Stoppable stopper) {
    super(name);
    this.sleeper = new Sleeper(p, stopper);
    this.stopper = stopper;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

      sai.add(new BlockingServiceAndInterface(service,
        AuthenticationProtos.AuthenticationService.BlockingInterface.class));
      this.rpcServer =
        new RpcServer(this, "tokenServer", sai, initialIsa, 3, 1, conf, HConstants.QOS_THRESHOLD);
      this.isa = this.rpcServer.getListenerAddress();
      this.sleeper = new Sleeper(1000, this);
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    this.numRetries = this.conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
        HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000);
    this.msgInterval = conf.getInt("hbase.regionserver.msginterval", 3 * 1000);

    this.sleeper = new Sleeper(this.msgInterval, this);

    this.maxScannerResultSize = conf.getLong(
      HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE);

View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

   * load/unload instructions.
   */
  public void run() {
    boolean quiesceRequested = false;
    // A sleeper that sleeps for msgInterval.
    Sleeper sleeper =
      new Sleeper(this.msgInterval, this.stopRequested);
    try {
      init(reportForDuty(sleeper));
      long lastMsg = 0;
      // Now ask master what it wants us to do and tell it what we have done
      for (int tries = 0; !stopRequested.get();) {
        long now = System.currentTimeMillis();
        if (lastMsg != 0 && (now - lastMsg) >= serverLeaseTimeout) {
          // It has been way too long since we last reported to the master.
          // Commit suicide.
          LOG.fatal("unable to report to master for " + (now - lastMsg) +
            " milliseconds - aborting server");
          abort();
          break;
        }
        if ((now - lastMsg) >= msgInterval) {
          HMsg outboundArray[] = null;
          synchronized(this.outboundMsgs) {
            outboundArray =
              this.outboundMsgs.toArray(new HMsg[outboundMsgs.size()]);
            this.outboundMsgs.clear();
          }

          try {
            this.serverInfo.setLoad(new HServerLoad(requestCount.get(),
                onlineRegions.size()));
            this.requestCount.set(0);
            HMsg msgs[] =
              this.hbaseMaster.regionServerReport(serverInfo, outboundArray);
            lastMsg = System.currentTimeMillis();

            if (this.quiesced.get() && onlineRegions.size() == 0) {
              // We've just told the master we're exiting because we aren't
              // serving any regions. So set the stop bit and exit.
              LOG.info("Server quiesced and not serving any regions. " +
              "Starting shutdown");
              stopRequested.set(true);
              continue;
            }

            // Queue up the HMaster's instruction stream for processing
            boolean restart = false;
            for(int i = 0; i < msgs.length && !stopRequested.get() &&
                !restart; i++) {
              switch(msgs[i].getMsg()) {

              case HMsg.MSG_CALL_SERVER_STARTUP:
                LOG.info("Got call server startup message");
                // We the MSG_CALL_SERVER_STARTUP on startup but we can also
                // get it when the master is panicing because for instance
                // the HDFS has been yanked out from under it.  Be wary of
                // this message.
                if (checkFileSystem()) {
                  closeAllRegions();
                  synchronized (logRollerLock) {
                    try {
                      log.closeAndDelete();
                    } catch (Exception e) {
                      LOG.error("error closing and deleting HLog", e);
                    }
                    try {
                      serverInfo.setStartCode(System.currentTimeMillis());
                      log = setupHLog();
                    } catch (IOException e) {
                      this.abortRequested = true;
                      this.stopRequested.set(true);
                      e = RemoteExceptionHandler.checkIOException(e);
                      LOG.fatal("error restarting server", e);
                      break;
                    }
                  }
                  reportForDuty(sleeper);
                  restart = true;
                } else {
                  LOG.fatal("file system available check failed. " +
                  "Shutting down server.");
                }
                break;

              case HMsg.MSG_REGIONSERVER_STOP:
                LOG.info("Got regionserver stop message");
                stopRequested.set(true);
                break;

              case HMsg.MSG_REGIONSERVER_QUIESCE:
                if (!quiesceRequested) {
                  LOG.info("Got quiesce server message");
                  try {
                    toDo.put(new ToDoEntry(msgs[i]));
                  } catch (InterruptedException e) {
                    throw new RuntimeException("Putting into msgQueue was " +
                        "interrupted.", e);
                  }
                  quiesceRequested = true;
                }
                break;

              default:
                if (fsOk) {
                  try {
                    toDo.put(new ToDoEntry(msgs[i]));
                  } catch (InterruptedException e) {
                    throw new RuntimeException("Putting into msgQueue was " +
                        "interrupted.", e);
                  }
                }
              }
            }
            if (restart || this.stopRequested.get()) {
              toDo.clear();
              break;
            }
            // Reset tries count if we had a successful transaction.
            tries = 0;
          } catch (Exception e) {
            if (e instanceof IOException) {
              e = RemoteExceptionHandler.checkIOException((IOException) e);
            }
            if (tries < this.numRetries) {
              LOG.warn("Processing message (Retry: " + tries + ")", e);
              tries++;
            } else {
              LOG.fatal("Exceeded max retries: " + this.numRetries, e);
              if (!checkFileSystem()) {
                continue;
              }
              // Something seriously wrong. Shutdown.
              stop();
            }
          }
        }
        // Do some housekeeping before going to sleep
        housekeeping();
        sleeper.sleep(lastMsg);
      } // for
    } catch (Throwable t) {
      LOG.fatal("Unhandled exception. Aborting...", t);
      abort();
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    // Scans the meta table
    this.metaScannerThread = new MetaScanner();
   
    unassignRootRegion();

    this.sleeper = new Sleeper(this.threadWakeFrequency, this.closed);
   
    this.maxAssignInOneGo =
      this.conf.getInt("hbase.master.regions.percheckin", 10);
   
    // We're almost open for business
View Full Code Here

Examples of org.apache.hadoop.hbase.util.Sleeper

    this.numRetries = conf.getInt("hbase.client.retries.number", 10);
    this.threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
      10 * 1000);
    this.msgInterval = conf.getInt("hbase.regionserver.msginterval", 3 * 1000);

    this.sleeper = new Sleeper(this.msgInterval, this);

    this.maxScannerResultSize = conf.getLong(
      HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.