INTRODUCTION
This is a short document explaining the structure of the code examples of the
chapter two and the instructions to import and run the examples in Eclipse.
STRUCTURE
There are nine examples in this chapter. One example per recipe except the recipe 1
which has two projects. Every example are sent as an Eclipse project in a separate
subfolder. These projects are
-ch2_recipe1_problem: This example presents the problems we can find when we work
with shared data in concurrent applications. The example simulates a bank account
and two process, one that inserts money and one that takes off money. The final
results obtained are inconsistent.
-ch2_recipe1_solution: This example is a version of the previous example. We have
added the syncrhonized keyword to resolve the problem presented in that example.
-ch2_recipe2: This example shows the use of the syncrhonized keyword to
synchronize a block of code instead of a complete method. It implements a program
that stores the number of people inside a building and two sensors that
control the people that come in or go out the building.
-ch2_recipe3: This example shows how two work with independent shared attributes
inside an object and the syncrhonized keyword to get a good performance. It
implements a program that control the vacancies of two cinemas and two ticket
offices that can sell tickets for one of the two cinemas.
-ch2_recipe4: This example shows how to use the syncrhonized keyword and the
wait(), signal() and signalAll() methods to implement the producer-consumer problem
-ch2_recipe5: This example shows how to use locks in Java to syncrhonize a block
of code. It implements a program that simulates a print queue.
-ch2_recipe6: This example shows how to use read/write locks. It implements a
program that reads and writes the information of the prices of two products.
-ch2_recipe7: This example shows how to modify the fairness of the locks. It
modifies the program that simulates the print queue implemented in the recipe5.
-ch2_recipe8: This example shows how to use multiple conditions in a lock. It
implements the producer-consumer problem.
RUNNING THE EXAMPLES
To run the examples, use the import option of the Eclipse IDE. In the menu File,
select the option Import. Then, select the option Existing Projects in the
Workspace, select one of the directories and click the Finish button.
Then, run the examples as a normal project in Eclipse.
没有合适的资源?快使用搜索试试~ 我知道了~
Java 7 Concurrency Cookbook源码
共776个文件
java:257个
class:256个
classpath:83个
5星 · 超过95%的资源 需积分: 9 9 下载量 88 浏览量
2015-12-23
18:06:13
上传
评论
收藏 1.12MB ZIP 举报
温馨提示
Java 7 Concurrency Cookbook 中文名:Java 7 并发编程指南,中文版见http://ifeve.com/java-7-concurrency-cookbook/,这本书是学习并发的绝好书籍,我在网上找了好久才找到源代码,所以收点积分
资源推荐
资源详情
资源评论
收起资源包目录
Java 7 Concurrency Cookbook源码 (776个子文件)
MyExecutor.class 4KB
FileSearch.class 4KB
Main.class 3KB
MyPriorityTransferQueue.class 3KB
MyScheduledTask.class 3KB
Main.class 3KB
Main.class 3KB
SearchNumberTask.class 3KB
FolderProcessor.class 3KB
DocumentTask.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
Buffer.class 3KB
Main.class 3KB
Main.class 3KB
Main.class 3KB
MyRecursiveTask.class 2KB
LineTask.class 2KB
Student.class 2KB
PrintQueue.class 2KB
Main.class 2KB
Searcher.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Task.class 2KB
Main.class 2KB
MyScheduledThreadPoolExecutor.class 2KB
Main.class 2KB
Main.class 2KB
MyThreadFactory.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Task.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Producer.class 2KB
Main.class 2KB
Task.class 2KB
ReportProcessor.class 2KB
Main.class 2KB
Main.class 2KB
FileSearch.class 2KB
Task.class 2KB
Main.class 2KB
FileSearch.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
MyLock.class 2KB
Main.class 2KB
SearchTask.class 2KB
CleanerTask.class 2KB
ProducerConsumerTest.class 2KB
MyThread.class 2KB
Main.class 2KB
Main.class 2KB
Consumer.class 2KB
ReportGenerator.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
Client.class 2KB
Main.class 2KB
Consumer.class 2KB
Main.class 2KB
Main.class 2KB
Main.class 2KB
BuildStats.class 2KB
BuildStats.class 2KB
WriterTask.class 2KB
PrintQueue.class 2KB
MyPhaser.class 2KB
MyPriorityTask.class 2KB
Task.class 2KB
Main.class 2KB
Task.class 2KB
MyWorkerTask.class 2KB
Main.class 2KB
ExecutableTask.class 2KB
MyWorkerThread.class 2KB
Task.class 2KB
Task.class 2KB
Task.class 2KB
MyThread.class 2KB
Main.class 2KB
共 776 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- 小-石-子2019-04-08感谢整理,很全
绿光
- 粉丝: 17
- 资源: 52
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功