当前位置: 首页 > news >正文

ps网站界面设计站长之家查询工具

ps网站界面设计,站长之家查询工具,网络服务费税收分类编码,中央气象台台风网台风实时路径Thread-Per-Message是为每一个消息的处理开辟一个线程,以并发方式处理,提高系统整体的吞吐量。这种模式再日常开发中非常常见,为了避免线程的频繁创建和销毁,可以使用线程池来代替。 示例代码如下: public class Requ…

    Thread-Per-Message是为每一个消息的处理开辟一个线程,以并发方式处理,提高系统整体的吞吐量。这种模式再日常开发中非常常见,为了避免线程的频繁创建和销毁,可以使用线程池来代替。

示例代码如下:

public class Request {
private String business;public Request(String business) {
this.business=business;
}
public String toString() {
return this.business;
}
}
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;public class TaskHandler implements Runnable{
private Request request;public TaskHandler(Request request) {
this.request=request;
}private void slowly() {
try {
TimeUnit.SECONDS.sleep(ThreadLocalRandom.current().nextInt(10));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}@Override
public void run() {
System.out.println("Begin handle "+request);
slowly();
System.out.println("End handle "+request);
}}
import org.multithread.threadpool.BaseThreadPool;
import org.multithread.threadpool.ThreadPool;public class Operator {
private final ThreadPool threadPool=new BaseThreadPool(2,6,4,100);public void call(String business) {
TaskHandler taskHandler=new TaskHandler(new Request(business));
threadPool.execute(taskHandler);
}}
public class TPMtest {
public static void main(String[] args) {
Operator op=new Operator();
String root="Root-Request-";
for(int i=0;i<30;i++) {
op.call(root+i);
}
}
}

运行结果:

Begin handle Root-Request-0
Begin handle Root-Request-1
End handle Root-Request-1
Begin handle Root-Request-2
End handle Root-Request-0
Begin handle Root-Request-3
End handle Root-Request-3
Begin handle Root-Request-4
End handle Root-Request-2
Begin handle Root-Request-5
Begin handle Root-Request-6
Begin handle Root-Request-7
End handle Root-Request-7
Begin handle Root-Request-8
End handle Root-Request-4
Begin handle Root-Request-9
End handle Root-Request-6
Begin handle Root-Request-10
End handle Root-Request-5
Begin handle Root-Request-11
End handle Root-Request-8
Begin handle Root-Request-12
Begin handle Root-Request-13
End handle Root-Request-10
Begin handle Root-Request-14
End handle Root-Request-9
Begin handle Root-Request-15
End handle Root-Request-11
Begin handle Root-Request-16
End handle Root-Request-15
Begin handle Root-Request-17
End handle Root-Request-14
Begin handle Root-Request-18
End handle Root-Request-18
Begin handle Root-Request-19
End handle Root-Request-12
Begin handle Root-Request-20
End handle Root-Request-20
Begin handle Root-Request-21
End handle Root-Request-16
Begin handle Root-Request-22
End handle Root-Request-22
Begin handle Root-Request-23
End handle Root-Request-23
Begin handle Root-Request-24
End handle Root-Request-13
Begin handle Root-Request-25
End handle Root-Request-19
Begin handle Root-Request-26
End handle Root-Request-26
Begin handle Root-Request-27
End handle Root-Request-27
Begin handle Root-Request-28
Begin handle Root-Request-29
End handle Root-Request-25
End handle Root-Request-17
End handle Root-Request-21
End handle Root-Request-24
End handle Root-Request-28
End handle Root-Request-29

http://www.tj-hxxt.cn/news/75015.html

相关文章:

  • 制作企业网站首页怎么做百度网站网址是多少
  • 两学一做专题教育网站网络营销课程速成班
  • 网站开发项目心得成都网络优化托管公司
  • 个人网站 建设方案书网络销售平台排名前十
  • 免费b2b平台推广有询盘吗网站为什么要seo?
  • 提供企业网站建设公司烟台seo网络推广
  • 以前做视频的网站吗婚恋网站排名前三
  • 适合初学者模仿的网站青岛网站排名提升
  • 揭阳网站如何制作百度网址大全下载
  • 网站开发即时聊天源码一个企业seo网站的优化流程
  • 杭州 网站程序优化关键词排名seo
  • pc网站做app优化网站教程
  • 做外贸生意最好的网站google搜索引擎入口 镜像
  • 金华市金东区建设局网站全网络品牌推广
  • 网站设计成功案例做网站哪家公司比较好而且不贵
  • 日本巨乳做视频网站免费下载b站视频软件
  • 为什么要建手机网站深圳关键词优化报价
  • 做门户网站最重要的是什么站长工具seo查询5g5g
  • 注册网站服务器杭州seo论坛
  • 网站兼容设置免费网站排名优化软件
  • 任丘市网站建设价格查网站
  • 合肥做网站web0551优化百度涨
  • 国内最好的网站建设公司如何做推广推广技巧
  • 成都企业网站建设优化网站的意思
  • 做暧小视频免费视频在线观看网站人民日报评网络暴力
  • WordPress网站根目录有哪些痘痘如何去除效果好
  • 厦门做网站企业怎么制作网站
  • wordpress图片云盘龙岗seo网络推广
  • 成都营销网站建设竞价如何屏蔽恶意点击
  • 有哪些做场景秀的网站自己做网站需要多少钱