Showing preview only (1,104K chars total). Download the full file or copy to clipboard to get everything.
Repository: Wang-Jun-Chao/java-concurrency
Branch: master
Commit: 80f41b043fd8
Files: 271
Total size: 974.4 KB
Directory structure:
gitextract_yapqjxir/
├── .idea/
│ ├── .name
│ ├── codeStyleSettings.xml
│ ├── compiler.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── findbugs-idea.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── scopes/
│ │ └── scope_settings.xml
│ ├── uiDesigner.xml
│ └── vcs.xml
├── 01-02-线程的创建和运行/
│ ├── 01-02-线程的创建和运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Calculator.java
├── 01-03-线程信息的获取和设置/
│ ├── 01-03-线程信息的获取和设置.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Calculator.java
├── 01-04-线程的中断/
│ ├── 01-04-线程的中断.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── PrimeGenerator.java
├── 01-05-线程中断的控制/
│ ├── 01-05-线程中断的控制.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileSearch.java
├── 01-06-线程的休眠和恢复/
│ ├── 01-06-线程的休眠和恢复.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileClock.java
├── 01-07-等待线程的终止/
│ ├── 01-07-等待线程的终止.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── DataSourcesLoader.java
│ └── NetworkConnectionsLoader.java
├── 01-08-守护线程的创建和运行/
│ ├── 01-08-守护线程的创建和运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── event/
│ │ └── Event.java
│ └── task/
│ ├── CleanerTask.java
│ └── WriterTask.java
├── 01-09-线程中不可控异常的处理/
│ ├── 01-09-线程中不可控异常的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── handler/
│ │ └── ExceptionHandler.java
│ └── task/
│ └── Task.java
├── 01-10-线程局部变量的使用/
│ ├── 01-10-线程局部变量的使用.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ ├── Main.java
│ │ └── SafeMain.java
│ └── task/
│ ├── SafeTask.java
│ └── UnsafeTask.java
├── 01-11-线程分组/
│ ├── 01-11-线程分组.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Result.java
│ └── SearchTask.java
├── 01-12-线程组中不可控制异常的处理/
│ ├── 01-12-线程组中不可控制异常的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── group/
│ │ └── MyThreadGroup.java
│ └── task/
│ └── Task.java
├── 01-13-使用工厂类创建线程/
│ ├── 01-13-使用工厂类创建线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── factory/
│ │ └── MyThreadFactory.java
│ └── task/
│ └── Task.java
├── 02-02-使用synchronized实现同步方法-问题/
│ ├── 02-02-使用synchronized实现同步方法-问题.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 02-02-使用synchronized实现同步方法-问题解决/
│ ├── 02-02-使用synchronized实现同步方法-问题解决.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 02-03-使用非依赖属性实现同步/
│ ├── 02-03-使用非依赖属性实现同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Cinema.java
│ ├── TicketOffice1.java
│ └── TicketOffice2.java
├── 02-04-在同步代码中使用条件/
│ ├── 02-04-在同步代码中使用条件.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ ├── EventStorage.java
│ └── Producer.java
├── 02-05-用锁实现同步/
│ ├── 02-05-用锁实现同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 02-06-使用读写锁实现同步数据访问/
│ ├── 02-06-使用读写锁实现同步数据访问.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── PricesInfo.java
│ ├── Reader.java
│ └── Writer.java
├── 02-07-修改锁的公平性/
│ ├── 02-07-修改锁的公平性.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 02-08-在锁中使用多条件/
│ ├── 02-08-在锁中使用多条件.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── Consumer.java
│ │ └── Producer.java
│ └── utils/
│ ├── Buffer.java
│ └── FileMock.java
├── 02-09-应用例子/
│ ├── 02-09-应用例子.iml
│ └── src/
│ └── com.concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── BuildStats.java
│ ├── Sensor1.java
│ └── Sensor2.java
├── 03-02-资源并发控制访问/
│ ├── 03-02-资源并发控制访问.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 03-03-资源的多副本的并发访问控制/
│ ├── 03-03-资源的多副本的并发访问控制.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 03-04-等待多个并发事件的完成/
│ ├── 03-04-等待多个并发事件的完成.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Participant.java
│ └── VideoConference.java
├── 03-05-在集合点的同步/
│ ├── 03-05-在集合点的同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── Grouper.java
│ │ └── Searcher.java
│ └── utils/
│ ├── MatrixMock.java
│ └── Results.java
├── 03-06-并发阶段任务的运行/
│ ├── 03-06-并发阶段任务的运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileSearch.java
├── 03-07-并发阶段任务中的阶段切换/
│ ├── 03-07-并发阶段任务中的阶段切换.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyPhaser.java
│ └── Student.java
├── 03-08-并发任务间的数据交换/
│ ├── 03-08-并发任务间的数据交换.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ └── Producer.java
├── 04-02-创建线程执行器/
│ ├── 04-02-创建线程执行器.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Server.java
│ └── Task.java
├── 04-03-创建固定大小的线程执行器/
│ ├── 04-03-创建固定大小的线程执行器.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Server.java
│ └── Task.java
├── 04-04-在执行器中执行任务并返回结果/
│ ├── 04-04-在执行器中执行任务并返回结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FactorialCalculator.java
├── 04-05-运行多个任务并处理第一个结果/
│ ├── 04-05-运行多个任务并处理第一个结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── TaskValidator.java
│ └── UserValidator.java
├── 04-06-运行多个任务并且处理所有结果/
│ ├── 04-06-运行多个任务并且处理所有结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Result.java
│ └── Task.java
├── 04-07-在执行器中延时执行任务/
│ ├── 04-07-在执行器中延时执行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-08-在执行器中周期性执行任务/
│ ├── 04-08-在执行器中周期性执行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-09-在执行器中取消任务/
│ ├── 04-09-在执行器中取消任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-10-在执行器中控制任务的完成/
│ ├── 04-10-在执行器中控制任务的完成.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ExecutableTask.java
│ └── ResultTask.java
├── 04-11-在执行器中分离任务的启动与结果的处理/
│ ├── 04-11-在执行器中分离任务的启动与结果的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ReportGenerator.java
│ ├── ReportProcessor.java
│ └── ReportRequest.java
├── 04-12-处理在执行器中被拒绝的任务/
│ ├── 04-12-处理在执行器中被拒绝的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── RejectedTaskController.java
│ └── Task.java
├── 05-02-创建Fork-Join线程池/
│ ├── 05-02-创建Fork-Join线程池.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── Task.java
│ └── utils/
│ ├── Product.java
│ └── ProductListGenerator.java
├── 05-03-合并任务的结果/
│ ├── 05-03-合并任务的结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── DocumentTask.java
│ │ └── LineTask.java
│ └── utils/
│ └── DocumentMock.java
├── 05-04-异步运行任务/
│ ├── 05-04-异步运行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FolderProcessor.java
├── 05-05-在任务中抛出异常/
│ ├── 05-05-在任务中抛出异常.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 05-06-取消任务/
│ ├── 05-06-取消任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── TaskManager.java
│ └── utils/
│ ├── ArrayGenerator.java
│ └── SearchNumberTask.java
├── 06-02-使用非阻塞式线程安全列表/
│ ├── 06-02-使用非阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── AddTask.java
│ └── PollTask.java
├── 06-03-使用阻塞式线程安全列表/
│ ├── 06-03-使用阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Client.java
├── 06-04-使用按优先级排序的阻塞式线程安全列表/
│ ├── 06-04-使用按优先级排序的阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Event.java
│ └── Task.java
├── 06-05-使用带有延迟元素的线程安全列表/
│ ├── 06-05-使用带有延迟元素的线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Event.java
│ └── Task.java
├── 06-06-使用线程安全可遍历映射/
│ ├── 06-06-使用线程安全可遍历映射.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── Task.java
│ └── utils/
│ └── Contact.java
├── 06-07-生成并发随机数/
│ ├── 06-07-生成并发随机数.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── TaskLocalRandom.java
├── 06-08-使用原子变量/
│ ├── 06-08-使用原子变量.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 06-09-使用原子数组/
│ ├── 06-09-使用原子数组.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Decrementer.java
│ └── Incrementer.java
├── 07-02-定制ThreadPoolExecutor类/
│ ├── 07-02-定制ThreadPoolExecutor类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── executor/
│ │ └── MyExecutor.java
│ └── task/
│ └── SleepTwoSecondsTask.java
├── 07-03-基于优先级的Executor类/
│ ├── 07-03-基于优先级的Executor类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── MyPriorityTask.java
├── 07-04-实现ThreadFactory接口生成定制线程/
│ ├── 07-04-实现ThreadFactory接口生成定制线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyTask.java
│ ├── MyThread.java
│ └── MyThreadFactory.java
├── 07-05-在Executro对象中使用ThreadFactory/
│ ├── 07-05-在Executro对象中使用ThreadFactory.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyTask.java
│ ├── MyThread.java
│ └── MyThreadFactory.java
├── 07-06-定制运行在线程池中的任务/
│ ├── 07-06-定制运行在线程池中的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyScheduledTask.java
│ ├── MyScheduledThreadPoolExecutor.java
│ └── Task.java
├── 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/
│ ├── 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyRecursiveTask.java
│ ├── MyWorkerThread.java
│ └── MyWorkerThreadFactory.java
├── 07-08-定制运行在Fork-Join框架中的任务/
│ ├── 07-08-定制运行在Fork-Join框架中的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyWorkerTask.java
│ └── Task.java
├── 07-09-现实定制Lock类/
│ ├── 07-09-现实定制Lock类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyAbstractQueuedSynchronizer.java
│ ├── MyLock.java
│ └── Task.java
├── 07-10-实现基于优先级的传输队列/
│ ├── 07-10-实现基于优先级的传输队列.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ ├── Event.java
│ ├── MyPriorityTransferQueue.java
│ └── Producer.java
├── 07-11-实现自己的原子对象/
│ ├── 07-11-实现自己的原子对象.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ParkingCounter.java
│ ├── Sensor1.java
│ └── Sensor2.java
├── README.md
└── Template/
└── Template.iml
================================================
FILE CONTENTS
================================================
================================================
FILE: .idea/.name
================================================
JAVA7并发编程实战手册
================================================
FILE: .idea/codeStyleSettings.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</component>
</project>
================================================
FILE: .idea/compiler.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
================================================
FILE: .idea/copyright/profiles_settings.xml
================================================
<component name="CopyrightManager">
<settings default="" />
</component>
================================================
FILE: .idea/encodings.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
================================================
FILE: .idea/findbugs-idea.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="org.twodividedbyzero.idea.findbugs">
<option name="annotationTypeSettings">
<map>
<entry key="ExpPriority" value="-16777216;-1;-8355712;WAVE_UNDERSCORE;0;" />
<entry key="HighPriority" value="-65536;-1;-65536;WAVE_UNDERSCORE;1;" />
<entry key="IgnorePriority" value="-16777216;-1;-8650628;WAVE_UNDERSCORE;0;" />
<entry key="LowPriority" value="-16777216;-1;-16711936;BOXED;0;" />
<entry key="NormalPriority" value="-16777216;-1;-5066240;WAVE_UNDERSCORE;2;" />
</map>
</option>
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowEditorPreview" value="true" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="true" />
<entry key="InefficientInitializationInsideLoop" value="true" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="true" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
<option name="_annotationTypeSettings">
<map>
<entry key="ExpPriority" value="-16777216;-1;-8355712;WAVE_UNDERSCORE;0;" />
<entry key="HighPriority" value="-65536;-1;-65536;WAVE_UNDERSCORE;1;" />
<entry key="IgnorePriority" value="-16777216;-1;-8650628;WAVE_UNDERSCORE;0;" />
<entry key="LowPriority" value="-16777216;-1;-16711936;BOXED;0;" />
<entry key="NormalPriority" value="-16777216;-1;-5066240;WAVE_UNDERSCORE;2;" />
</map>
</option>
</component>
</project>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClientPropertiesManager">
<properties class="javax.swing.AbstractButton">
<property name="hideActionText" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JComponent">
<property name="html.disable" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JEditorPane">
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
<property name="charset" class="java.lang.String" />
</properties>
<properties class="javax.swing.JList">
<property name="List.isFileList" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JPasswordField">
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JSlider">
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
<property name="JSlider.isFilled" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTable">
<property name="Table.isFileList" class="java.lang.Boolean" />
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JToolBar">
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTree">
<property name="JTree.lineStyle" class="java.lang.String" />
</properties>
<properties class="javax.swing.text.JTextComponent">
<property name="caretAspectRatio" class="java.lang.Double" />
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="IdProvider" IDEtalkID="529459F98EE870CD098AECD06BC25C91" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
================================================
FILE: .idea/modules.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/01-02-线程的创建和运行/01-02-线程的创建和运行.iml" filepath="$PROJECT_DIR$/01-02-线程的创建和运行/01-02-线程的创建和运行.iml" />
<module fileurl="file://$PROJECT_DIR$/01-03-线程信息的获取和设置/01-03-线程信息的获取和设置.iml" filepath="$PROJECT_DIR$/01-03-线程信息的获取和设置/01-03-线程信息的获取和设置.iml" />
<module fileurl="file://$PROJECT_DIR$/01-04-线程的中断/01-04-线程的中断.iml" filepath="$PROJECT_DIR$/01-04-线程的中断/01-04-线程的中断.iml" />
<module fileurl="file://$PROJECT_DIR$/01-05-线程中断的控制/01-05-线程中断的控制.iml" filepath="$PROJECT_DIR$/01-05-线程中断的控制/01-05-线程中断的控制.iml" />
<module fileurl="file://$PROJECT_DIR$/01-06-线程的休眠和恢复/01-06-线程的休眠和恢复.iml" filepath="$PROJECT_DIR$/01-06-线程的休眠和恢复/01-06-线程的休眠和恢复.iml" />
<module fileurl="file://$PROJECT_DIR$/01-07-等待线程的终止/01-07-等待线程的终止.iml" filepath="$PROJECT_DIR$/01-07-等待线程的终止/01-07-等待线程的终止.iml" />
<module fileurl="file://$PROJECT_DIR$/01-08-守护线程的创建和运行/01-08-守护线程的创建和运行.iml" filepath="$PROJECT_DIR$/01-08-守护线程的创建和运行/01-08-守护线程的创建和运行.iml" />
<module fileurl="file://$PROJECT_DIR$/01-09-线程中不可控异常的处理/01-09-线程中不可控异常的处理.iml" filepath="$PROJECT_DIR$/01-09-线程中不可控异常的处理/01-09-线程中不可控异常的处理.iml" />
<module fileurl="file://$PROJECT_DIR$/01-10-线程局部变量的使用/01-10-线程局部变量的使用.iml" filepath="$PROJECT_DIR$/01-10-线程局部变量的使用/01-10-线程局部变量的使用.iml" />
<module fileurl="file://$PROJECT_DIR$/01-11-线程分组/01-11-线程分组.iml" filepath="$PROJECT_DIR$/01-11-线程分组/01-11-线程分组.iml" />
<module fileurl="file://$PROJECT_DIR$/01-12-线程组中不可控制异常的处理/01-12-线程组中不可控制异常的处理.iml" filepath="$PROJECT_DIR$/01-12-线程组中不可控制异常的处理/01-12-线程组中不可控制异常的处理.iml" />
<module fileurl="file://$PROJECT_DIR$/01-13-使用工厂类创建线程/01-13-使用工厂类创建线程.iml" filepath="$PROJECT_DIR$/01-13-使用工厂类创建线程/01-13-使用工厂类创建线程.iml" />
<module fileurl="file://$PROJECT_DIR$/02-02-使用synchronized实现同步方法-问题/02-02-使用synchronized实现同步方法-问题.iml" filepath="$PROJECT_DIR$/02-02-使用synchronized实现同步方法-问题/02-02-使用synchronized实现同步方法-问题.iml" />
<module fileurl="file://$PROJECT_DIR$/02-02-使用synchronized实现同步方法-问题解决/02-02-使用synchronized实现同步方法-问题解决.iml" filepath="$PROJECT_DIR$/02-02-使用synchronized实现同步方法-问题解决/02-02-使用synchronized实现同步方法-问题解决.iml" />
<module fileurl="file://$PROJECT_DIR$/02-03-使用非依赖属性实现同步/02-03-使用非依赖属性实现同步.iml" filepath="$PROJECT_DIR$/02-03-使用非依赖属性实现同步/02-03-使用非依赖属性实现同步.iml" />
<module fileurl="file://$PROJECT_DIR$/02-04-在同步代码中使用条件/02-04-在同步代码中使用条件.iml" filepath="$PROJECT_DIR$/02-04-在同步代码中使用条件/02-04-在同步代码中使用条件.iml" />
<module fileurl="file://$PROJECT_DIR$/02-05-用锁实现同步/02-05-用锁实现同步.iml" filepath="$PROJECT_DIR$/02-05-用锁实现同步/02-05-用锁实现同步.iml" />
<module fileurl="file://$PROJECT_DIR$/02-06-使用读写锁实现同步数据访问/02-06-使用读写锁实现同步数据访问.iml" filepath="$PROJECT_DIR$/02-06-使用读写锁实现同步数据访问/02-06-使用读写锁实现同步数据访问.iml" />
<module fileurl="file://$PROJECT_DIR$/02-07-修改锁的公平性/02-07-修改锁的公平性.iml" filepath="$PROJECT_DIR$/02-07-修改锁的公平性/02-07-修改锁的公平性.iml" />
<module fileurl="file://$PROJECT_DIR$/02-08-在锁中使用多条件/02-08-在锁中使用多条件.iml" filepath="$PROJECT_DIR$/02-08-在锁中使用多条件/02-08-在锁中使用多条件.iml" />
<module fileurl="file://$PROJECT_DIR$/03-02-资源并发控制访问/03-02-资源并发控制访问.iml" filepath="$PROJECT_DIR$/03-02-资源并发控制访问/03-02-资源并发控制访问.iml" />
<module fileurl="file://$PROJECT_DIR$/03-03-资源的多副本的并发访问控制/03-03-资源的多副本的并发访问控制.iml" filepath="$PROJECT_DIR$/03-03-资源的多副本的并发访问控制/03-03-资源的多副本的并发访问控制.iml" />
<module fileurl="file://$PROJECT_DIR$/03-04-等待多个并发事件的完成/03-04-等待多个并发事件的完成.iml" filepath="$PROJECT_DIR$/03-04-等待多个并发事件的完成/03-04-等待多个并发事件的完成.iml" />
<module fileurl="file://$PROJECT_DIR$/03-05-在集合点的同步/03-05-在集合点的同步.iml" filepath="$PROJECT_DIR$/03-05-在集合点的同步/03-05-在集合点的同步.iml" />
<module fileurl="file://$PROJECT_DIR$/03-06-并发阶段任务的运行/03-06-并发阶段任务的运行.iml" filepath="$PROJECT_DIR$/03-06-并发阶段任务的运行/03-06-并发阶段任务的运行.iml" />
<module fileurl="file://$PROJECT_DIR$/03-07-并发阶段任务中的阶段切换/03-07-并发阶段任务中的阶段切换.iml" filepath="$PROJECT_DIR$/03-07-并发阶段任务中的阶段切换/03-07-并发阶段任务中的阶段切换.iml" />
<module fileurl="file://$PROJECT_DIR$/03-08-并发任务间的数据交换/03-08-并发任务间的数据交换.iml" filepath="$PROJECT_DIR$/03-08-并发任务间的数据交换/03-08-并发任务间的数据交换.iml" />
<module fileurl="file://$PROJECT_DIR$/04-02-创建线程执行器/04-02-创建线程执行器.iml" filepath="$PROJECT_DIR$/04-02-创建线程执行器/04-02-创建线程执行器.iml" />
<module fileurl="file://$PROJECT_DIR$/04-03-创建固定大小的线程执行器/04-03-创建固定大小的线程执行器.iml" filepath="$PROJECT_DIR$/04-03-创建固定大小的线程执行器/04-03-创建固定大小的线程执行器.iml" />
<module fileurl="file://$PROJECT_DIR$/04-04-在执行器中执行任务并返回结果/04-04-在执行器中执行任务并返回结果.iml" filepath="$PROJECT_DIR$/04-04-在执行器中执行任务并返回结果/04-04-在执行器中执行任务并返回结果.iml" />
<module fileurl="file://$PROJECT_DIR$/04-05-运行多个任务并处理第一个结果/04-05-运行多个任务并处理第一个结果.iml" filepath="$PROJECT_DIR$/04-05-运行多个任务并处理第一个结果/04-05-运行多个任务并处理第一个结果.iml" />
<module fileurl="file://$PROJECT_DIR$/04-06-运行多个任务并且处理所有结果/04-06-运行多个任务并且处理所有结果.iml" filepath="$PROJECT_DIR$/04-06-运行多个任务并且处理所有结果/04-06-运行多个任务并且处理所有结果.iml" />
<module fileurl="file://$PROJECT_DIR$/04-07-在执行器中延时执行任务/04-07-在执行器中延时执行任务.iml" filepath="$PROJECT_DIR$/04-07-在执行器中延时执行任务/04-07-在执行器中延时执行任务.iml" />
<module fileurl="file://$PROJECT_DIR$/04-08-在执行器中周期性执行任务/04-08-在执行器中周期性执行任务.iml" filepath="$PROJECT_DIR$/04-08-在执行器中周期性执行任务/04-08-在执行器中周期性执行任务.iml" />
<module fileurl="file://$PROJECT_DIR$/04-09-在执行器中取消任务/04-09-在执行器中取消任务.iml" filepath="$PROJECT_DIR$/04-09-在执行器中取消任务/04-09-在执行器中取消任务.iml" />
<module fileurl="file://$PROJECT_DIR$/04-10-在执行器中控制任务的完成/04-10-在执行器中控制任务的完成.iml" filepath="$PROJECT_DIR$/04-10-在执行器中控制任务的完成/04-10-在执行器中控制任务的完成.iml" />
<module fileurl="file://$PROJECT_DIR$/04-11-在执行器中分离任务的启动与结果的处理/04-11-在执行器中分离任务的启动与结果的处理.iml" filepath="$PROJECT_DIR$/04-11-在执行器中分离任务的启动与结果的处理/04-11-在执行器中分离任务的启动与结果的处理.iml" />
<module fileurl="file://$PROJECT_DIR$/04-12-处理在执行器中被拒绝的任务/04-12-处理在执行器中被拒绝的任务.iml" filepath="$PROJECT_DIR$/04-12-处理在执行器中被拒绝的任务/04-12-处理在执行器中被拒绝的任务.iml" />
<module fileurl="file://$PROJECT_DIR$/05-02-创建Fork-Join线程池/05-02-创建Fork-Join线程池.iml" filepath="$PROJECT_DIR$/05-02-创建Fork-Join线程池/05-02-创建Fork-Join线程池.iml" />
<module fileurl="file://$PROJECT_DIR$/05-03-合并任务的结果/05-03-合并任务的结果.iml" filepath="$PROJECT_DIR$/05-03-合并任务的结果/05-03-合并任务的结果.iml" />
<module fileurl="file://$PROJECT_DIR$/05-04-异步运行任务/05-04-异步运行任务.iml" filepath="$PROJECT_DIR$/05-04-异步运行任务/05-04-异步运行任务.iml" />
<module fileurl="file://$PROJECT_DIR$/05-05-在任务中抛出异常/05-05-在任务中抛出异常.iml" filepath="$PROJECT_DIR$/05-05-在任务中抛出异常/05-05-在任务中抛出异常.iml" />
<module fileurl="file://$PROJECT_DIR$/05-06-取消任务/05-06-取消任务.iml" filepath="$PROJECT_DIR$/05-06-取消任务/05-06-取消任务.iml" />
<module fileurl="file://$PROJECT_DIR$/06-02-使用非阻塞式线程安全列表/06-02-使用非阻塞式线程安全列表.iml" filepath="$PROJECT_DIR$/06-02-使用非阻塞式线程安全列表/06-02-使用非阻塞式线程安全列表.iml" />
<module fileurl="file://$PROJECT_DIR$/06-03-使用阻塞式线程安全列表/06-03-使用阻塞式线程安全列表.iml" filepath="$PROJECT_DIR$/06-03-使用阻塞式线程安全列表/06-03-使用阻塞式线程安全列表.iml" />
<module fileurl="file://$PROJECT_DIR$/06-04-使用按优先级排序的阻塞式线程安全列表/06-04-使用按优先级排序的阻塞式线程安全列表.iml" filepath="$PROJECT_DIR$/06-04-使用按优先级排序的阻塞式线程安全列表/06-04-使用按优先级排序的阻塞式线程安全列表.iml" />
<module fileurl="file://$PROJECT_DIR$/06-05-使用带有延迟元素的线程安全列表/06-05-使用带有延迟元素的线程安全列表.iml" filepath="$PROJECT_DIR$/06-05-使用带有延迟元素的线程安全列表/06-05-使用带有延迟元素的线程安全列表.iml" />
<module fileurl="file://$PROJECT_DIR$/06-06-使用线程安全可遍历映射/06-06-使用线程安全可遍历映射.iml" filepath="$PROJECT_DIR$/06-06-使用线程安全可遍历映射/06-06-使用线程安全可遍历映射.iml" />
<module fileurl="file://$PROJECT_DIR$/06-07-生成并发随机数/06-07-生成并发随机数.iml" filepath="$PROJECT_DIR$/06-07-生成并发随机数/06-07-生成并发随机数.iml" />
<module fileurl="file://$PROJECT_DIR$/06-08-使用原子变量/06-08-使用原子变量.iml" filepath="$PROJECT_DIR$/06-08-使用原子变量/06-08-使用原子变量.iml" />
<module fileurl="file://$PROJECT_DIR$/06-09-使用原子数组/06-09-使用原子数组.iml" filepath="$PROJECT_DIR$/06-09-使用原子数组/06-09-使用原子数组.iml" />
<module fileurl="file://$PROJECT_DIR$/07-02-定制ThreadPoolExecutor类/07-02-定制ThreadPoolExecutor类.iml" filepath="$PROJECT_DIR$/07-02-定制ThreadPoolExecutor类/07-02-定制ThreadPoolExecutor类.iml" />
<module fileurl="file://$PROJECT_DIR$/07-03-基于优先级的Executor类/07-03-基于优先级的Executor类.iml" filepath="$PROJECT_DIR$/07-03-基于优先级的Executor类/07-03-基于优先级的Executor类.iml" />
<module fileurl="file://$PROJECT_DIR$/07-04-实现ThreadFactory接口生成定制线程/07-04-实现ThreadFactory接口生成定制线程.iml" filepath="$PROJECT_DIR$/07-04-实现ThreadFactory接口生成定制线程/07-04-实现ThreadFactory接口生成定制线程.iml" />
<module fileurl="file://$PROJECT_DIR$/07-05-在Executro对象中使用ThreadFactory/07-05-在Executro对象中使用ThreadFactory.iml" filepath="$PROJECT_DIR$/07-05-在Executro对象中使用ThreadFactory/07-05-在Executro对象中使用ThreadFactory.iml" />
<module fileurl="file://$PROJECT_DIR$/07-06-定制运行在线程池中的任务/07-06-定制运行在线程池中的任务.iml" filepath="$PROJECT_DIR$/07-06-定制运行在线程池中的任务/07-06-定制运行在线程池中的任务.iml" />
<module fileurl="file://$PROJECT_DIR$/07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程.iml" filepath="$PROJECT_DIR$/07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程.iml" />
<module fileurl="file://$PROJECT_DIR$/07-08-定制运行在Fork-Join框架中的任务/07-08-定制运行在Fork-Join框架中的任务.iml" filepath="$PROJECT_DIR$/07-08-定制运行在Fork-Join框架中的任务/07-08-定制运行在Fork-Join框架中的任务.iml" />
<module fileurl="file://$PROJECT_DIR$/07-09-现实定制Lock类/07-09-现实定制Lock类.iml" filepath="$PROJECT_DIR$/07-09-现实定制Lock类/07-09-现实定制Lock类.iml" />
<module fileurl="file://$PROJECT_DIR$/07-10-实现基于优先级的传输队列/07-10-实现基于优先级的传输队列.iml" filepath="$PROJECT_DIR$/07-10-实现基于优先级的传输队列/07-10-实现基于优先级的传输队列.iml" />
<module fileurl="file://$PROJECT_DIR$/07-11-实现自己的原子对象/07-11-实现自己的原子对象.iml" filepath="$PROJECT_DIR$/07-11-实现自己的原子对象/07-11-实现自己的原子对象.iml" />
<module fileurl="file://$PROJECT_DIR$/Template/Template.iml" filepath="$PROJECT_DIR$/Template/Template.iml" />
</modules>
</component>
</project>
================================================
FILE: .idea/scopes/scope_settings.xml
================================================
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
================================================
FILE: .idea/uiDesigner.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
================================================
FILE: 01-02-线程的创建和运行/01-02-线程的创建和运行.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-02-线程的创建和运行/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.Calculator;
public class Main {
public static void main(String[] args) {
// 创建一个执行10次的循环。在每次循环中创建一个Calculator 对象,
// 一个Thread对象,这个Thread对象使用刚创建的Calculator对象作为构造器的参数,
// 然后调用刚创建的Thread对象的start()方法。
for (int i = 0; i <= 10; i++) {
Calculator calculator = new Calculator(i);
Thread thread = new Thread(calculator);
thread.start();
}
}
}
================================================
FILE: 01-02-线程的创建和运行/src/com/concurrency/task/Calculator.java
================================================
package com.concurrency.task;
// 创建一个名为Calculator的类,它实现了 Runnable接口
public class Calculator implements Runnable {
// 声明一个名为number的私有(private) int属性
private int number;
// 编写这个类的一个构造器,用来为属性number设置值。
public Calculator(int number) {
this.number = number;
}
// run方法。这个方法用来执行我们创建的线程的指令,它将对指定的数字进行乘法表运算。
@Override
public void run() {
for (int i = 1; i <= 10; i++) {
System.out.printf("%s: %d * %d = %d\n", Thread.currentThread().getName(), number, i, number * i);
}
}
}
================================================
FILE: 01-03-线程信息的获取和设置/01-03-线程信息的获取和设置.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-03-线程信息的获取和设置/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.Calculator;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;
public class Main {
public static void main(String[] args) {
// 线程优先级信息
System.out.printf("Minimum Priority: %s\n", Thread.MIN_PRIORITY);
System.out.printf("Normal Priority: %s\n", Thread.NORM_PRIORITY);
System.out.printf("Maximum Priority: %s\n", Thread.MAX_PRIORITY);
Thread threads[];
Thread.State status[];
// 运行10个线程,5个线程的使用最高优先级,5个线程使用最低优先级
threads = new Thread[10];
status = new Thread.State[10];
for (int i = 0; i < 10; i++) {
threads[i] = new Thread(new Calculator(i));
if (i % 2 == 0) {
threads[i].setPriority(Thread.MAX_PRIORITY);
} else {
threads[i].setPriority(Thread.MIN_PRIORITY);
}
threads[i].setName("Thread " + i);
}
// 等待线程完成,同时将线程状态信息写入到文件中
PrintWriter pw = null;
try {
// 获取项目运行的根路径
String configFile = Main.class.getClassLoader().getResource("").getPath();
configFile = URLDecoder.decode(configFile, "utf-8");
System.out.println(configFile);
File logFile = new File(configFile + "/data/log.txt"); // 创建一个记录文件对象
if(!logFile.getParentFile().exists()) { // 如果目录不存在就创建目录
logFile.getParentFile().mkdirs();
}
if (!logFile.exists()) { //如果文件不存在就创建一个文件
logFile.createNewFile();
}
FileWriter file = new FileWriter(logFile);
pw = new PrintWriter(file);
for (int i = 0; i < 10; i++) {
pw.println("Main : Status of Thread " + i + " : " + threads[i].getState());
status[i] = threads[i].getState();
}
for (int i = 0; i < 10; i++) {
threads[i].start();
}
boolean finish = false;
while (!finish) {
for (int i = 0; i < 10; i++) {
if (threads[i].getState() != status[i]) { // 如果线程状态发生了变化
writeThreadInfo(pw, threads[i], status[i]); // 将线程变化之前的状态写入文件
status[i] = threads[i].getState(); // 记录新的状态
}
}
finish = true;
for (int i = 0; i < 10; i++) {
// 如果所有线程都终止了finish就为true
finish = finish && (threads[i].getState() == Thread.State.TERMINATED);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (pw != null) {
pw.close();
}
}
}
/**
* 将线程状态信息写入到一个文件中
*
* @param pw 写数据的流
* @param thread 信息要被写入文件的线程
* @param state 线程的前一个状态
*/
private static void writeThreadInfo(PrintWriter pw, Thread thread, Thread.State state) {
pw.printf("Main : Id %d ---- %s\n", thread.getId(), thread.getName());
pw.printf("Main : Priority: %d\n", thread.getPriority());
pw.printf("Main : Old State: %s\n", state);
pw.printf("Main : New State: %s\n", thread.getState());
pw.printf("Main : ************************************\n");
}
}
================================================
FILE: 01-03-线程信息的获取和设置/src/com/concurrency/task/Calculator.java
================================================
package com.concurrency.task;
public class Calculator implements Runnable{
private int number;
public Calculator(int number) {
this.number = number;
}
@Override
public void run() {
// 指定的数字进行乘法表运算。
for (int i = 1; i <= 10; i++) {
System.out.printf("%s: %d * %d = %d\n", Thread.currentThread().getName(), number, i, number * i);
}
}
}
================================================
FILE: 01-04-线程的中断/01-04-线程的中断.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-04-线程的中断/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.PrimeGenerator;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
Thread task = new PrimeGenerator();
task.start(); // 启动质数生成线程
try {
TimeUnit.SECONDS.sleep(5); // 主线程休眠5s
} catch (InterruptedException e) {
e.printStackTrace();
}
task.interrupt(); // 质数生成线程中断
}
}
================================================
FILE: 01-04-线程的中断/src/com/concurrency/task/PrimeGenerator.java
================================================
package com.concurrency.task;
public class PrimeGenerator extends Thread {
@Override
public void run() {
long number = 1L;
while (true) {
// 对每个数字,计算它是不是一个质数,如果是的话就打印到控制台。
if (isPrime(number)) {
System.out.printf("Number %d is Prime\n", number);
}
// 当被中断时,输出一条消息,并且退出方法
if (isInterrupted()) {
System.out.printf("The Prime Generator has been Interrupted\n");
return;
}
number++;
}
}
/**
* 判断一个数是否是质数
*
* @param number 待判断的数
* @return true是质数,false不是质数
*/
private boolean isPrime(long number) {
if (number <= 2) {
return true;
}
for (long i = 2; i < number; i++) {
if (number % i == 0) {
return false;
}
}
return true;
}
}
================================================
FILE: 01-05-线程中断的控制/01-05-线程中断的控制.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-05-线程中断的控制/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.FileSearch;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
// 创建一个运行对象和一个运行它的线程
FileSearch searcher = new FileSearch("C:/", "readme.txt");
Thread thread = new Thread(searcher);
thread.start(); // 启动线程
try {
TimeUnit.SECONDS.sleep(10); // 主线程休眠10s
} catch (InterruptedException e) {
e.printStackTrace();
}
thread.interrupt(); // 中断线程
}
}
================================================
FILE: 01-05-线程中断的控制/src/com/concurrency/task/FileSearch.java
================================================
package com.concurrency.task;
import java.io.File;
// 文件搜索类,给定一个文件目录,搜索其中指定的文件
public class FileSearch implements Runnable {
/**
* 搜索的初始路径
*/
private String initPath;
/**
* 要搜索的文件名
*/
private String fileName;
/**
* 构造函数
*
* @param initPath 搜索的初始路径
* @param fileName 要搜索的文件名
*/
public FileSearch(String initPath, String fileName) {
this.initPath = initPath;
this.fileName = fileName;
}
@Override
public void run() {
}
/**
* 清空资源,在本例中为空
*/
private void cleanResources() {
// 不需要做什么
}
/**
* 处理目录
*
* @param file 待处理的目录
* @throws InterruptedException 线程被中断时抛出异常
*/
private void directoryProcess(File file) throws InterruptedException {
File[] list = file.listFiles(); // 获取当目录中的所有文件
if (list != null) { // 如果当前目录下有文件
for (int i = 0; i < list.length; i++) { // 遍布所有文件
if (list[i].isDirectory()) { // 如果是一个目录
directoryProcess(list[i]); // 递归处理
} else {
fileProcess(list[i]); // 如果是一个文件,调用文件处理方法
}
}
}
}
/**
* 文件处理方法
*
* @param file 待处理的文件名
* @throws InterruptedException 线程被中断时抛出异常
*/
private void fileProcess(File file) throws InterruptedException {
if (file.getName().equals(this.fileName)) { // 当前文件名与要查找的文件同名,就输出信息
System.out.printf("%s : %s\n", Thread.currentThread().getName(), file.getAbsolutePath());
}
if (Thread.interrupted()) { // 程序被中断就抛出异常
throw new InterruptedException();
}
}
}
================================================
FILE: 01-06-线程的休眠和恢复/01-06-线程的休眠和恢复.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-06-线程的休眠和恢复/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.FileClock;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
// 创建一个文件时间运行对象,并且将其放入一个线程对象中
FileClock clock = new FileClock();
Thread thread = new Thread(clock);
// 开始线程
thread.start();
try {
// 等待五秒
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 中断线程
thread.interrupt();
}
}
================================================
FILE: 01-06-线程的休眠和恢复/src/com/concurrency/task/FileClock.java
================================================
package com.concurrency.task;
import java.util.Date;
import java.util.concurrent.TimeUnit;
// 文件定时类,每隔一秒钟将实际的时间输出
public class FileClock implements Runnable {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.printf("%s\n", new Date());
try {
// 休眠一秒
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
// 当线程被中断时,释放或者关闭线程正在使用的资源。
System.out.printf("The FileClock has been interrupted");
return; // 发生异常就跳出
}
}
}
}
================================================
FILE: 01-07-等待线程的终止/01-07-等待线程的终止.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-07-等待线程的终止/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.DataSourcesLoader;
import com.concurrency.task.NetworkConnectionsLoader;
import java.util.Date;
public class Main {
public static void main(String[] args) {
// 创建并启动数据源加载器
DataSourcesLoader dsLoader = new DataSourcesLoader();
Thread thread1 = new Thread(dsLoader, "DataSourceThread");
thread1.start();
// 创建并且启动网络连接加载器
NetworkConnectionsLoader ncLoader = new NetworkConnectionsLoader();
Thread thread2 = new Thread(ncLoader, "NetworkConnectionLoader");
thread2.start();
// 待待两个线程的任务完成
try {
thread1.join();
thread2.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
// 两个任务都完成后输出一条消息
System.out.printf("Main: Configuration has been loaded: %s\n", new Date());
}
}
================================================
FILE: 01-07-等待线程的终止/src/com/concurrency/task/DataSourcesLoader.java
================================================
package com.concurrency.task;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 数据源加载器,模拟数据加载,它会休眠10s
*/
public class DataSourcesLoader implements Runnable {
@Override
public void run() {
// 输出一条消息
System.out.printf("Beginning data sources loading: %s\n",new Date());
// 休眠10s
try {
TimeUnit.SECONDS.sleep(4);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 输出一条消息
System.out.printf("Data sources loading has finished: %s\n",new Date());
}
}
================================================
FILE: 01-07-等待线程的终止/src/com/concurrency/task/NetworkConnectionsLoader.java
================================================
package com.concurrency.task;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 网络连接加载器,模拟网络连接,它会休眠6s
*/
public class NetworkConnectionsLoader implements Runnable {
@Override
public void run() {
// 输出一条消息
System.out.printf("Begining network connections loading: %s\n",new Date());
// 休眠6s
try {
TimeUnit.SECONDS.sleep(6);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 输出一条消息
System.out.printf("Network connections loading has finished: %s\n",new Date());
}
}
================================================
FILE: 01-08-守护线程的创建和运行/01-08-守护线程的创建和运行.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.event.Event;
import com.concurrency.task.CleanerTask;
import com.concurrency.task.WriterTask;
import java.util.ArrayDeque;
import java.util.Deque;
public class Main {
public static void main(String[] args) {
// 创建一个用于存放事件对象的队列
Deque<Event> deque = new ArrayDeque<Event>();
// 创建一个写任务的对象,并且创建三个线程去调用这个对象
WriterTask writer = new WriterTask(deque);
for (int i = 0; i < 3; i++) {
Thread thread = new Thread(writer);
thread.start();
}
// 创建一个事件清除任务,并且启动这个任务
CleanerTask cleaner = new CleanerTask(deque);
cleaner.start();
}
}
================================================
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/event/Event.java
================================================
package com.concurrency.event;
import java.util.Date;
/**
* 事件类,存储事件信息
*/
public class Event {
/**
* 事件日期
*/
private Date date;
/**
* 事件信息
*/
private String event;
/**
* 获取事件日期
*
* @return 事件日期
*/
public Date getDate() {
return date;
}
/**
* 设置事件日期
*
* @param date 事件日期
*/
public void setDate(Date date) {
this.date = date;
}
/**
* 获取事件信息
*
* @return 事件信息
*/
public String getEvent() {
return event;
}
/**
* 设置事件信息
*
* @param event 事件信息
*/
public void setEvent(String event) {
this.event = event;
}
}
================================================
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/task/CleanerTask.java
================================================
package com.concurrency.task;
import com.concurrency.event.Event;
import java.util.Date;
import java.util.Deque;
/**
* 事件清除类,每隔10秒从队尾取出一个事件,并且删除这个事件
*/
public class CleanerTask extends Thread {
/**
* 用于存储事件对象的队列
*/
Deque<Event> deque;
/**
* 构造函数
*
* @param deque 存储事件对象的队列
*/
public CleanerTask(Deque<Event> deque) {
this.deque = deque;
setDaemon(true); // 表明当前对象是一个精灵线程
}
@Override
public void run() {
while (true) {
Date date = new Date();
clean(date);
}
}
/**
* 清除方法,生存时间长于10秒的事件进行清除
* @param date 当前时间
*/
private void clean(Date date) {
long difference;
boolean delete;
if (this.deque.size() == 0) {
return;
}
delete = false;
do {
Event e = this.deque.getLast();
difference = date.getTime() - e.getDate().getTime(); // 计算最早的事件距离现在的时间
if (difference > 10000) { // 大于10秒就输出信息,并且删除最先发生的事件
System.out.printf("Cleaner: %s\n", e.getEvent());
deque.removeLast();
delete = true;
}
} while (difference > 10000);
if (delete) { // 有删除就输出删除后队列的大小
System.out.printf("Cleaner: Size of the queue: %d\n", deque.size());
}
}
}
================================================
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/task/WriterTask.java
================================================
package com.concurrency.task;
import com.concurrency.event.Event;
import java.util.Date;
import java.util.Deque;
import java.util.concurrent.TimeUnit;
/**
* 写事件的类,每一秒钟产生一个事件对象
*/
public class WriterTask implements Runnable {
/**
* 用于存储事件对象的队列
*/
Deque<Event> deque;
/**
* 构造函数
*
* @param deque 存储事件对象的队列
*/
public WriterTask(Deque<Event> deque) {
this.deque = deque;
}
@Override
public void run() {
// 产生100个事件对象
for (int i = 1; i < 100; i++) {
// 创建和初始化事件对象
Event event = new Event();
event.setDate(new Date());
event.setEvent(String.format("The thread %s has generated an event", Thread.currentThread().getId()));
// 将事件添加对队列头部
deque.addFirst(event);
try {
// 休眠一秒种
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
================================================
FILE: 01-09-线程中不可控异常的处理/01-09-线程中不可控异常的处理.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.handler.ExceptionHandler;
import com.concurrency.task.Task;
public class Main {
public static void main(String[] args) {
Task task = new Task(); // 创建一个任务
Thread thread = new Thread(task); // 创建一个线程
thread.setUncaughtExceptionHandler(new ExceptionHandler()); // 设置线程的异常处理器
thread.start();
try {
thread.join(); // 等待线程完成
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.printf("Thread has finished\n");
}
}
================================================
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/handler/ExceptionHandler.java
================================================
package com.concurrency.handler;
/**
* 异常处理类,处理线程中抛出的未捕获的异常
*/
public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
/**
* 处理线程中抛出的未捕获的异常
* @param t 招聘异常的线程
* @param e 抛出的异常
*/
@Override
public void uncaughtException(Thread t, Throwable e) {
System.out.printf("An exception has been captured\n");
System.out.printf("Thread: %s\n", t.getId());
System.out.printf("Exception: %s: %s\n", e.getClass().getName(), e.getMessage());
System.out.printf("Stack Trace: \n");
e.printStackTrace(System.out);
System.out.printf("Thread status: %s\n", t.getState());
}
}
================================================
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/task/Task.java
================================================
package com.concurrency.task;
/**
* 任务类,专门抛出异常
*/
public class Task implements Runnable {
@Override
public void run() {
// 下面的语句会招聘异常
int number = Integer.parseInt("TTT");
}
}
================================================
FILE: 01-10-线程局部变量的使用/01-10-线程局部变量的使用.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-10-线程局部变量的使用/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.UnsafeTask;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
// 创建线程不安全的任务
UnsafeTask task = new UnsafeTask();
// 将任务入进三个不同的线程中
for (int i = 0; i < 3; i++) {
Thread thread = new Thread(task);
thread.start();
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
================================================
FILE: 01-10-线程局部变量的使用/src/com/concurrency/core/SafeMain.java
================================================
package com.concurrency.core;
import com.concurrency.task.SafeTask;
import java.util.concurrent.TimeUnit;
public class SafeMain {
public static void main(String[] args) {
// 创建一个任务
SafeTask task = new SafeTask();
// 将任务放入三个不同的线程中运行
for (int i = 0; i < 3; i++) {
Thread thread = new Thread(task);
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
thread.start();
}
}
}
================================================
FILE: 01-10-线程局部变量的使用/src/com/concurrency/task/SafeTask.java
================================================
package com.concurrency.task;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class SafeTask implements Runnable {
/**
* 线程局部变量,其中的内容不能共享,线程被初始化时会创建其包含的变量
*/
private static ThreadLocal<Date> startDate = new ThreadLocal<Date>() {
@Override
protected Date initialValue() {
return new Date();
}
};
@Override
public void run() {
System.out.printf("Starting Thread: %s : %s\n", Thread.currentThread().getId(), startDate.get());
try {
TimeUnit.SECONDS.sleep((int) Math.rint(Math.random() * 10));
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.printf("Thread Finished: %s : %s\n", Thread.currentThread().getId(), startDate.get());
}
}
================================================
FILE: 01-10-线程局部变量的使用/src/com/concurrency/task/UnsafeTask.java
================================================
package com.concurrency.task;
import java.sql.Time;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 线程不安全的任务,当这个任务在多个线程中时,其中的变量会被多个线程其享
*/
public class UnsafeTask implements Runnable {
/**
* 日期对象,被所有线程共享
*/
private Date startDate;
@Override
public void run() {
this.startDate = new Date();
System.out.printf("Starting Thread: %s : %s\n", Thread.currentThread().getId(), startDate);
try {
TimeUnit.SECONDS.sleep((int) Math.rint(Math.random() * 10));
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.printf("Thread Finished: %s : %s\n", Thread.currentThread().getId(), startDate);
}
}
================================================
FILE: 01-11-线程分组/01-11-线程分组.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-11-线程分组/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.task.Result;
import com.concurrency.task.SearchTask;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
// 创建一个线程组
ThreadGroup threadGroup = new ThreadGroup("Searcher");
// 创建一个结果对象
Result result = new Result();
// 创建一个搜索任务,并且创建5个线程去运行这个任务
SearchTask searchTask = new SearchTask(result);
for (int i = 0; i < 5; i++) {
Thread thread = new Thread(threadGroup, searchTask);
thread.start();
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// 输出线程组的信息
System.out.printf("Number of Threads: %d\n", threadGroup.activeCount());
System.out.printf("Information about the Thread Group\n");
threadGroup.list(); // 将有关此线程组的信息打印到标准输出。
Thread[] threads = new Thread[threadGroup.activeCount()]; // 返回此线程组中活动线程的估计数。
threadGroup.enumerate(threads); // 把此线程组及其子组中的所有活动线程复制到指定数组中。
for (int i = 0; i < threadGroup.activeCount(); i++) {
System.out.printf("Thread %s: %s\n", threads[i].getName(), threads[i].getState());
}
// 等待线程结束
waitFinish(threadGroup);
// 中断线程组中的所有线程
threadGroup.interrupt();
}
/**
* 等待线程组中的一个线程结束
*
* @param threadGroup 线程组
*/
private static void waitFinish(ThreadGroup threadGroup) {
while (threadGroup.activeCount() > 9) { // 如果线程组中的活动线程数大于9个,当前调用线程就休眠1秒,直到线程数小于9个
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
================================================
FILE: 01-11-线程分组/src/com/concurrency/task/Result.java
================================================
package com.concurrency.task;
/**
* 结果类用于存储搜索结果
*/
public class Result {
/**
* 完成任务的线程名
*/
private String name;
/**
* 获取完成任务的线程名
* @return 完成任务的线程名
*/
public String getName() {
return name;
}
/**
* 设置完成任务的线程名
* @param name 完成任务的线程名
*/
public void setName(String name) {
this.name = name;
}
}
================================================
FILE: 01-11-线程分组/src/com/concurrency/task/SearchTask.java
================================================
package com.concurrency.task;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class SearchTask implements Runnable {
/**
* 如果线程完成了任务,并且没有中断,就存储线程的名字。
*/
private Result result;
/**
* 构造函数
*
* @param result 结果对象
*/
public SearchTask(Result result) {
this.result = result;
}
@Override
public void run() {
String name = Thread.currentThread().getName();
System.out.printf("Thread %s: Start\n", name);
try {
doTask();
result.setName(name);
} catch (InterruptedException e) {
System.out.printf("Thread %s: Interrupted\n", name);
return;
}
System.out.printf("Thread %s: End\n", name);
}
/**
* 模拟搜索操作
*
* @throws InterruptedException 中断异常
*/
private void doTask() throws InterruptedException {
Random random = new Random((new Date()).getTime());
int value = (int) (random.nextDouble() * 100);
System.out.printf("Thread %s: %d\n", Thread.currentThread().getName(), value);
TimeUnit.SECONDS.sleep(value);
}
}
================================================
FILE: 01-12-线程组中不可控制异常的处理/01-12-线程组中不可控制异常的处理.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module>
================================================
FILE: 01-12-线程组中不可控制异常的处理/src/com/concurrency/core/Main.java
================================================
package com.concurrency.core;
import com.concurrency.group.MyThreadGroup;
import com.concurrency.task.Task;
public class Main {
public static void main(String[] args) {
// 创建一个自定义的线程组
MyThreadGroup threadGroup = new MyThreadGroup("MyThreadGroup");
// 创建一个任务
Task task = new Task();
// 创建两个线程,将其放入同一个线程组中,并且执行同一个任务
for (int i = 0; i < 2; i++) {
Thread t = new Thread(threadGroup, task);
t.start();
}
}
}
================================================
FILE: 01-12-线程组中不可控制异常的处理/src/com/concurrency/group/MyThreadGroup.java
================================================
package com.concurrency.group;
public class MyThreadGroup extends ThreadGroup {
/**
* 构造函数
*
* @param name 线程组名称
*/
public MyThreadGroup(String name) {
super(name);
}
/**
* 重写未捕获的异常方法
*
* @param t 抛出异常的信息
* @param e 抛出的异常
*/
@Override
public void uncaughtException(Thread t, Throwable e) {
// 打印线程的名称
System.out.printf("The thread %s has thrown an Exception\n", t.getId());
// 输出异常栈信息
e.printStackTrace(System.out);
// 中断线程组中其余的线程
System.out.printf("Terminating the rest of the Threads\n");
gitextract_yapqjxir/
├── .idea/
│ ├── .name
│ ├── codeStyleSettings.xml
│ ├── compiler.xml
│ ├── copyright/
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── findbugs-idea.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── scopes/
│ │ └── scope_settings.xml
│ ├── uiDesigner.xml
│ └── vcs.xml
├── 01-02-线程的创建和运行/
│ ├── 01-02-线程的创建和运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Calculator.java
├── 01-03-线程信息的获取和设置/
│ ├── 01-03-线程信息的获取和设置.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Calculator.java
├── 01-04-线程的中断/
│ ├── 01-04-线程的中断.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── PrimeGenerator.java
├── 01-05-线程中断的控制/
│ ├── 01-05-线程中断的控制.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileSearch.java
├── 01-06-线程的休眠和恢复/
│ ├── 01-06-线程的休眠和恢复.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileClock.java
├── 01-07-等待线程的终止/
│ ├── 01-07-等待线程的终止.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── DataSourcesLoader.java
│ └── NetworkConnectionsLoader.java
├── 01-08-守护线程的创建和运行/
│ ├── 01-08-守护线程的创建和运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── event/
│ │ └── Event.java
│ └── task/
│ ├── CleanerTask.java
│ └── WriterTask.java
├── 01-09-线程中不可控异常的处理/
│ ├── 01-09-线程中不可控异常的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── handler/
│ │ └── ExceptionHandler.java
│ └── task/
│ └── Task.java
├── 01-10-线程局部变量的使用/
│ ├── 01-10-线程局部变量的使用.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ ├── Main.java
│ │ └── SafeMain.java
│ └── task/
│ ├── SafeTask.java
│ └── UnsafeTask.java
├── 01-11-线程分组/
│ ├── 01-11-线程分组.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Result.java
│ └── SearchTask.java
├── 01-12-线程组中不可控制异常的处理/
│ ├── 01-12-线程组中不可控制异常的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── group/
│ │ └── MyThreadGroup.java
│ └── task/
│ └── Task.java
├── 01-13-使用工厂类创建线程/
│ ├── 01-13-使用工厂类创建线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── factory/
│ │ └── MyThreadFactory.java
│ └── task/
│ └── Task.java
├── 02-02-使用synchronized实现同步方法-问题/
│ ├── 02-02-使用synchronized实现同步方法-问题.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 02-02-使用synchronized实现同步方法-问题解决/
│ ├── 02-02-使用synchronized实现同步方法-问题解决.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 02-03-使用非依赖属性实现同步/
│ ├── 02-03-使用非依赖属性实现同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Cinema.java
│ ├── TicketOffice1.java
│ └── TicketOffice2.java
├── 02-04-在同步代码中使用条件/
│ ├── 02-04-在同步代码中使用条件.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ ├── EventStorage.java
│ └── Producer.java
├── 02-05-用锁实现同步/
│ ├── 02-05-用锁实现同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 02-06-使用读写锁实现同步数据访问/
│ ├── 02-06-使用读写锁实现同步数据访问.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── PricesInfo.java
│ ├── Reader.java
│ └── Writer.java
├── 02-07-修改锁的公平性/
│ ├── 02-07-修改锁的公平性.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 02-08-在锁中使用多条件/
│ ├── 02-08-在锁中使用多条件.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── Consumer.java
│ │ └── Producer.java
│ └── utils/
│ ├── Buffer.java
│ └── FileMock.java
├── 02-09-应用例子/
│ ├── 02-09-应用例子.iml
│ └── src/
│ └── com.concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── BuildStats.java
│ ├── Sensor1.java
│ └── Sensor2.java
├── 03-02-资源并发控制访问/
│ ├── 03-02-资源并发控制访问.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 03-03-资源的多副本的并发访问控制/
│ ├── 03-03-资源的多副本的并发访问控制.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Job.java
│ └── PrintQueue.java
├── 03-04-等待多个并发事件的完成/
│ ├── 03-04-等待多个并发事件的完成.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Participant.java
│ └── VideoConference.java
├── 03-05-在集合点的同步/
│ ├── 03-05-在集合点的同步.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── Grouper.java
│ │ └── Searcher.java
│ └── utils/
│ ├── MatrixMock.java
│ └── Results.java
├── 03-06-并发阶段任务的运行/
│ ├── 03-06-并发阶段任务的运行.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FileSearch.java
├── 03-07-并发阶段任务中的阶段切换/
│ ├── 03-07-并发阶段任务中的阶段切换.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyPhaser.java
│ └── Student.java
├── 03-08-并发任务间的数据交换/
│ ├── 03-08-并发任务间的数据交换.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ └── Producer.java
├── 04-02-创建线程执行器/
│ ├── 04-02-创建线程执行器.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Server.java
│ └── Task.java
├── 04-03-创建固定大小的线程执行器/
│ ├── 04-03-创建固定大小的线程执行器.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Server.java
│ └── Task.java
├── 04-04-在执行器中执行任务并返回结果/
│ ├── 04-04-在执行器中执行任务并返回结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FactorialCalculator.java
├── 04-05-运行多个任务并处理第一个结果/
│ ├── 04-05-运行多个任务并处理第一个结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── TaskValidator.java
│ └── UserValidator.java
├── 04-06-运行多个任务并且处理所有结果/
│ ├── 04-06-运行多个任务并且处理所有结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Result.java
│ └── Task.java
├── 04-07-在执行器中延时执行任务/
│ ├── 04-07-在执行器中延时执行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-08-在执行器中周期性执行任务/
│ ├── 04-08-在执行器中周期性执行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-09-在执行器中取消任务/
│ ├── 04-09-在执行器中取消任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 04-10-在执行器中控制任务的完成/
│ ├── 04-10-在执行器中控制任务的完成.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ExecutableTask.java
│ └── ResultTask.java
├── 04-11-在执行器中分离任务的启动与结果的处理/
│ ├── 04-11-在执行器中分离任务的启动与结果的处理.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ReportGenerator.java
│ ├── ReportProcessor.java
│ └── ReportRequest.java
├── 04-12-处理在执行器中被拒绝的任务/
│ ├── 04-12-处理在执行器中被拒绝的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── RejectedTaskController.java
│ └── Task.java
├── 05-02-创建Fork-Join线程池/
│ ├── 05-02-创建Fork-Join线程池.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── Task.java
│ └── utils/
│ ├── Product.java
│ └── ProductListGenerator.java
├── 05-03-合并任务的结果/
│ ├── 05-03-合并任务的结果.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ ├── DocumentTask.java
│ │ └── LineTask.java
│ └── utils/
│ └── DocumentMock.java
├── 05-04-异步运行任务/
│ ├── 05-04-异步运行任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── FolderProcessor.java
├── 05-05-在任务中抛出异常/
│ ├── 05-05-在任务中抛出异常.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Task.java
├── 05-06-取消任务/
│ ├── 05-06-取消任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── TaskManager.java
│ └── utils/
│ ├── ArrayGenerator.java
│ └── SearchNumberTask.java
├── 06-02-使用非阻塞式线程安全列表/
│ ├── 06-02-使用非阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── AddTask.java
│ └── PollTask.java
├── 06-03-使用阻塞式线程安全列表/
│ ├── 06-03-使用阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── Client.java
├── 06-04-使用按优先级排序的阻塞式线程安全列表/
│ ├── 06-04-使用按优先级排序的阻塞式线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Event.java
│ └── Task.java
├── 06-05-使用带有延迟元素的线程安全列表/
│ ├── 06-05-使用带有延迟元素的线程安全列表.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Event.java
│ └── Task.java
├── 06-06-使用线程安全可遍历映射/
│ ├── 06-06-使用线程安全可遍历映射.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── task/
│ │ └── Task.java
│ └── utils/
│ └── Contact.java
├── 06-07-生成并发随机数/
│ ├── 06-07-生成并发随机数.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── TaskLocalRandom.java
├── 06-08-使用原子变量/
│ ├── 06-08-使用原子变量.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Account.java
│ ├── Bank.java
│ └── Company.java
├── 06-09-使用原子数组/
│ ├── 06-09-使用原子数组.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Decrementer.java
│ └── Incrementer.java
├── 07-02-定制ThreadPoolExecutor类/
│ ├── 07-02-定制ThreadPoolExecutor类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ ├── executor/
│ │ └── MyExecutor.java
│ └── task/
│ └── SleepTwoSecondsTask.java
├── 07-03-基于优先级的Executor类/
│ ├── 07-03-基于优先级的Executor类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ └── MyPriorityTask.java
├── 07-04-实现ThreadFactory接口生成定制线程/
│ ├── 07-04-实现ThreadFactory接口生成定制线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyTask.java
│ ├── MyThread.java
│ └── MyThreadFactory.java
├── 07-05-在Executro对象中使用ThreadFactory/
│ ├── 07-05-在Executro对象中使用ThreadFactory.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyTask.java
│ ├── MyThread.java
│ └── MyThreadFactory.java
├── 07-06-定制运行在线程池中的任务/
│ ├── 07-06-定制运行在线程池中的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyScheduledTask.java
│ ├── MyScheduledThreadPoolExecutor.java
│ └── Task.java
├── 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/
│ ├── 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyRecursiveTask.java
│ ├── MyWorkerThread.java
│ └── MyWorkerThreadFactory.java
├── 07-08-定制运行在Fork-Join框架中的任务/
│ ├── 07-08-定制运行在Fork-Join框架中的任务.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyWorkerTask.java
│ └── Task.java
├── 07-09-现实定制Lock类/
│ ├── 07-09-现实定制Lock类.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── MyAbstractQueuedSynchronizer.java
│ ├── MyLock.java
│ └── Task.java
├── 07-10-实现基于优先级的传输队列/
│ ├── 07-10-实现基于优先级的传输队列.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── Consumer.java
│ ├── Event.java
│ ├── MyPriorityTransferQueue.java
│ └── Producer.java
├── 07-11-实现自己的原子对象/
│ ├── 07-11-实现自己的原子对象.iml
│ └── src/
│ └── com/
│ └── concurrency/
│ ├── core/
│ │ └── Main.java
│ └── task/
│ ├── ParkingCounter.java
│ ├── Sensor1.java
│ └── Sensor2.java
├── README.md
└── Template/
└── Template.iml
SYMBOL INDEX (618 symbols across 196 files)
FILE: 01-02-线程的创建和运行/src/com/concurrency/core/Main.java
class Main (line 5) | public class Main {
method main (line 6) | public static void main(String[] args) {
FILE: 01-02-线程的创建和运行/src/com/concurrency/task/Calculator.java
class Calculator (line 4) | public class Calculator implements Runnable {
method Calculator (line 9) | public Calculator(int number) {
method run (line 14) | @Override
FILE: 01-03-线程信息的获取和设置/src/com/concurrency/core/Main.java
class Main (line 11) | public class Main {
method main (line 12) | public static void main(String[] args) {
method writeThreadInfo (line 98) | private static void writeThreadInfo(PrintWriter pw, Thread thread, Thr...
FILE: 01-03-线程信息的获取和设置/src/com/concurrency/task/Calculator.java
class Calculator (line 3) | public class Calculator implements Runnable{
method Calculator (line 6) | public Calculator(int number) {
method run (line 10) | @Override
FILE: 01-04-线程的中断/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 01-04-线程的中断/src/com/concurrency/task/PrimeGenerator.java
class PrimeGenerator (line 3) | public class PrimeGenerator extends Thread {
method run (line 4) | @Override
method isPrime (line 29) | private boolean isPrime(long number) {
FILE: 01-05-线程中断的控制/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 01-05-线程中断的控制/src/com/concurrency/task/FileSearch.java
class FileSearch (line 6) | public class FileSearch implements Runnable {
method FileSearch (line 23) | public FileSearch(String initPath, String fileName) {
method run (line 28) | @Override
method cleanResources (line 36) | private void cleanResources() {
method directoryProcess (line 46) | private void directoryProcess(File file) throws InterruptedException {
method fileProcess (line 65) | private void fileProcess(File file) throws InterruptedException {
FILE: 01-06-线程的休眠和恢复/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 01-06-线程的休眠和恢复/src/com/concurrency/task/FileClock.java
class FileClock (line 7) | public class FileClock implements Runnable {
method run (line 8) | @Override
FILE: 01-07-等待线程的终止/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 01-07-等待线程的终止/src/com/concurrency/task/DataSourcesLoader.java
class DataSourcesLoader (line 9) | public class DataSourcesLoader implements Runnable {
method run (line 10) | @Override
FILE: 01-07-等待线程的终止/src/com/concurrency/task/NetworkConnectionsLoader.java
class NetworkConnectionsLoader (line 9) | public class NetworkConnectionsLoader implements Runnable {
method run (line 10) | @Override
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/event/Event.java
class Event (line 8) | public class Event {
method getDate (line 23) | public Date getDate() {
method setDate (line 32) | public void setDate(Date date) {
method getEvent (line 41) | public String getEvent() {
method setEvent (line 50) | public void setEvent(String event) {
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/task/CleanerTask.java
class CleanerTask (line 11) | public class CleanerTask extends Thread {
method CleanerTask (line 23) | public CleanerTask(Deque<Event> deque) {
method run (line 29) | @Override
method clean (line 41) | private void clean(Date date) {
FILE: 01-08-守护线程的创建和运行/src/com/concurrency/task/WriterTask.java
class WriterTask (line 12) | public class WriterTask implements Runnable {
method WriterTask (line 23) | public WriterTask(Deque<Event> deque) {
method run (line 27) | @Override
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/handler/ExceptionHandler.java
class ExceptionHandler (line 6) | public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
method uncaughtException (line 12) | @Override
FILE: 01-09-线程中不可控异常的处理/src/com/concurrency/task/Task.java
class Task (line 6) | public class Task implements Runnable {
method run (line 7) | @Override
FILE: 01-10-线程局部变量的使用/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 01-10-线程局部变量的使用/src/com/concurrency/core/SafeMain.java
class SafeMain (line 7) | public class SafeMain {
method main (line 8) | public static void main(String[] args) {
FILE: 01-10-线程局部变量的使用/src/com/concurrency/task/SafeTask.java
class SafeTask (line 6) | public class SafeTask implements Runnable {
method initialValue (line 11) | @Override
method run (line 17) | @Override
FILE: 01-10-线程局部变量的使用/src/com/concurrency/task/UnsafeTask.java
class UnsafeTask (line 10) | public class UnsafeTask implements Runnable {
method run (line 16) | @Override
FILE: 01-11-线程分组/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
method waitFinish (line 53) | private static void waitFinish(ThreadGroup threadGroup) {
FILE: 01-11-线程分组/src/com/concurrency/task/Result.java
class Result (line 6) | public class Result {
method getName (line 16) | public String getName() {
method setName (line 24) | public void setName(String name) {
FILE: 01-11-线程分组/src/com/concurrency/task/SearchTask.java
class SearchTask (line 7) | public class SearchTask implements Runnable {
method SearchTask (line 19) | public SearchTask(Result result) {
method run (line 23) | @Override
method doTask (line 42) | private void doTask() throws InterruptedException {
FILE: 01-12-线程组中不可控制异常的处理/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 01-12-线程组中不可控制异常的处理/src/com/concurrency/group/MyThreadGroup.java
class MyThreadGroup (line 3) | public class MyThreadGroup extends ThreadGroup {
method MyThreadGroup (line 9) | public MyThreadGroup(String name) {
method uncaughtException (line 19) | @Override
FILE: 01-12-线程组中不可控制异常的处理/src/com/concurrency/task/Task.java
class Task (line 5) | public class Task implements Runnable {
method run (line 6) | @Override
FILE: 01-13-使用工厂类创建线程/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 01-13-使用工厂类创建线程/src/com/concurrency/factory/MyThreadFactory.java
class MyThreadFactory (line 12) | public class MyThreadFactory implements ThreadFactory {
method MyThreadFactory (line 23) | public MyThreadFactory(String name) {
method newThread (line 35) | @Override
method getStats (line 50) | public String getStats() {
FILE: 01-13-使用工厂类创建线程/src/com/concurrency/task/Task.java
class Task (line 5) | public class Task implements Runnable {
method run (line 6) | @Override
FILE: 02-02-使用synchronized实现同步方法-问题/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Account.java
class Account (line 6) | public class Account {
method getBalance (line 17) | public double getBalance() {
method setBalance (line 26) | public void setBalance(double balance) {
method addAccount (line 35) | public void addAccount(double amount) {
method subtractAmount (line 52) | public void subtractAmount(double amount) {
FILE: 02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Bank.java
class Bank (line 3) | public class Bank implements Runnable {
method Bank (line 14) | public Bank(Account account) {
method run (line 19) | @Override
FILE: 02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Company.java
class Company (line 3) | public class Company implements Runnable {
method Company (line 14) | public Company(Account account) {
method run (line 18) | @Override
FILE: 02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Account.java
class Account (line 6) | public class Account {
method getBalance (line 17) | public double getBalance() {
method setBalance (line 26) | public void setBalance(double balance) {
method addAccount (line 35) | public synchronized void addAccount(double amount) {
method subtractAmount (line 52) | public synchronized void subtractAmount(double amount) {
FILE: 02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Bank.java
class Bank (line 3) | public class Bank implements Runnable {
method Bank (line 14) | public Bank(Account account) {
method run (line 19) | @Override
FILE: 02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Company.java
class Company (line 3) | public class Company implements Runnable {
method Company (line 14) | public Company(Account account) {
method run (line 18) | @Override
FILE: 02-03-使用非依赖属性实现同步/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 02-03-使用非依赖属性实现同步/src/com/concurrency/task/Cinema.java
class Cinema (line 6) | public class Cinema {
method Cinema (line 24) | public Cinema() {
method sellTickets1 (line 37) | public boolean sellTickets1(int number) {
method sellTickets2 (line 54) | public boolean sellTickets2(int number) {
method returnTickets1 (line 71) | public boolean returnTickets1(int number) {
method returnTickets2 (line 84) | public boolean returnTickets2(int number) {
method getVacanciesCinema1 (line 96) | public long getVacanciesCinema1() {
method getVacanciesCinema2 (line 105) | public long getVacanciesCinema2() {
FILE: 02-03-使用非依赖属性实现同步/src/com/concurrency/task/TicketOffice1.java
class TicketOffice1 (line 6) | public class TicketOffice1 implements Runnable {
method TicketOffice1 (line 16) | public TicketOffice1(Cinema cinema) {
method run (line 20) | @Override
FILE: 02-03-使用非依赖属性实现同步/src/com/concurrency/task/TicketOffice2.java
class TicketOffice2 (line 6) | public class TicketOffice2 implements Runnable {
method TicketOffice2 (line 17) | public TicketOffice2(Cinema cinema) {
method run (line 21) | @Override
FILE: 02-04-在同步代码中使用条件/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 02-04-在同步代码中使用条件/src/com/concurrency/task/Consumer.java
class Consumer (line 6) | public class Consumer implements Runnable {
method Consumer (line 17) | public Consumer(EventStorage storage) {
method run (line 21) | @Override
FILE: 02-04-在同步代码中使用条件/src/com/concurrency/task/EventStorage.java
class EventStorage (line 10) | public class EventStorage {
method EventStorage (line 24) | public EventStorage() {
method set (line 32) | public synchronized void set() {
method get (line 49) | public synchronized void get() {
FILE: 02-04-在同步代码中使用条件/src/com/concurrency/task/Producer.java
class Producer (line 6) | public class Producer implements Runnable {
method Producer (line 17) | public Producer(EventStorage storage) {
method run (line 21) | @Override
FILE: 02-05-用锁实现同步/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 02-05-用锁实现同步/src/com/concurrency/task/Job.java
class Job (line 3) | public class Job implements Runnable {
method Job (line 14) | public Job(PrintQueue printQueue) {
method run (line 18) | @Override
FILE: 02-05-用锁实现同步/src/com/concurrency/task/PrintQueue.java
class PrintQueue (line 9) | public class PrintQueue {
method printJob (line 20) | public void printJob(Object object) {
FILE: 02-06-使用读写锁实现同步数据访问/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/PricesInfo.java
class PricesInfo (line 9) | public class PricesInfo {
method PricesInfo (line 24) | public PricesInfo() {
method getPrice1 (line 35) | public double getPrice1() {
method getPrice2 (line 47) | public double getPrice2() {
method setPrices (line 60) | public void setPrices(double price1, double price2) {
FILE: 02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/Reader.java
class Reader (line 6) | public class Reader implements Runnable {
method Reader (line 17) | public Reader(PricesInfo pricesInfo) {
method run (line 24) | @Override
FILE: 02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/Writer.java
class Writer (line 6) | public class Writer implements Runnable {
method Writer (line 17) | public Writer(PricesInfo pricesInfo) {
method run (line 24) | @Override
FILE: 02-07-修改锁的公平性/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 02-07-修改锁的公平性/src/com/concurrency/task/Job.java
class Job (line 4) | public class Job implements Runnable {
method Job (line 15) | public Job(PrintQueue printQueue) {
method run (line 19) | @Override
FILE: 02-07-修改锁的公平性/src/com/concurrency/task/PrintQueue.java
class PrintQueue (line 9) | public class PrintQueue {
method printJob (line 20) | public void printJob(Object object) {
FILE: 02-08-在锁中使用多条件/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 02-08-在锁中使用多条件/src/com/concurrency/task/Consumer.java
class Consumer (line 7) | public class Consumer implements Runnable {
method Consumer (line 18) | public Consumer(Buffer buffer) {
method run (line 25) | @Override
method processLine (line 38) | private void processLine(String line) {
FILE: 02-08-在锁中使用多条件/src/com/concurrency/task/Producer.java
class Producer (line 6) | public class Producer implements Runnable {
method Producer (line 22) | public Producer(FileMock mock, Buffer buffer) {
method run (line 30) | @Override
FILE: 02-08-在锁中使用多条件/src/com/concurrency/utils/Buffer.java
class Buffer (line 7) | public class Buffer {
method Buffer (line 38) | public Buffer(int maxSize) {
method insert (line 52) | public void insert(String line) {
method get (line 69) | public String get() {
method setPendingLines (line 97) | public void setPendingLines(boolean pendingLines) {
method hasPendingLines (line 106) | public boolean hasPendingLines() {
FILE: 02-08-在锁中使用多条件/src/com/concurrency/utils/FileMock.java
class FileMock (line 6) | public class FileMock {
method FileMock (line 22) | public FileMock(int size, int length) {
method hasMoreLines (line 40) | public boolean hasMoreLines() {
method getLine (line 49) | public String getLine() {
FILE: 02-09-应用例子/src/com.concurrency/core/Main.java
class Main (line 15) | public class Main {
method main (line 16) | public static void main(String[] args) {
FILE: 02-09-应用例子/src/com.concurrency/task/BuildStats.java
class BuildStats (line 12) | public class BuildStats {
method comeIn (line 21) | public void comeIn() {
method goOut (line 32) | public void goOut() {
method generateCard (line 43) | private void generateCard() {
method generateReport (line 54) | private void generateReport() {
method printStats (line 65) | public void printStats() {
FILE: 02-09-应用例子/src/com.concurrency/task/Sensor1.java
class Sensor1 (line 9) | public class Sensor1 implements Runnable {
method Sensor1 (line 20) | public Sensor1(BuildStats stats) {
method run (line 27) | @Override
FILE: 02-09-应用例子/src/com.concurrency/task/Sensor2.java
class Sensor2 (line 9) | public class Sensor2 implements Runnable {
method Sensor2 (line 20) | public Sensor2(BuildStats stats) {
method run (line 27) | @Override
FILE: 03-02-资源并发控制访问/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 03-02-资源并发控制访问/src/com/concurrency/task/Job.java
class Job (line 3) | public class Job implements Runnable {
method Job (line 14) | public Job(PrintQueue printQueue) {
method run (line 21) | @Override
FILE: 03-02-资源并发控制访问/src/com/concurrency/task/PrintQueue.java
class PrintQueue (line 11) | public class PrintQueue {
method PrintQueue (line 20) | public PrintQueue() {
method printJob (line 29) | public void printJob(Object document) {
FILE: 03-03-资源的多副本的并发访问控制/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 03-03-资源的多副本的并发访问控制/src/com/concurrency/task/Job.java
class Job (line 3) | public class Job implements Runnable {
method Job (line 14) | public Job(PrintQueue printQueue) {
method run (line 21) | @Override
FILE: 03-03-资源的多副本的并发访问控制/src/com/concurrency/task/PrintQueue.java
class PrintQueue (line 12) | public class PrintQueue {
method PrintQueue (line 29) | public PrintQueue() {
method printJob (line 44) | public void printJob(Object document) {
method getPrinter (line 70) | private int getPrinter() {
FILE: 03-04-等待多个并发事件的完成/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 03-04-等待多个并发事件的完成/src/com/concurrency/task/Participant.java
class Participant (line 8) | public class Participant implements Runnable {
method Participant (line 24) | public Participant(VideoConference conference, String name) {
method run (line 33) | @Override
FILE: 03-04-等待多个并发事件的完成/src/com/concurrency/task/VideoConference.java
class VideoConference (line 9) | public class VideoConference implements Runnable {
method VideoConference (line 19) | public VideoConference(int number) {
method arrive (line 27) | public void arrive(String name) {
method run (line 36) | @Override
FILE: 03-05-在集合点的同步/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 03-05-在集合点的同步/src/com/concurrency/task/Grouper.java
class Grouper (line 8) | public class Grouper implements Runnable {
method Grouper (line 19) | public Grouper(Results results) {
method run (line 26) | @Override
FILE: 03-05-在集合点的同步/src/com/concurrency/task/Searcher.java
class Searcher (line 12) | public class Searcher implements Runnable {
method Searcher (line 48) | public Searcher(CyclicBarrier barrier, int firstRow, int lastRow, Matr...
method run (line 60) | @Override
FILE: 03-05-在集合点的同步/src/com/concurrency/utils/MatrixMock.java
class MatrixMock (line 8) | public class MatrixMock {
method MatrixMock (line 21) | public MatrixMock(int size, int length, int number) {
method getRow (line 43) | public int[] getRow(int row) {
FILE: 03-05-在集合点的同步/src/com/concurrency/utils/Results.java
class Results (line 6) | public class Results {
method Results (line 17) | public Results(int size) {
method setData (line 27) | public void setData(int position, int value) {
method getData (line 36) | public int[] getData() {
FILE: 03-06-并发阶段任务的运行/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 03-06-并发阶段任务的运行/src/com/concurrency/task/FileSearch.java
class FileSearch (line 13) | public class FileSearch implements Runnable {
method FileSearch (line 38) | public FileSearch(String initPath, String end, Phaser phaser) {
method run (line 48) | @Override
method showInfo (line 84) | private void showInfo() {
method checkResults (line 99) | private boolean checkResults() {
method filterResults (line 117) | private void filterResults() {
method directoryProcess (line 136) | private void directoryProcess(File file) {
method fileProcess (line 158) | private void fileProcess(File file) {
FILE: 03-07-并发阶段任务中的阶段切换/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 03-07-并发阶段任务中的阶段切换/src/com/concurrency/task/MyPhaser.java
class MyPhaser (line 8) | public class MyPhaser extends Phaser {
method onAdvance (line 14) | @Override
method studentArrived (line 35) | private boolean studentArrived() {
method finishFirstExercise (line 46) | private boolean finishFirstExercise() {
method finishSecondExercise (line 57) | private boolean finishSecondExercise() {
method finishExam (line 68) | private boolean finishExam() {
FILE: 03-07-并发阶段任务中的阶段切换/src/com/concurrency/task/Student.java
class Student (line 10) | public class Student implements Runnable {
method Student (line 20) | public Student(Phaser phaser) {
method run (line 27) | @Override
method doExercise1 (line 51) | private void doExercise1() {
method doExercise2 (line 63) | private void doExercise2() {
method doExercise3 (line 75) | private void doExercise3() {
FILE: 03-08-并发任务间的数据交换/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 03-08-并发任务间的数据交换/src/com/concurrency/task/Consumer.java
class Consumer (line 9) | public class Consumer implements Runnable {
method Consumer (line 26) | public Consumer(Exchanger<List<String>> exchanger, List<String> buffer) {
method run (line 35) | @Override
FILE: 03-08-并发任务间的数据交换/src/com/concurrency/task/Producer.java
class Producer (line 9) | public class Producer implements Runnable {
method Producer (line 25) | public Producer(Exchanger<List<String>> exchanger, List<String> buffer) {
method run (line 35) | @Override
FILE: 04-02-创建线程执行器/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 04-02-创建线程执行器/src/com/concurrency/task/Server.java
class Server (line 9) | public class Server {
method Server (line 18) | public Server() {
method executeTask (line 27) | public void executeTask(Task task) {
method endServer (line 41) | public void endServer() {
FILE: 04-02-创建线程执行器/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task implements Runnable {
method Task (line 24) | public Task(String name) {
method run (line 32) | @Override
FILE: 04-03-创建固定大小的线程执行器/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 7) | public static void main(String[] args) {
FILE: 04-03-创建固定大小的线程执行器/src/com/concurrency/task/Server.java
class Server (line 9) | public class Server {
method Server (line 18) | public Server() {
method executeTask (line 27) | public void executeTask(Task task) {
method endServer (line 42) | public void endServer() {
FILE: 04-03-创建固定大小的线程执行器/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task implements Runnable {
method Task (line 24) | public Task(String name) {
method run (line 32) | @Override
FILE: 04-04-在执行器中执行任务并返回结果/src/com/concurrency/core/Main.java
class Main (line 13) | public class Main {
method main (line 14) | public static void main(String[] args) {
FILE: 04-04-在执行器中执行任务并返回结果/src/com/concurrency/task/FactorialCalculator.java
class FactorialCalculator (line 9) | public class FactorialCalculator implements Callable<Integer> {
method FactorialCalculator (line 19) | public FactorialCalculator(Integer number) {
method call (line 28) | @Override
FILE: 04-05-运行多个任务并处理第一个结果/src/com/concurrency/core/Main.java
class Main (line 12) | public class Main {
method main (line 13) | public static void main(String[] args) {
FILE: 04-05-运行多个任务并处理第一个结果/src/com/concurrency/task/TaskValidator.java
class TaskValidator (line 8) | public class TaskValidator implements Callable<String> {
method TaskValidator (line 29) | public TaskValidator(UserValidator validator, String user, String pass...
method call (line 41) | @Override
FILE: 04-05-运行多个任务并处理第一个结果/src/com/concurrency/task/UserValidator.java
class UserValidator (line 9) | public class UserValidator {
method UserValidator (line 20) | public UserValidator(String name) {
method validate (line 31) | public boolean validate(String name, String password) {
method getName (line 53) | public String getName() {
FILE: 04-06-运行多个任务并且处理所有结果/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 04-06-运行多个任务并且处理所有结果/src/com/concurrency/task/Result.java
class Result (line 6) | public class Result {
method getName (line 21) | public String getName() {
method setName (line 30) | public void setName(String name) {
method getValue (line 39) | public int getValue() {
method setValue (line 48) | public void setValue(int value) {
FILE: 04-06-运行多个任务并且处理所有结果/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task implements Callable<Result> {
method Task (line 20) | public Task(String name) {
method call (line 30) | @Override
FILE: 04-07-在执行器中延时执行任务/src/com/concurrency/core/Main.java
class Main (line 11) | public class Main {
method main (line 12) | public static void main(String[] args) {
FILE: 04-07-在执行器中延时执行任务/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task implements Callable<String> {
method Task (line 20) | public Task(String name) {
method call (line 30) | @Override
FILE: 04-08-在执行器中周期性执行任务/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 04-08-在执行器中周期性执行任务/src/com/concurrency/task/Task.java
class Task (line 8) | public class Task implements Runnable {
method Task (line 19) | public Task(String name) {
method run (line 26) | @Override
FILE: 04-09-在执行器中取消任务/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 04-09-在执行器中取消任务/src/com/concurrency/task/Task.java
class Task (line 5) | public class Task implements Callable<String> {
method call (line 11) | @Override
FILE: 04-10-在执行器中控制任务的完成/src/com/concurrency/core/Main.java
class Main (line 11) | public class Main {
method main (line 12) | public static void main(String[] args) {
FILE: 04-10-在执行器中控制任务的完成/src/com/concurrency/task/ExecutableTask.java
class ExecutableTask (line 9) | public class ExecutableTask implements Callable<String> {
method ExecutableTask (line 15) | public ExecutableTask(String name) {
method call (line 25) | @Override
method getName (line 42) | public String getName() {
FILE: 04-10-在执行器中控制任务的完成/src/com/concurrency/task/ResultTask.java
class ResultTask (line 9) | public class ResultTask extends FutureTask<String> {
method ResultTask (line 20) | public ResultTask(Callable<String> callable) {
method done (line 28) | @Override
FILE: 04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportGenerator.java
class ReportGenerator (line 9) | public class ReportGenerator implements Callable<String> {
method ReportGenerator (line 25) | public ReportGenerator(String sender, String title) {
method call (line 36) | @Override
FILE: 04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportProcessor.java
class ReportProcessor (line 11) | public class ReportProcessor implements Runnable {
method ReportProcessor (line 26) | public ReportProcessor(CompletionService<String> service) {
method run (line 34) | @Override
method setEnd (line 57) | public void setEnd(boolean end) {
FILE: 04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportRequest.java
class ReportRequest (line 8) | public class ReportRequest implements Runnable {
method ReportRequest (line 24) | public ReportRequest(String name, CompletionService<String> service) {
method run (line 32) | @Override
FILE: 04-12-处理在执行器中被拒绝的任务/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 10) | public static void main(String[] args) {
FILE: 04-12-处理在执行器中被拒绝的任务/src/com/concurrency/task/RejectedTaskController.java
class RejectedTaskController (line 9) | public class RejectedTaskController implements RejectedExecutionHandler {
method rejectedExecution (line 15) | @Override
FILE: 04-12-处理在执行器中被拒绝的任务/src/com/concurrency/task/Task.java
class Task (line 8) | public class Task implements Runnable {
method Task (line 11) | public Task(String name) {
method run (line 15) | @Override
method toString (line 28) | @Override
FILE: 05-02-创建Fork-Join线程池/src/com/concurrency/core/Main.java
class Main (line 11) | public class Main {
method main (line 12) | public static void main(String[] args) {
FILE: 05-02-创建Fork-Join线程池/src/com/concurrency/task/Task.java
class Task (line 11) | public class Task extends RecursiveAction {
method Task (line 39) | public Task(List<Product> products, int first, int last, double increm...
method compute (line 49) | @Override
method updatePrices (line 65) | private void updatePrices() {
FILE: 05-02-创建Fork-Join线程池/src/com/concurrency/utils/Product.java
class Product (line 6) | public class Product {
method getName (line 21) | public String getName() {
method setName (line 30) | public void setName(String name) {
method getPrice (line 39) | public double getPrice() {
method setPrice (line 48) | public void setPrice(double price) {
FILE: 05-02-创建Fork-Join线程池/src/com/concurrency/utils/ProductListGenerator.java
class ProductListGenerator (line 9) | public class ProductListGenerator {
method generate (line 17) | public List<Product> generate(int size) {
FILE: 05-03-合并任务的结果/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 05-03-合并任务的结果/src/com/concurrency/task/DocumentTask.java
class DocumentTask (line 11) | public class DocumentTask extends RecursiveTask<Integer> {
method DocumentTask (line 39) | public DocumentTask(String document[][], int start, int end, String wo...
method compute (line 52) | @Override
method groupResults (line 78) | private Integer groupResults(Integer number1, Integer number2) {
method processLines (line 91) | private Integer processLines(String[][] document, int start, int end, ...
FILE: 05-03-合并任务的结果/src/com/concurrency/task/LineTask.java
class LineTask (line 11) | public class LineTask extends RecursiveTask<Integer> {
method LineTask (line 40) | public LineTask(String line[], int start, int end, String word) {
method compute (line 52) | @Override
method groupResults (line 79) | private Integer groupResults(Integer number1, Integer number2) {
method count (line 92) | private Integer count(String[] line, int start, int end, String word) {
FILE: 05-03-合并任务的结果/src/com/concurrency/utils/DocumentMock.java
class DocumentMock (line 8) | public class DocumentMock {
method generateDocument (line 22) | public String[][] generateDocument(int numLines, int numWords, String ...
FILE: 05-04-异步运行任务/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 10) | public static void main(String[] args) {
FILE: 05-04-异步运行任务/src/com/concurrency/task/FolderProcessor.java
class FolderProcessor (line 11) | public class FolderProcessor extends RecursiveTask<List<String>> {
method FolderProcessor (line 29) | public FolderProcessor(String path, String extension) {
method compute (line 39) | @Override
method addResultsFromTasks (line 73) | private void addResultsFromTasks(List<String> list, List<FolderProcess...
method checkFile (line 85) | private boolean checkFile(String name) {
FILE: 05-05-在任务中抛出异常/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 05-05-在任务中抛出异常/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task extends RecursiveTask<Integer> {
method Task (line 36) | public Task(int array[], int start, int end) {
method compute (line 45) | @Override
FILE: 05-06-取消任务/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 05-06-取消任务/src/com/concurrency/task/TaskManager.java
class TaskManager (line 12) | public class TaskManager {
method TaskManager (line 21) | public TaskManager(){
method addTask (line 29) | public void addTask(ForkJoinTask<Integer> task){
method cancelTasks (line 37) | public void cancelTasks(ForkJoinTask<Integer> cancelTask){
FILE: 05-06-取消任务/src/com/concurrency/utils/ArrayGenerator.java
class ArrayGenerator (line 8) | public class ArrayGenerator {
method generateArray (line 14) | public int[] generateArray(int size) {
FILE: 05-06-取消任务/src/com/concurrency/utils/SearchNumberTask.java
class SearchNumberTask (line 11) | public class SearchNumberTask extends RecursiveTask<Integer> {
method SearchNumberTask (line 56) | public SearchNumberTask(int numbers[], int start, int end, int number,...
method compute (line 69) | @Override
method lookForNumber (line 86) | private int lookForNumber() {
method launchTasks (line 108) | private int launchTasks() {
method writeCancelMessage (line 130) | public void writeCancelMessage() {
FILE: 06-02-使用非阻塞式线程安全列表/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) throws Exception {
FILE: 06-02-使用非阻塞式线程安全列表/src/com/concurrency/task/AddTask.java
class AddTask (line 8) | public class AddTask implements Runnable {
method AddTask (line 20) | public AddTask(ConcurrentLinkedDeque<String> list) {
method run (line 27) | @Override
FILE: 06-02-使用非阻塞式线程安全列表/src/com/concurrency/task/PollTask.java
class PollTask (line 8) | public class PollTask implements Runnable {
method PollTask (line 20) | public PollTask(ConcurrentLinkedDeque<String> list) {
method run (line 27) | @Override
FILE: 06-03-使用阻塞式线程安全列表/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 10) | public static void main(String[] args) throws Exception {
FILE: 06-03-使用阻塞式线程安全列表/src/com/concurrency/task/Client.java
class Client (line 10) | public class Client implements Runnable {
method Client (line 14) | public Client(LinkedBlockingDeque<String> requestList) {
method run (line 21) | @Override
FILE: 06-04-使用按优先级排序的阻塞式线程安全列表/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 06-04-使用按优先级排序的阻塞式线程安全列表/src/com/concurrency/task/Event.java
class Event (line 9) | public class Event implements Comparable<Event> {
method Event (line 26) | public Event(int thread, int priority) {
method getThread (line 36) | public int getThread() {
method getPriority (line 45) | public int getPriority() {
method compareTo (line 52) | @Override
FILE: 06-04-使用按优先级排序的阻塞式线程安全列表/src/com/concurrency/task/Task.java
class Task (line 8) | public class Task implements Runnable {
method Task (line 26) | public Task(int id, PriorityBlockingQueue<Event> queue) {
method run (line 34) | @Override
FILE: 06-05-使用带有延迟元素的线程安全列表/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) throws Exception {
FILE: 06-05-使用带有延迟元素的线程安全列表/src/com/concurrency/task/Event.java
class Event (line 10) | public class Event implements Delayed {
method Event (line 22) | public Event(Date startDate) {
method compareTo (line 29) | @Override
method getDelay (line 43) | @Override
FILE: 06-05-使用带有延迟元素的线程安全列表/src/com/concurrency/task/Task.java
class Task (line 9) | public class Task implements Runnable {
method Task (line 27) | public Task(int id, DelayQueue<Event> queue) {
method run (line 36) | @Override
FILE: 06-06-使用线程安全可遍历映射/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 06-06-使用线程安全可遍历映射/src/com/concurrency/task/Task.java
class Task (line 10) | public class Task implements Runnable {
method Task (line 28) | public Task(ConcurrentSkipListMap<String, Contact> map, String id) {
method run (line 36) | @Override
FILE: 06-06-使用线程安全可遍历映射/src/com/concurrency/utils/Contact.java
class Contact (line 6) | public class Contact {
method Contact (line 24) | public Contact(String name, String phone) {
method getName (line 34) | public String getName() {
method getPhone (line 43) | public String getPhone() {
FILE: 06-07-生成并发随机数/src/com/concurrency/core/Main.java
class Main (line 5) | public class Main {
method main (line 6) | public static void main(String[] args) {
FILE: 06-07-生成并发随机数/src/com/concurrency/task/TaskLocalRandom.java
class TaskLocalRandom (line 8) | public class TaskLocalRandom implements Runnable {
method TaskLocalRandom (line 13) | public TaskLocalRandom() {
method run (line 20) | @Override
FILE: 06-08-使用原子变量/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 8) | public static void main(String[] args) {
FILE: 06-08-使用原子变量/src/com/concurrency/task/Account.java
class Account (line 8) | public class Account {
method Account (line 15) | public Account() {
method getBalance (line 26) | public long getBalance() {
method setBalance (line 35) | public void setBalance(long balance) {
method addAmount (line 44) | public void addAmount(long amount) {
method subtractAmount (line 53) | public void subtractAmount(long amount) {
FILE: 06-08-使用原子变量/src/com/concurrency/task/Bank.java
class Bank (line 6) | public class Bank implements Runnable {
method Bank (line 18) | public Bank(Account account) {
method run (line 26) | @Override
FILE: 06-08-使用原子变量/src/com/concurrency/task/Company.java
class Company (line 6) | public class Company implements Runnable {
method Company (line 18) | public Company(Account account) {
method run (line 25) | @Override
FILE: 06-09-使用原子数组/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 9) | public static void main(String[] args) {
FILE: 06-09-使用原子数组/src/com/concurrency/task/Decrementer.java
class Decrementer (line 8) | public class Decrementer implements Runnable {
method Decrementer (line 20) | public Decrementer(AtomicIntegerArray vector) {
method run (line 27) | @Override
FILE: 06-09-使用原子数组/src/com/concurrency/task/Incrementer.java
class Incrementer (line 8) | public class Incrementer implements Runnable {
method Incrementer (line 20) | public Incrementer(AtomicIntegerArray vector) {
method run (line 27) | @Override
FILE: 07-02-定制ThreadPoolExecutor类/src/com/concurrency/core/Main.java
class Main (line 13) | public class Main {
method main (line 14) | public static void main(String[] args) {
FILE: 07-02-定制ThreadPoolExecutor类/src/com/concurrency/executor/MyExecutor.java
class MyExecutor (line 15) | public class MyExecutor extends ThreadPoolExecutor {
method MyExecutor (line 31) | public MyExecutor(int corePoolSize,
method shutdown (line 44) | @Override
method shutdownNow (line 56) | @Override
method beforeExecute (line 68) | @Override
method afterExecute (line 77) | @Override
FILE: 07-02-定制ThreadPoolExecutor类/src/com/concurrency/task/SleepTwoSecondsTask.java
class SleepTwoSecondsTask (line 10) | public class SleepTwoSecondsTask implements Callable<String> {
method call (line 15) | public String call() throws Exception {
FILE: 07-03-基于优先级的Executor类/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 11) | public static void main(String[] args) {
FILE: 07-03-基于优先级的Executor类/src/com/concurrency/task/MyPriorityTask.java
class MyPriorityTask (line 8) | public class MyPriorityTask implements Runnable, Comparable<MyPriorityTa...
method MyPriorityTask (line 26) | public MyPriorityTask(String name, int priority) {
method getPriority (line 36) | public int getPriority() {
method compareTo (line 43) | @Override
method run (line 59) | @Override
FILE: 07-04-实现ThreadFactory接口生成定制线程/src/com/concurrency/core/Main.java
class Main (line 6) | public class Main {
method main (line 8) | public static void main(String[] args) throws Exception {
FILE: 07-04-实现ThreadFactory接口生成定制线程/src/com/concurrency/task/MyTask.java
class MyTask (line 9) | public class MyTask implements Runnable {
method run (line 14) | @Override
FILE: 07-04-实现ThreadFactory接口生成定制线程/src/com/concurrency/task/MyThread.java
class MyThread (line 8) | public class MyThread extends Thread {
method MyThread (line 26) | public MyThread(Runnable target, String name) {
method run (line 34) | @Override
method setCreationDate (line 44) | public void setCreationDate() {
method setStartDate (line 51) | public void setStartDate() {
method setFinishDate (line 58) | public void setFinishDate() {
method getExecutionTime (line 67) | public long getExecutionTime() {
method toString (line 74) | @Override
FILE: 07-04-实现ThreadFactory接口生成定制线程/src/com/concurrency/task/MyThreadFactory.java
class MyThreadFactory (line 8) | public class MyThreadFactory implements ThreadFactory {
method MyThreadFactory (line 21) | public MyThreadFactory(String prefix) {
method newThread (line 29) | @Override
FILE: 07-05-在Executro对象中使用ThreadFactory/src/com/concurrency/core/Main.java
class Main (line 10) | public class Main {
method main (line 12) | public static void main(String[] args) throws Exception {
FILE: 07-05-在Executro对象中使用ThreadFactory/src/com/concurrency/task/MyTask.java
class MyTask (line 8) | public class MyTask implements Runnable {
method run (line 13) | @Override
FILE: 07-05-在Executro对象中使用ThreadFactory/src/com/concurrency/task/MyThread.java
class MyThread (line 8) | public class MyThread extends Thread {
method MyThread (line 26) | public MyThread(Runnable target, String name) {
method run (line 34) | @Override
method setCreationDate (line 44) | public void setCreationDate() {
method setStartDate (line 51) | public void setStartDate() {
method setFinishDate (line 58) | public void setFinishDate() {
method getExecutionTime (line 67) | public long getExecutionTime() {
method toString (line 74) | @Override
FILE: 07-05-在Executro对象中使用ThreadFactory/src/com/concurrency/task/MyThreadFactory.java
class MyThreadFactory (line 8) | public class MyThreadFactory implements ThreadFactory {
method MyThreadFactory (line 21) | public MyThreadFactory(String prefix) {
method newThread (line 29) | @Override
FILE: 07-06-定制运行在线程池中的任务/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 11) | public static void main(String[] args) throws Exception {
FILE: 07-06-定制运行在线程池中的任务/src/com/concurrency/task/MyScheduledTask.java
class MyScheduledTask (line 15) | public class MyScheduledTask<V> extends FutureTask<V> implements Runnabl...
method MyScheduledTask (line 37) | public MyScheduledTask(Runnable runnable, V result, RunnableScheduledF...
method getDelay (line 49) | @Override
method compareTo (line 67) | @Override
method isPeriodic (line 75) | @Override
method run (line 84) | @Override
method setPeriod (line 106) | public void setPeriod(long period) {
FILE: 07-06-定制运行在线程池中的任务/src/com/concurrency/task/MyScheduledThreadPoolExecutor.java
class MyScheduledThreadPoolExecutor (line 11) | public class MyScheduledThreadPoolExecutor extends ScheduledThreadPoolEx...
method MyScheduledThreadPoolExecutor (line 18) | public MyScheduledThreadPoolExecutor(int corePoolSize) {
method decorateTask (line 26) | @Override
method scheduleAtFixedRate (line 37) | @Override
FILE: 07-06-定制运行在线程池中的任务/src/com/concurrency/task/Task.java
class Task (line 8) | public class Task implements Runnable {
method run (line 13) | @Override
FILE: 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/src/com/concurrency/core/Main.java
class Main (line 9) | public class Main {
method main (line 11) | public static void main(String[] args) throws Exception {
FILE: 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/src/com/concurrency/task/MyRecursiveTask.java
class MyRecursiveTask (line 10) | public class MyRecursiveTask extends RecursiveTask<Integer> {
method MyRecursiveTask (line 27) | public MyRecursiveTask(int array[], int start, int end) {
method compute (line 36) | @Override
method addResults (line 70) | private Integer addResults(MyRecursiveTask task1, MyRecursiveTask task...
FILE: 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/src/com/concurrency/task/MyWorkerThread.java
class MyWorkerThread (line 9) | public class MyWorkerThread extends ForkJoinWorkerThread {
method MyWorkerThread (line 19) | protected MyWorkerThread(ForkJoinPool pool) {
method onStart (line 26) | @Override
method onTermination (line 36) | @Override
method addTask (line 45) | public void addTask() {
FILE: 07-07-通过实现ThreadFactory接口为Fork-Join框架生成定制线程/src/com/concurrency/task/MyWorkerThreadFactory.java
class MyWorkerThreadFactory (line 10) | public class MyWorkerThreadFactory implements ForkJoinWorkerThreadFactory {
method newThread (line 18) | @Override
FILE: 07-08-定制运行在Fork-Join框架中的任务/src/com/concurrency/core/Main.java
class Main (line 7) | public class Main {
method main (line 9) | public static void main(String[] args) throws Exception {
FILE: 07-08-定制运行在Fork-Join框架中的任务/src/com/concurrency/task/MyWorkerTask.java
class MyWorkerTask (line 9) | public abstract class MyWorkerTask extends ForkJoinTask<Void> {
method MyWorkerTask (line 21) | public MyWorkerTask(String name) {
method getRawResult (line 28) | @Override
method setRawResult (line 36) | @Override
method exec (line 44) | @Override
method getName (line 59) | public String getName() {
method compute (line 66) | protected abstract void compute();
FILE: 07-08-定制运行在Fork-Join框架中的任务/src/com/concurrency/task/Task.java
class Task (line 6) | public class Task extends MyWorkerTask {
method Task (line 26) | public Task(String name, int array[], int start, int end) {
method compute (line 36) | @Override
FILE: 07-09-现实定制Lock类/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 10) | public static void main(String[] args) {
FILE: 07-09-现实定制Lock类/src/com/concurrency/task/MyAbstractQueuedSynchronizer.java
class MyAbstractQueuedSynchronizer (line 9) | public class MyAbstractQueuedSynchronizer extends AbstractQueuedSynchron...
method MyAbstractQueuedSynchronizer (line 19) | public MyAbstractQueuedSynchronizer() {
method tryAcquire (line 29) | @Override
method tryRelease (line 40) | @Override
FILE: 07-09-现实定制Lock类/src/com/concurrency/task/MyLock.java
class MyLock (line 11) | public class MyLock implements Lock {
method MyLock (line 21) | public MyLock() {
method lock (line 28) | @Override
method lockInterruptibly (line 36) | @Override
method tryLock (line 44) | @Override
method tryLock (line 62) | @Override
method unlock (line 70) | @Override
method newCondition (line 78) | @Override
FILE: 07-09-现实定制Lock类/src/com/concurrency/task/Task.java
class Task (line 8) | public class Task implements Runnable {
method Task (line 22) | public Task(String name, MyLock lock) {
method run (line 30) | @Override
FILE: 07-10-实现基于优先级的传输队列/src/com/concurrency/core/Main.java
class Main (line 11) | public class Main {
method main (line 13) | public static void main(String[] args) throws Exception {
FILE: 07-10-实现基于优先级的传输队列/src/com/concurrency/task/Consumer.java
class Consumer (line 6) | public class Consumer implements Runnable {
method Consumer (line 11) | public Consumer(MyPriorityTransferQueue<Event> buffer) {
method run (line 18) | @Override
FILE: 07-10-实现基于优先级的传输队列/src/com/concurrency/task/Event.java
class Event (line 6) | public class Event implements Comparable<Event> {
method Event (line 20) | public Event(String thread, int priority) {
method getThread (line 25) | public String getThread() {
method getPriority (line 29) | public int getPriority() {
method compareTo (line 33) | @Override
FILE: 07-10-实现基于优先级的传输队列/src/com/concurrency/task/MyPriorityTransferQueue.java
class MyPriorityTransferQueue (line 15) | public class MyPriorityTransferQueue<E> extends PriorityBlockingQueue<E>...
method MyPriorityTransferQueue (line 31) | public MyPriorityTransferQueue() {
method tryTransfer (line 40) | @Override
method transfer (line 58) | @Override
method tryTransfer (line 79) | @Override
method hasWaitingConsumer (line 108) | @Override
method getWaitingConsumerCount (line 116) | @Override
method take (line 125) | @Override
FILE: 07-10-实现基于优先级的传输队列/src/com/concurrency/task/Producer.java
class Producer (line 6) | public class Producer implements Runnable {
method Producer (line 11) | public Producer(MyPriorityTransferQueue<Event> buffer) {
method run (line 19) | @Override
FILE: 07-11-实现自己的原子对象/src/com/concurrency/core/Main.java
class Main (line 8) | public class Main {
method main (line 10) | public static void main(String[] args) throws Exception {
FILE: 07-11-实现自己的原子对象/src/com/concurrency/task/ParkingCounter.java
class ParkingCounter (line 8) | public class ParkingCounter extends AtomicInteger {
method ParkingCounter (line 19) | public ParkingCounter(int maxNumber) {
method carIn (line 29) | public boolean carIn() {
method carOut (line 50) | public boolean carOut() {
FILE: 07-11-实现自己的原子对象/src/com/concurrency/task/Sensor1.java
class Sensor1 (line 6) | public class Sensor1 implements Runnable {
method Sensor1 (line 16) | public Sensor1(ParkingCounter counter) {
method run (line 24) | @Override
FILE: 07-11-实现自己的原子对象/src/com/concurrency/task/Sensor2.java
class Sensor2 (line 6) | public class Sensor2 implements Runnable {
method Sensor2 (line 16) | public Sensor2(ParkingCounter counter) {
method run (line 23) | @Override
Condensed preview — 271 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,133K chars).
[
{
"path": ".idea/.name",
"chars": 13,
"preview": "JAVA7并发编程实战手册"
},
{
"path": ".idea/codeStyleSettings.xml",
"chars": 389,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectCodeStyleSettingsManager\">\n <o"
},
{
"path": ".idea/compiler.xml",
"chars": 709,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CompilerConfiguration\">\n <option name"
},
{
"path": ".idea/copyright/profiles_settings.xml",
"chars": 74,
"preview": "<component name=\"CopyrightManager\">\n <settings default=\"\" />\n</component>"
},
{
"path": ".idea/encodings.xml",
"chars": 164,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Encoding\" useUTFGuessing=\"true\" native2A"
},
{
"path": ".idea/findbugs-idea.xml",
"chars": 12538,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"org.twodividedbyzero.idea.findbugs\">\n "
},
{
"path": ".idea/misc.xml",
"chars": 2344,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ClientPropertiesManager\">\n <propertie"
},
{
"path": ".idea/modules.xml",
"chars": 9803,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectModuleManager\">\n <modules>\n "
},
{
"path": ".idea/scopes/scope_settings.xml",
"chars": 139,
"preview": "<component name=\"DependencyValidationManager\">\n <state>\n <option name=\"SKIP_IMPORT_STATEMENTS\" value=\"false\" />\n </"
},
{
"path": ".idea/uiDesigner.xml",
"chars": 8792,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Palette2\">\n <group name=\"Swing\">\n "
},
{
"path": ".idea/vcs.xml",
"chars": 180,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "01-02-线程的创建和运行/01-02-线程的创建和运行.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-02-线程的创建和运行/src/com/concurrency/core/Main.java",
"chars": 478,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Calculator;\n\npublic class Main {\n public static void main("
},
{
"path": "01-02-线程的创建和运行/src/com/concurrency/task/Calculator.java",
"chars": 541,
"preview": "package com.concurrency.task;\n\n// 创建一个名为Calculator的类,它实现了 Runnable接口\npublic class Calculator implements Runnable {\n /"
},
{
"path": "01-03-线程信息的获取和设置/01-03-线程信息的获取和设置.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-03-线程信息的获取和设置/src/com/concurrency/core/Main.java",
"chars": 3427,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Calculator;\n\nimport java.io.File;\nimport java.io.FileWriter;\n"
},
{
"path": "01-03-线程信息的获取和设置/src/com/concurrency/task/Calculator.java",
"chars": 405,
"preview": "package com.concurrency.task;\n\npublic class Calculator implements Runnable{\n private int number;\n\n public Calculat"
},
{
"path": "01-04-线程的中断/01-04-线程的中断.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-04-线程的中断/src/com/concurrency/core/Main.java",
"chars": 456,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.PrimeGenerator;\n\nimport java.util.concurrent.TimeUnit;\n\npubli"
},
{
"path": "01-04-线程的中断/src/com/concurrency/task/PrimeGenerator.java",
"chars": 924,
"preview": "package com.concurrency.task;\n\npublic class PrimeGenerator extends Thread {\n @Override\n public void run() {\n "
},
{
"path": "01-05-线程中断的控制/01-05-线程中断的控制.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-05-线程中断的控制/src/com/concurrency/core/Main.java",
"chars": 549,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.FileSearch;\n\nimport java.util.concurrent.TimeUnit;\n\npublic cl"
},
{
"path": "01-05-线程中断的控制/src/com/concurrency/task/FileSearch.java",
"chars": 1697,
"preview": "package com.concurrency.task;\n\nimport java.io.File;\n\n// 文件搜索类,给定一个文件目录,搜索其中指定的文件\npublic class FileSearch implements Runn"
},
{
"path": "01-06-线程的休眠和恢复/01-06-线程的休眠和恢复.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-06-线程的休眠和恢复/src/com/concurrency/core/Main.java",
"chars": 551,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.FileClock;\n\nimport java.util.concurrent.TimeUnit;\npublic clas"
},
{
"path": "01-06-线程的休眠和恢复/src/com/concurrency/task/FileClock.java",
"chars": 605,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n// 文件定时类,每隔一秒钟将实际的时间输出\npubl"
},
{
"path": "01-07-等待线程的终止/01-07-等待线程的终止.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-07-等待线程的终止/src/com/concurrency/core/Main.java",
"chars": 899,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.DataSourcesLoader;\nimport com.concurrency.task.NetworkConnect"
},
{
"path": "01-07-等待线程的终止/src/com/concurrency/task/DataSourcesLoader.java",
"chars": 577,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 数据源加载器,模拟数据加载,它会休眠10"
},
{
"path": "01-07-等待线程的终止/src/com/concurrency/task/NetworkConnectionsLoader.java",
"chars": 596,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 网络连接加载器,模拟网络连接,它会休眠6"
},
{
"path": "01-08-守护线程的创建和运行/01-08-守护线程的创建和运行.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-08-守护线程的创建和运行/src/com/concurrency/core/Main.java",
"chars": 683,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.event.Event;\nimport com.concurrency.task.CleanerTask;\nimport com.c"
},
{
"path": "01-08-守护线程的创建和运行/src/com/concurrency/event/Event.java",
"chars": 705,
"preview": "package com.concurrency.event;\n\nimport java.util.Date;\n\n/**\n * 事件类,存储事件信息\n */\npublic class Event {\n /**\n * 事件日期\n "
},
{
"path": "01-08-守护线程的创建和运行/src/com/concurrency/task/CleanerTask.java",
"chars": 1365,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.event.Event;\n\nimport java.util.Date;\nimport java.util.Deque;\n\n/**\n"
},
{
"path": "01-08-守护线程的创建和运行/src/com/concurrency/task/WriterTask.java",
"chars": 1017,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.event.Event;\n\nimport java.util.Date;\nimport java.util.Deque;\nimpor"
},
{
"path": "01-09-线程中不可控异常的处理/01-09-线程中不可控异常的处理.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-09-线程中不可控异常的处理/src/com/concurrency/core/Main.java",
"chars": 579,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.handler.ExceptionHandler;\nimport com.concurrency.task.Task;\n\npubli"
},
{
"path": "01-09-线程中不可控异常的处理/src/com/concurrency/handler/ExceptionHandler.java",
"chars": 662,
"preview": "package com.concurrency.handler;\n\n/**\n * 异常处理类,处理线程中抛出的未捕获的异常\n */\npublic class ExceptionHandler implements Thread.Uncaug"
},
{
"path": "01-09-线程中不可控异常的处理/src/com/concurrency/task/Task.java",
"chars": 207,
"preview": "package com.concurrency.task;\n\n/**\n * 任务类,专门抛出异常\n */\npublic class Task implements Runnable {\n @Override\n public vo"
},
{
"path": "01-10-线程局部变量的使用/01-10-线程局部变量的使用.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-10-线程局部变量的使用/src/com/concurrency/core/Main.java",
"chars": 558,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.UnsafeTask;\n\nimport java.util.concurrent.TimeUnit;\n\npublic cl"
},
{
"path": "01-10-线程局部变量的使用/src/com/concurrency/core/SafeMain.java",
"chars": 553,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.SafeTask;\n\nimport java.util.concurrent.TimeUnit;\n\npublic clas"
},
{
"path": "01-10-线程局部变量的使用/src/com/concurrency/task/SafeTask.java",
"chars": 808,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\npublic class SafeTask imple"
},
{
"path": "01-10-线程局部变量的使用/src/com/concurrency/task/UnsafeTask.java",
"chars": 730,
"preview": "package com.concurrency.task;\n\nimport java.sql.Time;\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n/**\n "
},
{
"path": "01-11-线程分组/01-11-线程分组.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-11-线程分组/src/com/concurrency/core/Main.java",
"chars": 1810,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Result;\nimport com.concurrency.task.SearchTask;\n\nimport java."
},
{
"path": "01-11-线程分组/src/com/concurrency/task/Result.java",
"chars": 386,
"preview": "package com.concurrency.task;\n\n/**\n * 结果类用于存储搜索结果\n */\npublic class Result {\n /**\n * 完成任务的线程名\n */\n private "
},
{
"path": "01-11-线程分组/src/com/concurrency/task/SearchTask.java",
"chars": 1180,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.Random;\nimport java.util.concurrent.TimeUnit;\n\npu"
},
{
"path": "01-12-线程组中不可控制异常的处理/01-12-线程组中不可控制异常的处理.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-12-线程组中不可控制异常的处理/src/com/concurrency/core/Main.java",
"chars": 494,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.group.MyThreadGroup;\nimport com.concurrency.task.Task;\n\npublic cla"
},
{
"path": "01-12-线程组中不可控制异常的处理/src/com/concurrency/group/MyThreadGroup.java",
"chars": 647,
"preview": "package com.concurrency.group;\n\npublic class MyThreadGroup extends ThreadGroup {\n /**\n * 构造函数\n *\n * @para"
},
{
"path": "01-12-线程组中不可控制异常的处理/src/com/concurrency/task/Task.java",
"chars": 700,
"preview": "package com.concurrency.task;\n\nimport java.util.Random;\n\npublic class Task implements Runnable {\n @Override\n publi"
},
{
"path": "01-13-使用工厂类创建线程/01-13-使用工厂类创建线程.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "01-13-使用工厂类创建线程/src/com/concurrency/core/Main.java",
"chars": 681,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.factory.MyThreadFactory;\nimport com.concurrency.task.Task;\n\npublic"
},
{
"path": "01-13-使用工厂类创建线程/src/com/concurrency/factory/MyThreadFactory.java",
"chars": 1410,
"preview": "package com.concurrency.factory;\n\nimport com.sun.javafx.beans.annotations.NonNull;\n\nimport java.util.ArrayList;\nimport j"
},
{
"path": "01-13-使用工厂类创建线程/src/com/concurrency/task/Task.java",
"chars": 295,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.TimeUnit;\n\npublic class Task implements Runnable {\n @Overr"
},
{
"path": "02-02-使用synchronized实现同步方法-问题/02-02-使用synchronized实现同步方法-问题.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-02-使用synchronized实现同步方法-问题/src/com/concurrency/core/Main.java",
"chars": 1076,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Account;\nimport com.concurrency.task.Bank;\nimport com.concurr"
},
{
"path": "02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Account.java",
"chars": 1053,
"preview": "package com.concurrency.task;\n\n/**\n * 帐户类,模拟一个银行帐户\n */\npublic class Account {\n /**\n * 帐户余额\n */\n private do"
},
{
"path": "02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Bank.java",
"chars": 409,
"preview": "package com.concurrency.task;\n\npublic class Bank implements Runnable {\n /**\n * 一个帐户\n */\n private Account a"
},
{
"path": "02-02-使用synchronized实现同步方法-问题/src/com/concurrency/task/Company.java",
"chars": 404,
"preview": "package com.concurrency.task;\n\npublic class Company implements Runnable {\n\n /**\n * 一个帐户\n */\n private Accou"
},
{
"path": "02-02-使用synchronized实现同步方法-问题解决/02-02-使用synchronized实现同步方法-问题解决.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/core/Main.java",
"chars": 1076,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Account;\nimport com.concurrency.task.Bank;\nimport com.concurr"
},
{
"path": "02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Account.java",
"chars": 1079,
"preview": "package com.concurrency.task;\n\n/**\n * 帐户类,模拟一个银行帐户\n */\npublic class Account {\n /**\n * 帐户余额\n */\n private do"
},
{
"path": "02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Bank.java",
"chars": 409,
"preview": "package com.concurrency.task;\n\npublic class Bank implements Runnable {\n /**\n * 一个帐户\n */\n private Account a"
},
{
"path": "02-02-使用synchronized实现同步方法-问题解决/src/com/concurrency/task/Company.java",
"chars": 404,
"preview": "package com.concurrency.task;\n\npublic class Company implements Runnable {\n\n /**\n * 一个帐户\n */\n private Accou"
},
{
"path": "02-03-使用非依赖属性实现同步/02-03-使用非依赖属性实现同步.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-03-使用非依赖属性实现同步/src/com/concurrency/core/Main.java",
"chars": 1087,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Cinema;\nimport com.concurrency.task.TicketOffice1;\nimport com"
},
{
"path": "02-03-使用非依赖属性实现同步/src/com/concurrency/task/Cinema.java",
"chars": 2236,
"preview": "package com.concurrency.task;\n\n/**\n * 影院类,其有两个影院厅\n */\npublic class Cinema {\n /**\n * 保存影院厅1的剩余电影票数\n */\n pri"
},
{
"path": "02-03-使用非依赖属性实现同步/src/com/concurrency/task/TicketOffice1.java",
"chars": 602,
"preview": "package com.concurrency.task;\n\n/**\n * 售票窗口类,出售1号放映厅的票\n */\npublic class TicketOffice1 implements Runnable {\n /**\n "
},
{
"path": "02-03-使用非依赖属性实现同步/src/com/concurrency/task/TicketOffice2.java",
"chars": 609,
"preview": "package com.concurrency.task;\n\n/**\n * 售票窗口类,出售2号放映厅的票\n */\npublic class TicketOffice2 implements Runnable {\n /**\n "
},
{
"path": "02-04-在同步代码中使用条件/02-04-在同步代码中使用条件.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-04-在同步代码中使用条件/src/com/concurrency/core/Main.java",
"chars": 638,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Consumer;\nimport com.concurrency.task.EventStorage;\nimport co"
},
{
"path": "02-04-在同步代码中使用条件/src/com/concurrency/task/Consumer.java",
"chars": 445,
"preview": "package com.concurrency.task;\n\n/**\n * 消费者对象,消费事件\n */\npublic class Consumer implements Runnable {\n /**\n * 事件存储对象\n "
},
{
"path": "02-04-在同步代码中使用条件/src/com/concurrency/task/EventStorage.java",
"chars": 1339,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * 事件存储类,"
},
{
"path": "02-04-在同步代码中使用条件/src/com/concurrency/task/Producer.java",
"chars": 445,
"preview": "package com.concurrency.task;\n\n/**\n * 生产者对象,生产事件\n */\npublic class Producer implements Runnable {\n /**\n * 事件存储对象\n "
},
{
"path": "02-05-用锁实现同步/02-05-用锁实现同步.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-05-用锁实现同步/src/com/concurrency/core/Main.java",
"chars": 530,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Job;\nimport com.concurrency.task.PrintQueue;\n\npublic class Ma"
},
{
"path": "02-05-用锁实现同步/src/com/concurrency/task/Job.java",
"chars": 575,
"preview": "package com.concurrency.task;\n\npublic class Job implements Runnable {\n /**\n * 打印文档的队列\n */\n private PrintQu"
},
{
"path": "02-05-用锁实现同步/src/com/concurrency/task/PrintQueue.java",
"chars": 807,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.locks.Lock;\nimport java.util.concurrent.locks.ReentrantLock;\n"
},
{
"path": "02-06-使用读写锁实现同步数据访问/02-06-使用读写锁实现同步数据访问.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-06-使用读写锁实现同步数据访问/src/com/concurrency/core/Main.java",
"chars": 838,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.PricesInfo;\nimport com.concurrency.task.Reader;\nimport com.co"
},
{
"path": "02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/PricesInfo.java",
"chars": 1254,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.locks.ReadWriteLock;\nimport java.util.concurrent.locks.Reentr"
},
{
"path": "02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/Reader.java",
"chars": 672,
"preview": "package com.concurrency.task;\n\n/**\n * 读者类,消费价格\n */\npublic class Reader implements Runnable {\n /**\n * 价格信息对象\n "
},
{
"path": "02-06-使用读写锁实现同步数据访问/src/com/concurrency/task/Writer.java",
"chars": 807,
"preview": "package com.concurrency.task;\n\n/**\n * 写者类,产生价格\n */\npublic class Writer implements Runnable {\n /**\n * 价格信息对象\n "
},
{
"path": "02-07-修改锁的公平性/02-07-修改锁的公平性.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-07-修改锁的公平性/src/com/concurrency/core/Main.java",
"chars": 712,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Job;\nimport com.concurrency.task.PrintQueue;\n\npublic class Ma"
},
{
"path": "02-07-修改锁的公平性/src/com/concurrency/task/Job.java",
"chars": 576,
"preview": "package com.concurrency.task;\n\n\npublic class Job implements Runnable {\n /**\n * 打印文档的队列\n */\n private PrintQ"
},
{
"path": "02-07-修改锁的公平性/src/com/concurrency/task/PrintQueue.java",
"chars": 1243,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.locks.Lock;\nimport java.util.concurrent.locks.ReentrantLock;\n"
},
{
"path": "02-08-在锁中使用多条件/02-08-在锁中使用多条件.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-08-在锁中使用多条件/src/com/concurrency/core/Main.java",
"chars": 1021,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Consumer;\nimport com.concurrency.task.Producer;\nimport com.co"
},
{
"path": "02-08-在锁中使用多条件/src/com/concurrency/task/Consumer.java",
"chars": 857,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.Buffer;\n\nimport java.util.Random;\n\npublic class Consumer imp"
},
{
"path": "02-08-在锁中使用多条件/src/com/concurrency/task/Producer.java",
"chars": 793,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.Buffer;\nimport com.concurrency.utils.FileMock;\n\npublic class"
},
{
"path": "02-08-在锁中使用多条件/src/com/concurrency/utils/Buffer.java",
"chars": 2477,
"preview": "package com.concurrency.utils;\n\nimport java.util.LinkedList;\nimport java.util.concurrent.locks.Condition;\nimport java.ut"
},
{
"path": "02-08-在锁中使用多条件/src/com/concurrency/utils/FileMock.java",
"chars": 1209,
"preview": "package com.concurrency.utils;\n\n/**\n * 文件模拟类,\n */\npublic class FileMock {\n /**\n * 模拟文件的内容\n */\n private Str"
},
{
"path": "02-09-应用例子/02-09-应用例子.iml",
"chars": 11751,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "02-09-应用例子/src/com.concurrency/core/Main.java",
"chars": 1171,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.BuildStats;\nimport com.concurrency.task.Sensor1;\nimport com.c"
},
{
"path": "02-09-应用例子/src/com.concurrency/task/BuildStats.java",
"chars": 1367,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 建筑物状态类,对进入其中的人进行统计,并且控制建筑物中的人数\n * Author: 王"
},
{
"path": "02-09-应用例子/src/com.concurrency/task/Sensor1.java",
"chars": 576,
"preview": "package com.concurrency.task;\n\n/**\n * Author: 王俊超\n * Date: 2014-11-25\n * Time: 07:59\n * Declaration: All Rights Reserved"
},
{
"path": "02-09-应用例子/src/com.concurrency/task/Sensor2.java",
"chars": 574,
"preview": "package com.concurrency.task;\n\n/**\n * Author: 王俊超\n * Date: 2014-11-25\n * Time: 07:59\n * Declaration: All Rights Reserved"
},
{
"path": "03-02-资源并发控制访问/03-02-资源并发控制访问.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-02-资源并发控制访问/src/com/concurrency/core/Main.java",
"chars": 533,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Job;\nimport com.concurrency.task.PrintQueue;\n\npublic class Ma"
},
{
"path": "03-02-资源并发控制访问/src/com/concurrency/task/Job.java",
"chars": 627,
"preview": "package com.concurrency.task;\n\npublic class Job implements Runnable {\n /**\n * 打印队列对象\n */\n private PrintQue"
},
{
"path": "03-02-资源并发控制访问/src/com/concurrency/task/PrintQueue.java",
"chars": 1080,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.core.Main;\n\nimport java.util.concurrent.Semaphore;\nimport java.uti"
},
{
"path": "03-03-资源的多副本的并发访问控制/03-03-资源的多副本的并发访问控制.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-03-资源的多副本的并发访问控制/src/com/concurrency/core/Main.java",
"chars": 562,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Job;\nimport com.concurrency.task.PrintQueue;\n\npublic class Ma"
},
{
"path": "03-03-资源的多副本的并发访问控制/src/com/concurrency/task/Job.java",
"chars": 627,
"preview": "package com.concurrency.task;\n\npublic class Job implements Runnable {\n /**\n * 打印队列对象\n */\n private PrintQue"
},
{
"path": "03-03-资源的多副本的并发访问控制/src/com/concurrency/task/PrintQueue.java",
"chars": 2278,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Semaphore;\nimport java.util.concurrent.TimeUnit;\nimport java."
},
{
"path": "03-04-等待多个并发事件的完成/03-04-等待多个并发事件的完成.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-04-等待多个并发事件的完成/src/com/concurrency/core/Main.java",
"chars": 625,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Participant;\nimport com.concurrency.task.VideoConference;\n\npu"
},
{
"path": "03-04-等待多个并发事件的完成/src/com/concurrency/task/Participant.java",
"chars": 829,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 参与者类\n */\npublic class Participant implement"
},
{
"path": "03-04-等待多个并发事件的完成/src/com/concurrency/task/VideoConference.java",
"chars": 1266,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.CountDownLatch;\n\n/**\n * 视频会类\n * 使用倒计时闩来控制所有参与者都到达后才发生事件\n */\np"
},
{
"path": "03-05-在集合点的同步/03-05-在集合点的同步.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-05-在集合点的同步/src/com/concurrency/core/Main.java",
"chars": 1337,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Grouper;\nimport com.concurrency.task.Searcher;\nimport com.con"
},
{
"path": "03-05-在集合点的同步/src/com/concurrency/task/Grouper.java",
"chars": 701,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.Results;\n\n/**\n * 组合类,汇总查找的结果\n */\npublic class Grouper implem"
},
{
"path": "03-05-在集合点的同步/src/com/concurrency/task/Searcher.java",
"chars": 2027,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.MatrixMock;\nimport com.concurrency.utils.Results;\n\nimport ja"
},
{
"path": "03-05-在集合点的同步/src/com/concurrency/utils/MatrixMock.java",
"chars": 1069,
"preview": "package com.concurrency.utils;\n\nimport java.util.Random;\n\n/**\n * 矩阵模拟类,随机生成0-9之间数字二维矩\n */\npublic class MatrixMock {\n "
},
{
"path": "03-05-在集合点的同步/src/com/concurrency/utils/Results.java",
"chars": 583,
"preview": "package com.concurrency.utils;\n\n/**\n * 结果类,保存矩阵中每行找到指定数字的次数\n */\npublic class Results {\n /**\n * 保存矩阵中每行找到指定数字的次数\n "
},
{
"path": "03-06-并发阶段任务的运行/03-06-并发阶段任务的运行.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-06-并发阶段任务的运行/src/com/concurrency/core/Main.java",
"chars": 1197,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.FileSearch;\n\nimport java.util.concurrent.Phaser;\n\npublic clas"
},
{
"path": "03-06-并发阶段任务的运行/src/com/concurrency/task/FileSearch.java",
"chars": 4290,
"preview": "package com.concurrency.task;\n\nimport java.io.File;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util."
},
{
"path": "03-07-并发阶段任务中的阶段切换/03-07-并发阶段任务中的阶段切换.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-07-并发阶段任务中的阶段切换/src/com/concurrency/core/Main.java",
"chars": 1028,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.MyPhaser;\nimport com.concurrency.task.Student;\n\n\npublic class"
},
{
"path": "03-07-并发阶段任务中的阶段切换/src/com/concurrency/task/MyPhaser.java",
"chars": 1938,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Phaser;\n\n/**\n * 线程阶段类,控制线程阶段的改变\n */\npublic class MyPhaser ext"
},
{
"path": "03-07-并发阶段任务中的阶段切换/src/com/concurrency/task/Student.java",
"chars": 2410,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.Phaser;\nimport java.util.concurrent.Ti"
},
{
"path": "03-08-并发任务间的数据交换/03-08-并发任务间的数据交换.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "03-08-并发任务间的数据交换/src/com/concurrency/core/Main.java",
"chars": 866,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Consumer;\nimport com.concurrency.task.Producer;\n\nimport java."
},
{
"path": "03-08-并发任务间的数据交换/src/com/concurrency/task/Consumer.java",
"chars": 1384,
"preview": "package com.concurrency.task;\n\nimport java.util.List;\nimport java.util.concurrent.Exchanger;\n\n/**\n * 消费者类\n */\npublic cla"
},
{
"path": "03-08-并发任务间的数据交换/src/com/concurrency/task/Producer.java",
"chars": 1432,
"preview": "package com.concurrency.task;\n\nimport java.util.List;\nimport java.util.concurrent.Exchanger;\n\n/**\n * 生产者类\n */\npublic cla"
},
{
"path": "04-02-创建线程执行器/04-02-创建线程执行器.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-02-创建线程执行器/src/com/concurrency/core/Main.java",
"chars": 411,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Server;\nimport com.concurrency.task.Task;\n\npublic class Main "
},
{
"path": "04-02-创建线程执行器/src/com/concurrency/task/Server.java",
"chars": 1133,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ThreadPoolExecutor;\n\n/"
},
{
"path": "04-02-创建线程执行器/src/com/concurrency/task/Task.java",
"chars": 1189,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 任务类\n */\npublic class"
},
{
"path": "04-03-创建固定大小的线程执行器/04-03-创建固定大小的线程执行器.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-03-创建固定大小的线程执行器/src/com/concurrency/core/Main.java",
"chars": 411,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Server;\nimport com.concurrency.task.Task;\n\npublic class Main "
},
{
"path": "04-03-创建固定大小的线程执行器/src/com/concurrency/task/Server.java",
"chars": 1214,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ThreadPoolExecutor;\n\n/"
},
{
"path": "04-03-创建固定大小的线程执行器/src/com/concurrency/task/Task.java",
"chars": 1189,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 任务类\n */\npublic class"
},
{
"path": "04-04-在执行器中执行任务并返回结果/04-04-在执行器中执行任务并返回结果.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-04-在执行器中执行任务并返回结果/src/com/concurrency/core/Main.java",
"chars": 2680,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.FactorialCalculator;\n\nimport java.util.ArrayList;\nimport java"
},
{
"path": "04-04-在执行器中执行任务并返回结果/src/com/concurrency/task/FactorialCalculator.java",
"chars": 1118,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 阶乘计算类"
},
{
"path": "04-05-运行多个任务并处理第一个结果/04-05-运行多个任务并处理第一个结果.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-05-运行多个任务并处理第一个结果/src/com/concurrency/core/Main.java",
"chars": 1900,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.TaskValidator;\nimport com.concurrency.task.UserValidator;\n\nim"
},
{
"path": "04-05-运行多个任务并处理第一个结果/src/com/concurrency/task/TaskValidator.java",
"chars": 1437,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\n\n/**\n * 任务验证类,用来执行UserValidation对象作为并发任务的验证过程。指定它实现"
},
{
"path": "04-05-运行多个任务并处理第一个结果/src/com/concurrency/task/UserValidator.java",
"chars": 1208,
"preview": "package com.concurrency.task;\n\nimport java.util.Random;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 用户检验类,实现用户验证过程\n */"
},
{
"path": "04-06-运行多个任务并且处理所有结果/04-06-运行多个任务并且处理所有结果.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-06-运行多个任务并且处理所有结果/src/com/concurrency/core/Main.java",
"chars": 1402,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Result;\nimport com.concurrency.task.Task;\n\nimport java.util.A"
},
{
"path": "04-06-运行多个任务并且处理所有结果/src/com/concurrency/task/Result.java",
"chars": 690,
"preview": "package com.concurrency.task;\n\n/**\n * 结果类,存储中并发任务产生的结果\n */\npublic class Result {\n /**\n * 产生结果的任务的名字\n */\n p"
},
{
"path": "04-06-运行多个任务并且处理所有结果/src/com/concurrency/task/Task.java",
"chars": 1304,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 任务类,实"
},
{
"path": "04-07-在执行器中延时执行任务/04-07-在执行器中延时执行任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-07-在执行器中延时执行任务/src/com/concurrency/core/Main.java",
"chars": 1143,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Task;\n\nimport java.util.Date;\nimport java.util.concurrent.Exe"
},
{
"path": "04-07-在执行器中延时执行任务/src/com/concurrency/task/Task.java",
"chars": 628,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.Callable;\n\n/**\n * 任务类,实现Callable接口,参数化"
},
{
"path": "04-08-在执行器中周期性执行任务/04-08-在执行器中周期性执行任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-08-在执行器中周期性执行任务/src/com/concurrency/core/Main.java",
"chars": 1247,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Task;\n\nimport java.util.Date;\nimport java.util.concurrent.*;\n"
},
{
"path": "04-08-在执行器中周期性执行任务/src/com/concurrency/task/Task.java",
"chars": 457,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\n\n/**\n * 任务类,执行任务\n */\npublic class Task implements Runnable {\n /"
},
{
"path": "04-09-在执行器中取消任务/04-09-在执行器中取消任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-09-在执行器中取消任务/src/com/concurrency/core/Main.java",
"chars": 1138,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Task;\n\nimport java.util.concurrent.Executors;\nimport java.uti"
},
{
"path": "04-09-在执行器中取消任务/src/com/concurrency/task/Task.java",
"chars": 388,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\n\npublic class Task implements Callable<String> {\n "
},
{
"path": "04-10-在执行器中控制任务的完成/04-10-在执行器中控制任务的完成.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-10-在执行器中控制任务的完成/src/com/concurrency/core/Main.java",
"chars": 1479,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.ExecutableTask;\nimport com.concurrency.task.ResultTask;\n\nimpo"
},
{
"path": "04-10-在执行器中控制任务的完成/src/com/concurrency/task/ExecutableTask.java",
"chars": 962,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 任务执行类"
},
{
"path": "04-10-在执行器中控制任务的完成/src/com/concurrency/task/ResultTask.java",
"chars": 728,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.FutureTask;\n\n/**\n * 结果任"
},
{
"path": "04-11-在执行器中分离任务的启动与结果的处理/04-11-在执行器中分离任务的启动与结果的处理.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/core/Main.java",
"chars": 1686,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.ReportProcessor;\nimport com.concurrency.task.ReportRequest;\n\n"
},
{
"path": "04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportGenerator.java",
"chars": 1103,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 报告生成类"
},
{
"path": "04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportProcessor.java",
"chars": 1472,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.CompletionService;\nimport java.util.concurrent.ExecutionExcep"
},
{
"path": "04-11-在执行器中分离任务的启动与结果的处理/src/com/concurrency/task/ReportRequest.java",
"chars": 753,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.CompletionService;\n\n/**\n * 报告请求类\n */\npublic class ReportReque"
},
{
"path": "04-12-处理在执行器中被拒绝的任务/04-12-处理在执行器中被拒绝的任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "04-12-处理在执行器中被拒绝的任务/src/com/concurrency/core/Main.java",
"chars": 1141,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.RejectedTaskController;\nimport com.concurrency.task.Task;\n\nim"
},
{
"path": "04-12-处理在执行器中被拒绝的任务/src/com/concurrency/task/RejectedTaskController.java",
"chars": 795,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.RejectedExecutionHandler;\nimport java.util.concurrent.ThreadP"
},
{
"path": "04-12-处理在执行器中被拒绝的任务/src/com/concurrency/task/Task.java",
"chars": 775,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.TimeUnit;\n\n/**\n * 任务类,执行一个随机时间的任务\n */\npublic class Task imple"
},
{
"path": "05-02-创建Fork-Join线程池/05-02-创建Fork-Join线程池.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "05-02-创建Fork-Join线程池/src/com/concurrency/core/Main.java",
"chars": 1677,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Task;\nimport com.concurrency.utils.Product;\nimport com.concur"
},
{
"path": "05-02-创建Fork-Join线程池/src/com/concurrency/task/Task.java",
"chars": 1701,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.Product;\n\nimport java.util.List;\nimport java.util.concurrent"
},
{
"path": "05-02-创建Fork-Join线程池/src/com/concurrency/utils/Product.java",
"chars": 690,
"preview": "package com.concurrency.utils;\n\n/**\n * 产品类,保存产品的名称和价格\n */\npublic class Product {\n /**\n * 名称\n */\n private S"
},
{
"path": "05-02-创建Fork-Join线程池/src/com/concurrency/utils/ProductListGenerator.java",
"chars": 558,
"preview": "package com.concurrency.utils;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * 产品生成器类,根据指定的数量创建产品\n */\npublic"
},
{
"path": "05-03-合并任务的结果/05-03-合并任务的结果.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "05-03-合并任务的结果/src/com/concurrency/core/Main.java",
"chars": 1940,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.DocumentTask;\nimport com.concurrency.utils.DocumentMock;\n\nimp"
},
{
"path": "05-03-合并任务的结果/src/com/concurrency/task/DocumentTask.java",
"chars": 2785,
"preview": "package com.concurrency.task;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.ExecutionE"
},
{
"path": "05-03-合并任务的结果/src/com/concurrency/task/LineTask.java",
"chars": 2468,
"preview": "package com.concurrency.task;\n\nimport java.util.List;\nimport java.util.concurrent.ExecutionException;\nimport java.util.c"
},
{
"path": "05-03-合并任务的结果/src/com/concurrency/utils/DocumentMock.java",
"chars": 1080,
"preview": "package com.concurrency.utils;\n\nimport java.util.Random;\n\n/**\n * 文档模拟对象,根据指定的列数和每行单词数生成文档\n */\npublic class DocumentMock "
},
{
"path": "05-04-异步运行任务/05-04-异步运行任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "05-04-异步运行任务/src/com/concurrency/core/Main.java",
"chars": 1909,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.FolderProcessor;\n\nimport java.util.List;\nimport java.util.con"
},
{
"path": "05-04-异步运行任务/src/com/concurrency/task/FolderProcessor.java",
"chars": 2241,
"preview": "package com.concurrency.task;\n\nimport java.io.File;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util."
},
{
"path": "05-05-在任务中抛出异常/05-05-在任务中抛出异常.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "05-05-在任务中抛出异常/src/com/concurrency/core/Main.java",
"chars": 963,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Task;\n\nimport java.util.concurrent.ForkJoinPool;\nimport java."
},
{
"path": "05-05-在任务中抛出异常/src/com/concurrency/task/Task.java",
"chars": 1742,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.RecursiveTask;\nimport java.util.concurrent.TimeUnit;\n\n/**\n * "
},
{
"path": "05-06-取消任务/05-06-取消任务.iml",
"chars": 12107,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "05-06-取消任务/src/com/concurrency/core/Main.java",
"chars": 1076,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.TaskManager;\nimport com.concurrency.utils.ArrayGenerator;\nimp"
},
{
"path": "05-06-取消任务/src/com/concurrency/task/TaskManager.java",
"chars": 890,
"preview": "package com.concurrency.task;\n\nimport com.concurrency.utils.SearchNumberTask;\n\nimport java.util.ArrayList;\nimport java.u"
},
{
"path": "05-06-取消任务/src/com/concurrency/utils/ArrayGenerator.java",
"chars": 444,
"preview": "package com.concurrency.utils;\n\nimport java.util.Random;\n\n/**\n * 整形数组生成类\n */\npublic class ArrayGenerator {\n /**\n "
},
{
"path": "05-06-取消任务/src/com/concurrency/utils/SearchNumberTask.java",
"chars": 2950,
"preview": "package com.concurrency.utils;\n\nimport com.concurrency.task.TaskManager;\n\nimport java.util.concurrent.RecursiveTask;\nimp"
},
{
"path": "06-02-使用非阻塞式线程安全列表/06-02-使用非阻塞式线程安全列表.iml",
"chars": 11751,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "06-02-使用非阻塞式线程安全列表/src/com/concurrency/core/Main.java",
"chars": 1439,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.AddTask;\nimport com.concurrency.task.PollTask;\n\nimport java.u"
},
{
"path": "06-02-使用非阻塞式线程安全列表/src/com/concurrency/task/AddTask.java",
"chars": 646,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.ConcurrentLinkedDeque;\n\n/**\n * 添加数据任务类,向并发队列中添加10000个数据\n */\np"
},
{
"path": "06-02-使用非阻塞式线程安全列表/src/com/concurrency/task/PollTask.java",
"chars": 604,
"preview": "package com.concurrency.task;\n\nimport java.util.concurrent.ConcurrentLinkedDeque;\n\n/**\n * 取数据任务类,从并发队列中删除10000个数据\n */\npu"
},
{
"path": "06-03-使用阻塞式线程安全列表/06-03-使用阻塞式线程安全列表.iml",
"chars": 11751,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "06-03-使用阻塞式线程安全列表/src/com/concurrency/core/Main.java",
"chars": 841,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Client;\n\nimport java.util.Date;\nimport java.util.concurrent.L"
},
{
"path": "06-03-使用阻塞式线程安全列表/src/com/concurrency/task/Client.java",
"chars": 1179,
"preview": "package com.concurrency.task;\n\nimport java.util.Date;\nimport java.util.concurrent.LinkedBlockingDeque;\nimport java.util."
},
{
"path": "06-04-使用按优先级排序的阻塞式线程安全列表/06-04-使用按优先级排序的阻塞式线程安全列表.iml",
"chars": 11751,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "06-04-使用按优先级排序的阻塞式线程安全列表/src/com/concurrency/core/Main.java",
"chars": 1355,
"preview": "package com.concurrency.core;\n\nimport com.concurrency.task.Event;\nimport com.concurrency.task.Task;\n\nimport java.util.co"
}
]
// ... and 71 more files (download for full content)
About this extraction
This page contains the full source code of the Wang-Jun-Chao/java-concurrency GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 271 files (974.4 KB), approximately 273.1k tokens, and a symbol index with 618 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.