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

庆阳网站建设代引流推广公司

庆阳网站建设,代引流推广公司,网页模板版权申请,网站建设公司源码 aspThread-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/99133.html

相关文章:

  • 猪八戒网做网站怎么样免费建网站最新视频教程
  • 做暧在线观看网站西安网络优化大的公司
  • 如何设计一个企业网站重庆关键词seo排名
  • 1 建设好自媒体门户网站营销策划的概念
  • b s架构网站怎么做博客是哪个软件
  • 高端品牌网站建设东莞关键字排名优化
  • 网站建设费用组成苏州seo网站管理
  • 医院网站建设原理北京网站推广
  • 外贸网站seo教程网站建设黄页视频
  • 丽水专业网站建设价格西安优化外包
  • 建设网站主机要买什么的好怎么做网页设计的页面
  • 无锡公司网站制作天津seo推广服务
  • 网站开发 定价做一套二级域名网站怎么做
  • 新网站怎么做推广seo关键词优化价格
  • 设计网站横幅线下推广的渠道和方法
  • 建一个营销网站多少钱关键词排名优化易下拉技巧
  • 国外交互设计网站欣赏自媒体是什么
  • 建设银行 杭州市公积金管理中心网站免费好用的网站
  • 中国纪检监察报地址宁波seo整体优化
  • 百度站长工具综合查询黑五类广告推广
  • 视频网站闪图怎么做搜索引擎优化排名案例
  • 同江佳木斯网站制作惠州seo网站管理
  • 石家庄市住房和城乡建设局官方网站简述网站推广的意义和方法
  • 研究生院 网站 建设如何做网站建设
  • 山东旗舰建设集团网站网站制作哪家公司好
  • 手机网站建网百度网盘资源免费搜索引擎入口
  • 电子产品网站开发背景外包网络推广公司怎么选
  • 个人旅游网站模板东莞做网络推广的公司
  • 做网站会出现什么问题windows优化大师会员
  • 网站建设招商万网app下载