本文整理汇总了Java中sun.nio.ch.Interruptible类的典型用法代码示例。如果您正苦于以下问题:Java Interruptible类的具体用法?Java Interruptible怎么用?Java Interruptible使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interruptible类属于sun.nio.ch包,在下文中一共展示了Interruptible类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
/** Set thread's blocker field. */
void blockedOn(Thread t, Interruptible b);
开发者ID:tranleduy2000,项目名称:javaide,代码行数:3,代码来源:JavaLangAccess.java
示例2: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
void blockedOn(Interruptible b) {
synchronized (blockerLock) {
blocker = b;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:Thread.java
示例3: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
static void blockedOn(Interruptible intr) { // package-private
sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(),
intr);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:AbstractInterruptibleChannel.java
示例4: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
static void blockedOn(Interruptible intr) { // package-private
SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(), intr);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:AbstractInterruptibleChannel.java
示例5: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
private static void blockedOn(Interruptible interruptible) {
sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(), interruptible);
}
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:4,代码来源:JobRunnerDelegate.java
示例6: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
static void blockedOn(Interruptible intr) { // package-private
sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(), intr);
}
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:4,代码来源:InterruptRead.java
示例7: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
void blockedOn(Interruptible b) {
synchronized (blockerLock) {
blocker = b;
}
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:6,代码来源:Thread.java
示例8: blockedOn
import sun.nio.ch.Interruptible; //导入依赖的package包/类
static void blockedOn(Interruptible intr) { // package-private
sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(),
intr);
}
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:AbstractInterruptibleChannel.java
示例9: interrupt
import sun.nio.ch.Interruptible; //导入依赖的package包/类
/**
* Interrupts this thread.
*
* <p> Unless the current thread is interrupting itself, which is
* always permitted, the {@link #checkAccess() checkAccess} method
* of this thread is invoked, which may cause a {@link
* SecurityException} to be thrown.
*
* <p> If this thread is blocked in an invocation of the {@link
* Object#wait() wait()}, {@link Object#wait(long) wait(long)}, or {@link
* Object#wait(long, int) wait(long, int)} methods of the {@link Object}
* class, or of the {@link #join()}, {@link #join(long)}, {@link
* #join(long, int)}, {@link #sleep(long)}, or {@link #sleep(long, int)},
* methods of this class, then its interrupt status will be cleared and it
* will receive an {@link InterruptedException}.
如果线程正处在waiting状态,那么它的中断状态将被清除,并收到一个InterruptedException异常
*
* <p> If this thread is blocked in an I/O operation upon an {@link
* java.nio.channels.InterruptibleChannel </code>interruptible
* channel<code>} then the channel will be closed, the thread's interrupt
* status will be set, and the thread will receive a {@link
* java.nio.channels.ClosedByInterruptException}.
*
* <p> If this thread is blocked in a {@link java.nio.channels.Selector}
* then the thread's interrupt status will be set and it will return
* immediately from the selection operation, possibly with a non-zero
* value, just as if the selector's {@link
* java.nio.channels.Selector#wakeup wakeup} method were invoked.
如果block在io操作上,那么中断状态将被设置,并且抛出相应异常。
*
* <p> If none of the previous conditions hold then this thread's interrupt
* status will be set. </p>
*
如果不是以上任何一种情况,那么线程的中断状态将被设置。
* <p> Interrupting a thread that is not alive need not have any effect.
*
* @throws SecurityException
* if the current thread cannot modify this thread
*
* @revised 6.0
* @spec JSR-51
*/
public void interrupt() {
if (this != Thread.currentThread())
checkAccess();
synchronized (blockerLock) {
//用来实现block在可中断io操作上的线程
Interruptible b = blocker;
if (b != null) {
interrupt0(); // Just to set the interrupt flag
b.interrupt(this);
return;
}
}
interrupt0();
}
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:59,代码来源:Thread.java
注:本文中的sun.nio.ch.Interruptible类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论