模型评测网站怎么做企查查官网查询入口

pingmian/2026/1/21 12:46:38/文章来源:
模型评测网站怎么做,企查查官网查询入口,小程序搭建是什么意思,wordpress统计和谷歌不同前言 前面几篇文章分别学习了多线程的基本知识和线程池使用#xff0c;这篇则为项目实践和整理。 项目参考 选择了两个项目github地址#xff0c;如果不方便下载可以下面留言评论私发。 1.马士兵老师的juc#xff0c;讲述了多线程的基本知识线程讲解 2.基本的线程演示这篇则为项目实践和整理。 项目参考 选择了两个项目github地址如果不方便下载可以下面留言评论私发。 1.马士兵老师的juc讲述了多线程的基本知识线程讲解 2.基本的线程演示主要是对前面几篇讲解的回顾。 代码展示 BlockingQueue阻塞队列 package com.unicss;import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; public class MyBlockingQueue extends Thread { public static BlockingQueueString queue new LinkedBlockingQueueString(3); private int index; public MyBlockingQueue(int i) {this.index i; } public void run() {try {queue.put(String.valueOf(this.index));System.out.println({ this.index } in queue!);} catch (Exception e) {e.printStackTrace();} } public static void main(String args[]) {ExecutorService service Executors.newCachedThreadPool();for (int i 0; i 10; i) {service.submit(new MyBlockingQueue(i));}Thread thread new Thread() {public void run() {try {while (true) {Thread.sleep((int) (Math.random() * 1000));System.out.println(MyBlockingQueue.queue.size());if(MyBlockingQueue.queue.isEmpty())break;String str MyBlockingQueue.queue.take();System.out.println(str has take!);}} catch (Exception e) {e.printStackTrace();}}};service.submit(thread);service.shutdown(); } }CompletionService并发工具类获取接口放回 package com.unicss;import java.util.concurrent.Callable; import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class MyCompletionService implements CallableString { private int id;public MyCompletionService(int i){this.idi; } public static void main(String[] args) throws Exception{ExecutorService serviceExecutors.newCachedThreadPool();CompletionServiceString completionnew ExecutorCompletionServiceString(service);for(int i0;i10;i){completion.submit(new MyCompletionService(i));}for(int i0;i10;i){System.out.println(completion.take().get());}service.shutdown(); }Override public String call() throws Exception {Integer time(int)(Math.random()*1000);try{System.out.println(this.id start);Thread.sleep(time);System.out.println(this.id end);}catch(Exception e){e.printStackTrace();}return this.id:time;} }Executor package com.unicss;import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class MyExecutor extends Thread { private int index; public MyExecutor(int i){this.indexi; } public void run(){try{System.out.println([this.index] start....);Thread.sleep((int)(Math.random()*10000));System.out.println([this.index] end.);}catch(Exception e){e.printStackTrace();} } public static void main(String args[]){ExecutorService serviceExecutors.newFixedThreadPool(4);for(int i0;i10;i){service.execute(new MyExecutor(i));//service.submit(new MyExecutor(i));}System.out.println(submit finish);service.shutdown(); } }ReentrantLock可重入到互斥锁 package com.unicss;import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.ReentrantLock; public class MyReentrantLock extends Thread{ TestReentrantLock lock; private int id; public MyReentrantLock(int i,TestReentrantLock test){this.idi;this.locktest; } public void run(){lock.print(id); } public static void main(String args[]){ExecutorService serviceExecutors.newCachedThreadPool();TestReentrantLock locknew TestReentrantLock();for(int i0;i10;i){service.submit(new MyReentrantLock(i,lock));}service.shutdown(); } } class TestReentrantLock{ private ReentrantLock locknew ReentrantLock(); public void print(int str){try{lock.lock();System.out.println(str获得);Thread.sleep((int)(Math.random()*1000));}catch(Exception e){e.printStackTrace();}finally{System.out.println(str释放);lock.unlock();} } }Semaphore信号量 package com.unicss;import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; public class MySemaphore extends Thread { Semaphore position; private int id; public MySemaphore(int i,Semaphore s){this.idi;this.positions; } public void run(){try{if(position.availablePermits()0){System.out.println(顾客[this.id]进入厕所有空位);}else{System.out.println(顾客[this.id]进入厕所没空位排队);}position.acquire();System.out.println(顾客[this.id]获得坑位);Thread.sleep((int)(Math.random()*1000));System.out.println(顾客[this.id]使用完毕);position.release();}catch(Exception e){e.printStackTrace();} } public static void main(String args[]){ExecutorService listExecutors.newCachedThreadPool();Semaphore positionnew Semaphore(2);for(int i0;i10;i){list.submit(new MySemaphore(i1,position));}list.shutdown();position.acquireUninterruptibly(2);System.out.println(使用完毕需要清扫了);position.release(2); } }CountDownLatch倒计数器 package com.unicss;import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TestCountDownLatch { public static void main(String[] args) throws InterruptedException {// 开始的倒数锁final CountDownLatch begin new CountDownLatch(1);// 结束的倒数锁final CountDownLatch end new CountDownLatch(10);// 十名选手final ExecutorService exec Executors.newFixedThreadPool(10);for (int index 0; index 10; index) {final int NO index 1;Runnable run new Runnable() {public void run() {try {begin.await();//一直阻塞Thread.sleep((long) (Math.random() * 10000));System.out.println(No. NO arrived);} catch (InterruptedException e) {} finally {end.countDown();}}};exec.submit(run);}System.out.println(Game Start);begin.countDown(); //让技术器变为0执行end.await();//等待阻塞计数器变为0 执行System.out.println(Game Over);exec.shutdown(); } }CyclicBarrier同步屏障 package com.unicss;import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TestCyclicBarrier {// 徒步需要的时间: Shenzhen, Guangzhou, Shaoguan, Changsha, Wuhanprivate static int[] timeWalk { 5, 8, 15, 15, 10 };// 自驾游private static int[] timeSelf { 1, 3, 4, 4, 5 };// 旅游大巴private static int[] timeBus { 2, 4, 6, 6, 7 };static String now() {SimpleDateFormat sdf new SimpleDateFormat(HH:mm:ss);return sdf.format(new Date()) : ;}static class Tour implements Runnable {private int[] times;private CyclicBarrier barrier;private String tourName;public Tour(CyclicBarrier barrier, String tourName, int[] times) {this.times times;this.tourName tourName;this.barrier barrier;}public void run() {try {Thread.sleep(times[0] * 1000);System.out.println(now() tourName Reached Shenzhen);barrier.await();Thread.sleep(times[1] * 1000);System.out.println(now() tourName Reached Guangzhou);barrier.await();Thread.sleep(times[2] * 1000);System.out.println(now() tourName Reached Shaoguan);barrier.await();Thread.sleep(times[3] * 1000);System.out.println(now() tourName Reached Changsha);barrier.await();Thread.sleep(times[4] * 1000);System.out.println(now() tourName Reached Wuhan);barrier.await();} catch (InterruptedException e) {} catch (BrokenBarrierException e) {}}}public static void main(String[] args) {// 三个旅行团。 屏障为三个必须三个到达屏障才会打开CyclicBarrier barrier new CyclicBarrier(3);ExecutorService exec Executors.newFixedThreadPool(3);exec.submit(new Tour(barrier, WalkTour, timeWalk));exec.submit(new Tour(barrier, SelfTour, timeSelf)); //当我们把下面的这段代码注释后会发现程序阻塞了无法继续运行下去。exec.submit(new Tour(barrier, BusTour, timeBus));// exec.submit(new Tour(barrier, liu, timeBus)); 如果单独加一个会阻塞在屏障上必须根据设置是三个exec.shutdown();} } ScheduledThread定时线程 package com.unicss;/*** 定时器*/ import static java.util.concurrent.TimeUnit.SECONDS; import java.util.Date; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; public class TestScheduledThread { public static void main(String[] args) {final ScheduledExecutorService scheduler Executors.newScheduledThreadPool(2);final Runnable beeper new Runnable() {int count 0;public void run() {System.out.println(new Date() beep (count));} };// 1秒钟后运行并每隔2秒运行一次final ScheduledFuture beeperHandle scheduler.scheduleAtFixedRate(beeper, 1, 2, SECONDS);// 2秒钟后运行并每次在上次任务运行完后等待5秒后重新运行final ScheduledFuture beeperHandle2 scheduler.scheduleWithFixedDelay(beeper, 2, 5, SECONDS);// 30秒后结束关闭任务并且关闭Schedulerscheduler.schedule(new Runnable() {public void run() {beeperHandle.cancel(true);beeperHandle2.cancel(true);scheduler.shutdown();}}, 30, SECONDS); } }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/87171.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

