com.mashape.unirest.http.Unirest.shutdown()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(269)

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

Unirest.shutdown介绍

[英]Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit.
[中]关闭异步客户端及其事件循环。使用此方法关闭所有线程并允许应用程序退出。

代码示例

代码示例来源:origin: io.joshworks/snappy-core

public static void shutdown() {
  try {
    Unirest.shutdown();
  } catch (Exception e) {
  }
}

代码示例来源:origin: us.ihmc/ihmc-continuous-integration-core-tools

public void destroy()
{
 try
 {
   Unirest.shutdown();
 }
 catch (IOException e)
 {
   e.printStackTrace();
 }
}

代码示例来源:origin: io.joshworks/snappy

static void shutdown() {
  try {
    Unirest.shutdown();
  } catch (Exception e) {
    logger.warn("Error while closing rest client", e);
  }
}

代码示例来源:origin: us.ihmc/ihmc-ci-plugin-plugin

public void destroy()
{
 try
 {
   Unirest.shutdown();
 }
 catch (IOException e)
 {
   e.printStackTrace();
 }
}

代码示例来源:origin: simplesteph/medium-blog-kafka-udemy

public void close() {
    try {
      Unirest.shutdown();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: shizuchengxuyuan/net.sz.java

public static void main(String[] args) throws Exception {
  int thread_num = 10;
  int client_num = 10;
  final String tokenUrl = "https://openapi.baidu.com/social/oauth/2.0/token";
  ExecutorService exec = Executors.newCachedThreadPool();
  // 50个线程可以同时访问
  final Semaphore semp = new Semaphore(100);
  // 模拟460个客户端访问
  long ftime = System.currentTimeMillis();
  for (int index = 0; index < client_num; index++) {
    Runnable run = new Runnable() {
      public void run() {
        try {
          org.json.JSONObject json = AsynHttpUtil.post(tokenUrl, null);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    };
    exec.execute(run);
  }
  // 退出线程池
  long etime = System.currentTimeMillis();
  log.info("AsynhttpUtil同步方式执行" + thread_num + "个并发访问 " + client_num + "个客服端所花费的时间 " + (etime - ftime) + " ms");
  Unirest.shutdown();
  exec.shutdown();
}

代码示例来源:origin: net.dv8tion/JDA

@Override
public void shutdown(boolean free)
{
  getAudioManager().closeAudioConnection();
  client.close();
  authToken = null; //make further requests fail
  if (free)
  {
    try
    {
      Unirest.shutdown();
    }
    catch (IOException ignored) {}
  }
}

代码示例来源:origin: flekschas/owl2neo4j

Unirest.shutdown();
} catch (Exception e) {
  print_error("Error shutting down Unirest");

代码示例来源:origin: com.infotel.seleniumRobot/core

@Override
public void onExecutionFinish() {
  try {
    Unirest.shutdown();
  } catch (IOException e) {
    logger.error("Cannot stop unirest", e);

相关文章