• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Interruptible类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BehaviorSkinBase类代码示例发布时间:2022-05-21
下一篇:
Java StringResult类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap