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

网站底部特效把网站做成app

网站底部特效,把网站做成app,制作小程序网站源码,如何设计网站的链接在生产者-消费者模型中#xff0c;在原有代码基础上#xff0c;把队列独立为1个类实现#xff0c;通过公布接口#xff0c;由生产者和消费者调用。 public class Consumer implements Runnable {int n;CountDownLatch countDownLatch;public Consumer(BlockingQueueIn…在生产者-消费者模型中在原有代码基础上把队列独立为1个类实现通过公布接口由生产者和消费者调用。 public class Consumer implements Runnable {int n;CountDownLatch countDownLatch;public Consumer(BlockingQueueInteger blockingQueue, int n, CountDownLatch countDownLatch) {this.n n;this.countDownLatchcountDownLatch;}Overridepublic void run() {for(int i0;in;i){try {int curPACqueue.consume();/*System.out.println(this.toString()i处理cur);*/isPrime(cur);/* System.out.println(消费blockingQueue.size());*/} catch (InterruptedException e) {e.printStackTrace();}}System.out.println(消费者完成);countDownLatch.countDown();}int isPrime(int n){ //返回1表示判断为质数0为非质数在此没有进行输入异常检测double n_sqrt;if(n2 || n3) return 1;if(n%6!1 n%6!5) return 0;n_sqrtMath.floor(Math.sqrt((float)n));for(int i5;in_sqrt;i6){if(n%(i)0 | n%(i2)0) return 0;}return 1;}}public class Model {public static void excute(int producerNum,int consumerNum,int num,CountDownLatch countDownLatch){BlockingQueueInteger blockingQueuenew LinkedBlockingQueue(num);for(int i0;iproducerNum;i){new Thread(new Producer(blockingQueue,num/producerNum,countDownLatch)).start();}for(int i0;iconsumerNum;i){new Thread(new Consumer(blockingQueue,num/consumerNum,countDownLatch)).start();}}public static void main(String[] args) {CountDownLatch countDownLatchnew CountDownLatch(6);long sSystem.currentTimeMillis();excute(2,4,1000000,countDownLatch);try {countDownLatch.await();} catch (InterruptedException e) {e.printStackTrace();}System.out.println((double) (System.currentTimeMillis()-s)/1000);} }public class PACqueue {//Java 阻塞队列在队列为空时获取元素的线程会等待队列变为非空。当队列满时存储元素的线程会等待队列可用。private static BlockingQueueInteger blockingQueuenew LinkedBlockingQueue(1000000);public static void produce (int n)throws InterruptedException{blockingQueue.put(n);}public static int consume ()throws InterruptedException{return blockingQueue.take();}}public class Producer implements Runnable{int n;CountDownLatch countDownLatch;public Producer(BlockingQueueInteger blockingQueue, int n,CountDownLatch countDownLatch) {this.n n;this.countDownLatchcountDownLatch;}Overridepublic void run() {Random ra new Random();for(int i0;in;i){try {/* System.out.println(this.toString()i生产);*/PACqueue.produce(ra.nextInt(2000000000)1);/* System.out.println(生产blockingQueue.size());*/} catch (InterruptedException e) {e.printStackTrace();}}System.out.println(生产者完成);countDownLatch.countDown();} }
http://www.pierceye.com/news/837225/

相关文章:

  • 天津品牌网站制作怎样建设网站流程
  • 怎样进行公司网站建设wordpress主题公司
  • 外宣做网站宣传网站功能描述
  • 部队网站建设多少钱营销自己的网站
  • 长春市城乡建设部网站南昌诚推网络技术有限公司
  • 网站 建设 欢迎你濮阳家电网站建设
  • 怎么快速建立一个网站如何用腾讯云服务器搭建wordpress
  • 五屏网站建设多少钱深圳网站公司有哪些
  • 莆田网站建站wordpress cd
  • 软件下载安装免费南京seo关键词优化服务
  • 广州网站设计软件建设将网站加入受信网站再试
  • 淘宝联盟网站备案常见的互联网应用
  • 自己做网站 搜索功能开发企业综合信息服务平台
  • 意大利语网站建设wordpress主题首页显示不全
  • 模板网站免费下载wordpress启用静态
  • 保定网站建设哪家好网站建设实践报告3000字
  • 网站制作项目执行免费制作微网站
  • 西安网站制作费用网站建设小程序开发报价
  • 深圳做针织衫服装的网站软件开发工具手机版
  • 网站域名注册的相关证书证明文件最珠海app
  • 网站规划建设与管理维护大学论文免费个人搭建网站
  • 网站解析时候让做别名企业密信app下载安装
  • 直播网站建设模板网站中文商标域名注册
  • 商务网站建设与管理读后感为什么公司要做网站
  • 高密 网站建设wordpress设置置顶文章
  • 购物京东商城西安官网seo哪家公司好
  • 专门做库存处理的网站沭阳建设网站
  • 建筑必看六个网站门户网站地方生活门户有哪些
  • 江阴 网站开发python基础教程百度亿
  • 邹城网站建设v556本校网站建设