自已买域名做网站要多少钱wordpress主题在手机不展示

我在Python中有一个服务器/客户机套接字对。服务器接收特定的命令,然后准备响应并将其发送到客户端。在在这个问题中,我关心的只是代码中的可能的注入:如果可以要求服务器对第二个参数做一些奇怪的事情——如果对命令内容的控制不足以避免不希…

做做网站下载2023八戒电影在线观看免费7

Guava是Google开源的一个Java基础类库,它在Google内部被广泛使用。Guava提供了很多功能模块比如:集合、并发库、缓存等,EventBus是其中的一个module,本篇结合EventBus源码来谈谈它的设计与实现。 概要 首先,我们先来预…

重点实验室网站建设今天新闻摘抄十条

图像的表示 1,位数 计算机采用0/1编码的系统,数字图像也是0/1来记录信息,图像都是8位数图像,包含0~255灰度, 其中0代表最黑,1代表最白 3, 4,OpenCV部署方法 安装OpenCV之前…

江门网站建设推广公司的网站建设价格

目录 前言 一、动态树的实现 1.数据表 2.编写后端controller层 3.定义前端发送请求路径 4.前端左侧动态树的编写 4.1.发送请求获取数据 4.2.遍历左侧菜单 5.实现左侧菜单点击展示右边内容 5.1.定义组件 5.2.定义组件与路由的对应关系 5.3.渲染组件内容 5.4.通过动态…

