spark.Spark.threadPool()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中spark.Spark.threadPool()方法的一些代码示例,展示了Spark.threadPool()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spark.threadPool()方法的具体详情如下:
包路径:spark.Spark
类名称:Spark
方法名:threadPool

Spark.threadPool介绍

[英]Configures the embedded web server's thread pool.
[中]配置嵌入式web服务器的线程池。

代码示例

代码示例来源:origin: mgtechsoftware/smockin

void initServerConfig(final MockedServerConfigDTO config) {
  logger.debug("initServerConfig called");
  if (logger.isDebugEnabled())
    logger.debug(config.toString());
  Spark.port(config.getPort());
  Spark.threadPool(config.getMaxThreads(), config.getMinThreads(), config.getTimeOutMillis());
}

代码示例来源:origin: ingenieux/lambada

@Override
protected void executeInternal() throws Exception {
 setupStageVariables();
 loadPathHandlers();
 port(serverPort);
 threadPool(8);
 setupServer();
 awaitInitialization();
 getLog().info(format("Server is alive on http://%s:%d/%s/", "127.0.0.1", this.serverPort, this.stageName));
 while (10 != System.in.read()) {
  Thread.sleep(500);
 }
 stop();
}

代码示例来源:origin: cagataygurturk/lambadaframework

@Override
public void execute() throws MojoExecutionException {
  try {
    printLogo();
    getLog().info(LOG_SEPERATOR);
    getLog().info("Starting web server at port " + serverPort);
    port(serverPort);
    threadPool(8);
    setUpServer();
    awaitInitialization();
    while (10 != System.in.read()) {
      Thread.sleep(500);
    }
    stop();
  } catch (Exception e) {
    throw new MojoExecutionException("Exception at deployment", e);
  }
}

代码示例来源:origin: yeriomin/token-dispenser

threadPool(16, 2, 5000);
ipAddress(host);
port(port);

代码示例来源:origin: simplesteph/ec2-masterclass-sampleapp

public static void main(String[] args) {
  int maxThreads = 32;
  int minThreads = 2;
  int timeOutMillis = 30000;
  threadPool(maxThreads, minThreads, timeOutMillis);
  get("/", EC2SampleApp::hello);
  get("/cpu", EC2SampleApp::cpu);
  get("/ram", EC2SampleApp::ram);
  get("/ram/info", EC2SampleApp::ramInfo);
  get("/ram/clean", EC2SampleApp::ramClean);
  get("/health", EC2SampleApp::health);
  get("/health/flip", EC2SampleApp::flipHealth);
  get("/details", EC2SampleApp::details);
}

代码示例来源:origin: pyloque/captain

public void start() {
  Spark.ipAddress(config.bindHost());
  Spark.port(config.bindPort());
  Spark.threadPool(config.threadNum());
  Spark.staticFileLocation("/static");
  if (!config.readonly()) {
    this.initWritableHandlers();
  }
  this.initReadonlyHandlers();
  this.initViewHandlers();
  this.initExceptionHandlers();
  Spark.awaitInitialization();
  LOG.warn("captain server started");
}

代码示例来源:origin: dessalines/torrenttunes-client

threadPool(8);

相关文章