- 浏览: 121402 次
- 性别:
- 来自: 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
1) Each thread has a boolean interrupted status.
2) 3 interrupt related methods defined in Thread class
public class Thread
{
public void interrupt() {...} // interrupts the target thread
public boolean isInterrupted() {...} //return the interrupted status of the target thread.
//clear the interrupted status of the current thread, and returns its previous value.
//This is the 1st way to clear the interrupted status
public static boolean interrupted() {...}
}
3) Another way the clear the interrupted status is:
When the thread is in blocked status, if you call interrupt() on it, the thread will automatically go to Catch(InterruptedException e){...} block. As soon as the exception is thrown out, the interrupted status will be cleared.
4) interrupt() method acutally does just one thing --- set interrupted status to true. Nothing else. From this point of view, it only makes sense when the thread is monitoring the interrupted status.
The thread will monitor the interrupted status only under 1 situation --- the thread is in blocked status which is wrapped with catch(InterruptedException e){}
1) thread.sleeping()
2) object.waiting()
3) BlockedQueue operations
4) Lock.lockInteruptibly()
What I want to say is, very likely, interrupt() method doesn't work for some thread, it means those threads are not interruptable.
So, just one sentence to summary,
If the current line of code is monitored by InterruptedException, then, if you interrupt it at the time or before that, it will work. Otherwise, just everthing in vain---setting interrupted status to true means nothing!
发表评论
-
javadoc for Cyclic Barrier
2009-04-24 12:48 848java.util.concurrent.CyclicBarr ... -
Delayed interface and Delay Queue
2009-04-22 17:42 1000/** * A standard implementati ... -
Count Down Latch example code
2009-04-22 10:38 1089Key point : 1) 1 task is co ... -
3 ways to break dead lock
2009-04-21 17:30 7031) supply special resources. ... -
Blocking Queue Usage
2009-04-20 11:21 7943 implementations: LinkedBlocki ... -
The usage of Lock and Condition
2009-04-18 12:31 1038//: concurrency/waxomatic2/WaxO ... -
Re entrantLock usage
2009-04-15 17:15 1289a thread can be really interru ... -
new interrupt in java5
2009-04-15 12:08 634In Java 5, Thread.interrupt() i ... -
Executor Service Usage
2009-04-14 18:18 861ExecutorService exec = Executor ... -
Thread Local usage
2009-04-14 17:46 760ThreadLocal usage – from Javado ... -
Timer TimerTask usage
2009-04-14 12:03 688Timer typical usage new Tim ... -
wait, notify及线程通讯机制
2009-02-26 22:42 8031) wait(), notify() 方法被调用的时候,只要 ... -
Java Thread programming basical knowledge
2009-02-26 22:40 925yield() : Give a hint to the th ... -
Count Down Latch explanation
2008-10-02 10:29 897Very important paragraph on how ... -
Scheduled Executor Service
2008-07-22 11:27 1060Executor can return Executor, E ... -
Executor usage
2008-07-22 11:04 843Executor is used to arrange thr ... -
Callable Usage
2008-07-22 10:24 884The important thing need to loo ...
相关推荐
com interrupt void interrupt 4 using 3
Interrupt Example in MPLABX XC8 Compiler
MCS51 中断interrupt
ARM Generic Interrupt Spec, refenrence manual for arm operating sytem development
程序名称:interrupt.asm 程序说明:74HC595驱动数码管动态显示例,通过按键触发外部中断,P3.2进行计数,P3.3清零,实验箱上完成 算法说明:由两片74HC595芯片分别驱动段和位,数码管动态扫描显示:修改延时子...
interrupt,讲述飞思卡尔HCS12系列芯片的中断处理控制。
DOS 终端描述 bios interrupt , dos interrupt,interrupt services DOS,BIOS,EMS and MOUSE
The Generic Interrupt Controller (GIC) architecture defines: • the architectural requirements for handling all interrupt sources for any processor connected to a GIC • a common interrupt controller ...
微机接口课程实验interrupt.asm
ARM Generic Interrupt Controller Architecture Specification (GIC architecture version 3.0 and version 4.0)
Detection of Excessive Interrupt Disablement - a new feature which can detect a period of excessive interrupt disablement on a CPU, and create an error log record to report it. This allows you to know...
Ralf Brown's Interrupt List 中断大全
ARM Generic Interrupt Controller Architecture Specification 官方手册
解释void timer0() interrupt 1 using 2
电子-7interrupt.pdf,物联网/通信技术2.4G无线通信
Interrupt Services DOS, BIOS, EMS and Mouse 重温旧时代的DOS/BIOS资料,玩裸机编程也可以参考的。 非扫描pdf e文
switch_counter_interrupt_TivaWare.c
interrupt code
线程的thread.interrupt()方法是中断线程,将会设置该线程的中断状态位,即设置为true,中断的结果线程是死亡、还是等待新的任务或是继续运行至下一步,就取决于这个程序本身。线程会不时地检测这个中断标示位,以...