宣城市网站集约化建设西安建公司网站

目的 Q:如何在Qt库的基础上,实现自定义控件呢? A:根据官方文档回答,就是继承需实现的控件,然后实现自定义功能。 以下是实现QListWidget控件的自定义item。 先看下最终效果是如何: listItem 主…

临沂建设工程招聘信息网站郑州网站建设 .cc

1. 什么是bug bug本意是昆虫”或“虫子”,现在一般是指在电脑系统或程序中,隐藏着的一些未被发现的缺陷或问 题,简称程序漏洞。 “Bug” 的创始人格蕾丝赫柏(Grace Murray Hopper),她是一位为美国海军工作的…

实名制认证网站wordpress主题git下载失败

统一建模语言(Unified Modeling Language, UML )是一种为面向对象系统的产品进行说明、可视化和编制文档的一种标准语言,是非专利的第三代建模和规约语言。 UML 是面向对象设计的建模工具,独立于任何具体程序设计语言。 一、简介 UML 作为一…

网站为什么做优化ppt百度引擎搜索网址

Nacos与Eureka的区别详解 在微服务架构中,服务注册与发现是核心组件之一,它们允许服务实例在启动时自动注册,并且能被其他服务发现,从而实现服务之间的互相通信。Nacos和Eureka都是现代微服务体系中广泛使用的服务注册与发现工具。本文将深入分析二者的区别,并为您提供一…

槐荫区网站建设室内装修设计软件用哪个好

