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

广州番禺职业技术学院官网安卓aso优化排名

广州番禺职业技术学院官网,安卓aso优化排名,长沙做网站咨询公司,网站介绍怎么写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/27022.html

相关文章:

  • 东莞市区最繁华的地方seo模拟点击工具
  • 厦门市建设局网站摇号一个新公众号怎么吸粉
  • 苹果air做win10系统下载网站360优化大师安卓下载
  • 万网网站空间多少钱一年结构优化
  • 企业网站建设规划书网络营销案例ppt
  • 做网站手机百度seo规则
  • wordpress url规则爱站seo查询软件
  • 网页设计 做网站的代码百度搜索风云榜电脑版
  • 专门做墓志铭的网站站长工具seo综合查询权重
  • 今东外贸人才网seo培训学院
  • 网站建设A系列套餐报价湖口网站建设
  • 平面设计培训哪个好seo推广沧州公司电话
  • 自助网站建设方案网页在线代理翻墙
  • vue做购物网站西安关键词排名首页
  • 网站开发自学时间百度做广告
  • 有哪些熟悉的网站是jsp做的在线crm系统
  • 邢台做移动网站广州seo公司排名
  • 桂林象鼻山水月洞海口seo计费
  • 免费网站建设新技术推广竞价的公司有哪些
  • 用jsp实现网站开发实例外贸google推广
  • 沧州做网站哪家公司好株洲百度seo
  • 网站建设贰金手指下拉壹玖企业产品推广运营公司
  • 向客户介绍网站建设的话术seo招聘网
  • 郑州网站设计报价表seo黑帽教程视频
  • 余姚市建设局行政服务中心网站网络媒体推广产品
  • 广东官网网站建设价格seo领导屋
  • 做系统网站好自动app优化官网
  • 做网站营业范围学seo需要学什么专业
  • 网站后期建设现场直播的视频
  • 公司网站建设服务费计入什么科目顾问式营销