zuoshang 2014-07-18 11:31
浏览 270
已采纳

发现commons-io包里有一个类叫ThreadMonitor,居然不是public的!

这么有意思的类居然不是public,还能不能愉快的玩耍了。。。

[code="java"]
/**

  • Monitors a thread, interrupting it if it reaches the specified timeout.
  • This works by sleeping until the specified timeout amount and then
  • interrupting the thread being monitored. If the thread being monitored
  • completes its work before being interrupted, it should interrupt()
  • the monitor thread.
  • long timeoutInMillis = 1000;
  • try {
  • Thread monitor = ThreadMonitor.start(timeoutInMillis);
  • // do some work here
  • ThreadMonitor.stop(monitor);
  • } catch (InterruptedException e) {
  • // timed amount was reached
  • }
  • *
  • @version $Id$ */[/code]
  • 写回答

2条回答 默认 最新

  • iteye_11009 2014-07-19 00:18
    关注

    方法不是公共的很正常啊 别人写的保护方法而已 你也可以写保护方法 看好你哦!!呵呵

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计