在今年夏天策马翻译举办的翻译讲座上,我和詹成教授交流过一个问题:詹教授讲的很多知识点和经验并不符合“信达雅”?詹教授的回答是:“信达雅”并非翻译界的标准,他自己在日常翻译工作中的标准是“快准顺”。詹教授的回…

商务网站设计服务外包公司是干什么的

📚 目录 介绍布局原理和约束盒模型布局 约束容器ConstrainedBox非约束容器UnconstrainedBox 线性布局 行row列column 弹性布局流式布局 WrapFlow 层叠布局对齐和相对定位布局构建回调 LayoutBuilder布局过程中AfterLayout布局完成后执行 本文学习和引用自《Flutte…

天津专业做网站网站内页制作

背景 > 经过检测,我们识别到您的应用,目前未适配安卓11(API30),请您关注适配截止时间,尽快开展适配工作,避免影响应用正常发布和经营。 > targetSdkVersion30 升级适配工作参考文档&am…

千万pv网站开发成本网上做网站怎么赚钱

部署网站 说好不哭 在接触serverless架构之前,我们如果想实现上线一个Web网站,就要在开发前期经过操作很多冗杂但又必须的步骤,不少小白可谓是快速的从入门到退坑。 编写代码,部署应用,部署数据库,申请域…

国外主流网站开发技术丽江建设信息网站

容器化是最近几年 DevOps 界流行的趋势,通过业务的容器化我们将创建一个完全打包、自包含的计算环境,让软件开发人员能够更加快速地创建和部署自己的应用程序。然而长期以来,由于镜像格式的限制,容器启动镜像的加载是很慢的&#…

如何制作网页跳转链接关键词seo排名公司

今日内容 1. Junit单元测试 2. 反射 3. 注解Junit单元测试: * 测试分类:1. 黑盒测试:不需要写代码,给输入值,看程序是否能够输出期望的值。2. 白盒测试:需要写代码的。关注程序具体的执行流程。* Junit使…

衡水移动网站建设价格中国最好的猎头公司

随着加密数字货币的交易方式逐渐完善,杠杆交易也逐渐成为交易者获利的重要手段之一。杠杆交易可以通过借贷放大投资收益,但是也同时放大风险。 实际使用过程中有很多小白会有不少疑问:比如杠杆交易和合约交易都是放大风险,那这两…

旅游网站的建设依据和背景哪个旅游网站可以做私人定制

简介 【毕设源码推荐 javaweb 项目】基于springbootvue 的 适用于计算机类毕业设计,课程设计参考与学习用途。仅供学习参考, 不得用于商业或者非法用途,否则,一切后果请用户自负。 看运行截图看 第五章 第四章 获取资料方式 **项…

百度做网站联系电话怎么做一个好的wordpress

一、同源策略 同源策略(Same Origin Policy): 同源是指域名,协议,端口完成一致,那么这两个url就是同源。同源策略是一种约定,它是浏览器最核心也最基本的安全功能,也是浏览器故意设置的一个功能限制。如果缺少了同源策…

商城网站建设都有哪些类型阀门行业网站怎么做

1.集合 在内存层面需要针对于多个数据进行存储。此时可以考虑的容器有:数组、集合类。 数组存储多个数据方面的特点: 数组一旦初始化,其长度就是确定的。数组中的多个元素是依次紧密排列的,有序的,可重复的。数组一…

15年做那些网站能致富免费的高清视频素材网站

迅雷已经用了 10 年,一直把它看作是速度最快也最方便的下载工具。迅雷会员也是我必续的服务。但,迅雷堕落了。thunder: 迅雷专属链接越来越少,基本都是磁力、BT 的天下迅雷会员加速不再给力,大量资源速度为 0。会员虽然还有一年多…

目前网站建设用哪种语言公司注销后 网站备案吗

register方法正如前面所提到的,在register方法中只绑定事物到服务容器,而不要做其他事情,否则,一不小心就能用到一个尚未被加载的服务提供者提供的服务。现在让我们来看看一个基本的服务提供者长什么样:namespace AppP…