- 浏览: 126933 次
- 性别:
- 来自: Singapore
文章分类
- 全部博客 (112)
- Tiger Thread (18)
- Perforce (6)
- Spring (5)
- maven (3)
- log4j (3)
- Quartz Scheduler (4)
- unix and linux (12)
- hibernate (3)
- Enum (1)
- Futures and Options (1)
- Market Making (2)
- Java Basic (11)
- Tibco EMS (3)
- F I X message (5)
- equity derivative (2)
- Sybase (3)
- XML (1)
- JUnit (2)
- J A X B 2.0 (1)
- N I O (1)
- windows batch file (1)
- Cruise Control (1)
- util Class (5)
- ant (1)
- JMS (1)
- profiling (0)
- Sql Server (6)
- GXT (2)
- eclipse (1)
- Generics (1)
- Tibco RV (3)
- Autosys (0)
- Message (1)
最新评论
-
houzhe11:
<property name="proxyTa ...
AOP usage -- BeanNameAutoProxyCreator usage
A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. The barrier is called cyclic because it can be re-used after the waiting threads are released.
A CyclicBarrier supports an optional Runnable
command that is run once per barrier point, after the last thread in the party arrives, but before any threads are released. This barrier action is useful for updating shared-state before any of the parties continue.
Sample usage: Here is an example of using a barrier in a parallel decomposition design:
class Solver { final int N; final float[][] data; final CyclicBarrier barrier; class Worker implements Runnable { int myRow; Worker(int row) { myRow = row; } public void run() { while (!done()) { processRow(myRow); try { barrier.await(); } catch (InterruptedException ex) { return; } catch (BrokenBarrierException ex) { return; } } } } public Solver(float[][] matrix) { data = matrix; N = matrix.length; barrier = new CyclicBarrier(N, new Runnable() { public void run() { mergeRows(...); } }); for (int i = 0; i < N; ++i) new Thread(new Worker(i)).start(); waitUntilDone(); } }
Here, each worker thread processes a row of the matrix then waits at the barrier until all rows have been processed. When all rows are processed the supplied Runnable
barrier action is executed and merges the rows. If the merger determines that a solution has been found then done() will return true and each worker will terminate.
If the barrier action does not rely on the parties being suspended when it is executed, then any of the threads in the party could execute that action when it is released. To facilitate this, each invocation of await
returns the arrival index of that thread at the barrier. You can then choose which thread should execute the barrier action, for example:
if (barrier.await() == 0) { // log the completion of this iteration }
The CyclicBarrier uses a fast-fail all-or-none breakage model for failed synchronization attempts: If a thread leaves a barrier point prematurely because of interruption, failure, or timeout, all other threads, even those that have not yet resumed from a previous await
, will also leave abnormally via BrokenBarrierException
(or InterruptedException if they too were interrupted at about the same time).
发表评论
-
Delayed interface and Delay Queue
2009-04-22 17:42 1053/** * A standard implementati ... -
Count Down Latch example code
2009-04-22 10:38 1154Key point : 1) 1 task is co ... -
3 ways to break dead lock
2009-04-21 17:30 7621) supply special resources. ... -
Blocking Queue Usage
2009-04-20 11:21 8323 implementations: LinkedBlocki ... -
The usage of Lock and Condition
2009-04-18 12:31 1069//: concurrency/waxomatic2/WaxO ... -
Re entrantLock usage
2009-04-15 17:15 1320a thread can be really interru ... -
new interrupt in java5
2009-04-15 12:08 658In Java 5, Thread.interrupt() i ... -
interrupt
2009-04-15 10:57 8171) Each thread has a boolean in ... -
Executor Service Usage
2009-04-14 18:18 894ExecutorService exec = Executor ... -
Thread Local usage
2009-04-14 17:46 817ThreadLocal usage – from Javado ... -
Timer TimerTask usage
2009-04-14 12:03 724Timer typical usage new Tim ... -
wait, notify及线程通讯机制
2009-02-26 22:42 8501) wait(), notify() 方法被调用的时候,只要 ... -
Java Thread programming basical knowledge
2009-02-26 22:40 1088yield() : Give a hint to the th ... -
Count Down Latch explanation
2008-10-02 10:29 957Very important paragraph on how ... -
Scheduled Executor Service
2008-07-22 11:27 1106Executor can return Executor, E ... -
Executor usage
2008-07-22 11:04 903Executor is used to arrange thr ... -
Callable Usage
2008-07-22 10:24 933The important thing need to loo ...
相关推荐
**SIP API for Java 2 Micro Edition Javadoc** 是Java平台微型版(Java ME)中用于处理会话初始化协议(Session Initiation Protocol, SIP)的应用编程接口文档。SIP是一种互联网协议,主要用于建立、修改和终止...
javadoc插件使用文档 javadoc是Sun公司提供的一个技术,它从程序源代码中抽取类、方法、成员等注释形成一个和源代码配套的API帮助文档。javadoc工具能够从下列对象中提取出消息:包、公共类、公共接口、公共可能受...
对于开发者来说,掌握如何在集成开发环境中导出Javadoc是非常重要的,特别是在使用MyEclipse这样的IDE时。下面将详细解释在MyEclipse中导出Javadoc的步骤。 步骤一:选择项目 首先,打开MyEclipse,找到你想要生成...
idea easy_javadoc插件
Eclipse 与 Javadoc 配置解决方案 Eclipse 是一个功能强大且流行的集成开发环境(IDE),而 Javadoc 是 Java 官方提供的 API 文档生成工具。然而,在 Eclipse 中配置 Javadoc 并不是一件容易的事情。本文将详细介绍...
JavaDoc2CHM工具是一款专为Java开发者设计的实用程序,它能够将JavaDoc文档转换成Windows帮助文件(.chm)格式。这种格式在Windows系统中广泛使用,便于离线查看和检索API文档。通过将JavaDoc转换为CHM,开发者可以...
Redis-Service JavaDoc 是一个关于使用Java编程语言与Redis数据库进行交互的文档集,它包含了丰富的API参考和类库说明。Redis是一个高性能的键值存储系统,常被用于缓存、消息队列以及数据持久化等多种场景。JavaDoc...
**Javadoc详解与生成方法** Javadoc是一种在Java编程语言中用于生成API文档的工具,它能够自动提取源代码中的注释,形成清晰、结构化的文档,方便开发者理解和使用代码库。本文将深入探讨Javadoc的基本概念、语法、...
### Eclipse中设置javadoc中文帮助文档 #### 一、引言 在软件开发过程中,良好的文档支持对于提高工作效率至关重要。Eclipse作为一款广泛使用的集成开发环境(IDE),提供了丰富的功能来辅助开发者的工作。其中,...
JavaDoc文档是Java编程语言中一个非常重要的工具,它用于生成关于Java源代码的API文档。这个工具通过解析源代码中的注释(Javadoc注释),生成易于阅读和理解的HTML格式文档,使得开发者能够方便地了解类、接口、...
- **Options for Javadoc**:提供一系列选项供你选择,例如是否包含包、类、字段、构造函数、方法等的文档,以及是否显示私有成员、过时成员等。 5. **完成导出**:检查所有设置无误后,点击“Finish”按钮,...
在Eclipse这样的集成开发环境中,创建Javadoc变得非常方便。以下是使用Eclipse创建Javadoc的详细步骤: 首先,确保你的Eclipse环境已经安装了必要的插件,例如MyEclipse 5.0,虽然这个版本可能较旧,但大多数现代...
JavaDoc是Java编程语言中一个强大的工具,用于生成关于源代码的API文档。这个"JavaDoc(1.8中文版)"是JDK1.8版本的官方中文帮助文档,为开发者提供了详细的API接口、类、方法等信息,使得Java开发者能够更加方便地...
JavaDoc生成API文档(powernode document)(内含源代码和导出的文档) 1.1 JavaDoc概述 1.2 文档注释的格式 1.3 IDEA生成API文档 vaDoc是Java自带的一种工具,其可以从程序源代码中抽取类、方法、属性等注释形成一...
`android-javadoc` 是一个专门为Android开发者提供的Java API文档,它详细地阐述了Android SDK中的各个类、接口、方法及其使用方式。通过这份文档,开发者可以深入理解Android系统的工作原理,从而更有效地编写应用...
Eclipse中设置中文javadoc Eclipse是一个功能强大的集成开发环境(IDE),广泛应用于Java开发领域。然而,默认情况下,Eclipse中的javadoc提示都是英文的,这对一些不熟悉英文的开发者来说是个不小的障碍。幸运的是...
本文将深入探讨如何在Eclipse这一流行的集成开发环境(IDE)中导入并使用中文JavaDoc,这对于非英语母语的开发者来说尤其重要。 ### 一、JavaDoc与Eclipse JavaDoc是一种自动生成API文档的工具,它允许程序员通过...
然而,在某些情况下,用户可能希望将JavaDoc转换为CHM(Compiled Help Manual)文件,这是一种微软的编译帮助文件格式,常见于Windows平台上的软件帮助文档。CHM文件具有离线浏览、全文搜索等功能,更适合桌面应用的...
javadoc 注释规范 javadoc 是 Java 语言中的一种文档注释工具,用于生成 HTML 格式的文档。根据给定的文件信息,我们可以总结出以下知识点: 一、javadoc 注释的基本格式 javadoc 注释以「/」开头,以「*/」结尾...