package blockingtest;

/**
* Hello world!
*/
public class Sync implements Runnable {
int n; public static void main(String[] args) {
Sync sync = new Sync();
new Thread(sync, "Sync1").start();
new Thread(sync, "Sync2").start();
new Thread(sync, "Sync3").start();
} public void run() {
for (int i = 0; i < 3; i++) {
inc();
}
} public synchronized void inc() {
n++;
System.out.print(Thread.currentThread().getName() + "\n");
try {
Thread.sleep(10000);
} catch (Exception ex) {
System.out.print(ex.getMessage());
} }
}

blocking的更多相关文章

  1. blocking and unblocking mechanism for linux drivern code

    概念: 1> 阻塞操作      是指在执行设备操作时,若不能获得资源,则挂起进程直到满足操作条件后再进行操作.被挂起的进程进入休眠,被从调度器移走,直到条件满足: 2> 非阻塞操作  在 ...

  2. 【异常】No ManagedConnections available within configured blocking timeout

    Caused by: org.jboss.util.NestedSQLException: No ManagedConnections available within configured bloc ...

  3. SSRS ReportServer Database 的Blocking问题

    我们监控SQL SERVER数据库的阻塞情况时,老是收到在SSRS 里面出现SQL阻塞情况,刚开始由于事情多,没有太关注ReportServerTempDB里面的会话阻塞情况,但是老是出现这种频繁阻塞 ...

  4. Socket Receive 避免 Blocking

    我们知道 Socket Blocking 属性默认true . 表明Socket 处于同步调用 , Connect , 或 Send , Receive 需等待动作 完成才能继续执行. 有一种应用场景 ...

  5. Atitit  五种IO模型attilax总结 blocking和non-blocking synchronous IO和asynchronous I

    Atitit  五种IO模型attilax总结 blocking和non-blocking synchronous IO和asynchronous I   1.1. .3 进程的阻塞1 1.2. 网络 ...

  6. Java Blocking Queue

    //Listing 8-1. The Blocking Queue Equivalent of Chapter 3’s PC Application import java.util.concurre ...

  7. Ehcache(2.9.x) - API Developer Guide, Blocking and Self Populating Caches

    About Blocking and Self-Populating Caches The net.sf.ehcache.constructs package contains some applie ...

  8. SQL Server: Difference Between Locking, Blocking and Dead Locking

    Like ever, today’s article of Pinal Dave was interesting and informative. After, our mutual discussi ...

  9. New Lantern Version Available Upgrade Lantern for improved blocking resistance!

    New Lantern Version Available Upgrade Lantern for improved blocking resistance! The new version: is ...

  10. linux select 与 阻塞( blocking ) 及非阻塞 (non blocking)实现io多路复用的示例

    除了自己实现之外,还有个c语言写的基于事件的开源网络库:libevent http://www.cnblogs.com/Anker/p/3265058.html 最简单的select示例: #incl ...

随机推荐

  1. 如何用命令行执行loadrunner的脚本

    SET M_ROOT=D:\Mercury Interactive\Mercury LoadRunner\bin cd %M_ROOT% wlrun.exe -TestPath D:\ceshi10\ ...

  2. rpm基本命令参考

    水可载舟,亦可覆舟! 1. 介绍 在Linux操作系统中,常用的软件有RPM包软件包,src.rpm格式的软件包(源码),以源代码发布的软件包以及.bin格式软件包和绿色软件.如果采用.rpm格式的软 ...

  3. TL认证和运作经典案例评选

    评选背景: 1.TL能力模型推出一年多时间以来,各地区.部门的TL认证和运作如火如荼,中开社上已有部分案例输出: 2.有部门在认证和运作上希望能借鉴优秀案例的经验,并且更希望能得到本地其他部门的帮扶: ...

  4. 《数字图像处理原理与实践(MATLAB版)》一书之代码Part5

    <数字图像处理原理与实践(MATLAB版)>一书之代码Part5 本文系<数字图像处理原理与实践(MATLAB版)>一书之代码系列的Part5.辑录该书第225至第280页之代 ...

  5. ZOJ 1457 Prime Ring Problem(dfs+剪枝)

     Prime Ring Problem Time Limit: 10 Seconds      Memory Limit: 32768 KB A ring is compose of n circ ...

  6. 【LeetCode】Binary Tree Upside Down

    Binary Tree Upside Down Given a binary tree where all the right nodes are either leaf nodes with a s ...

  7. 树莓派进阶之路 (029) - 语音识别模块 LD3320(原创)

    近几天听朋友有说到LD3320 语音模块,刚好身边有块树莓派3,就在某宝上买了块自带mcu的LD3320 . 准备: 树莓派一个(配置了wiringPi开发环境的详情见本人博客:树莓派进阶之路 (00 ...

  8. HDU 2208 唉,可爱的小朋友(DFS)

    唉,可爱的小朋友 Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  9. 【jsp】Servlet与jsp之间的传值

    Servlet与JSP 之间的传值有两种情况:JSP -> Servlet, Servlet -> JSP. 通过对象 request和 session (不考虑 application) ...

  10. js 对文件操作

    下面是对此知识的系统介绍(转自互联网): Javascript是网页制作中离不开的脚本语言,依靠它,一个网页的内容才生动活泼.富有朝气.但也许你还没有发现并应用它的一些更高级的功能吧?比如,对文件和文 ...