V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  nothingistrue  ›  全部回复第 110 页 / 共 110 页
回复总数  2189
1 ... 101  102  103  104  105  106  107  108  109  110  
2022-03-10 14:38:47 +08:00
回复了 git00ll 创建的主题 Java 请教大家一个问题,线程池何时清理中断状态的,追源码没找到
Run1 后面的代码不会清除中断状态,如果没有其他东西干涉,这俩 isInterrupted 要都是 true 。但是上面的情况对 Run2 不合理,所以肯定要有啥东西来做干涉,这事前面的人回复的更好。
2022-03-10 14:32:34 +08:00
回复了 git00ll 创建的主题 Java 请教大家一个问题,线程池何时清理中断状态的,追源码没找到
isInterrupted 表示的不是线程是否中断(阻塞),而是该线程是否刚收到其他线程给他的中断信号。你这里只有一个线程,没有线程之间的通信,所以 isInterrupted 应该恒定返回 false 。不过,你的 Run1 自己给自己了一个中断信号,导致 isInterrupted = true 。

interrupt()这个方法(注意还有一个 interrupted 方法,这俩不一样)的实际作用是给目标线程一个“请你中断”的信号,并不是中断目标线程,目标线程做啥反应,是由目标线程自身决定的。Thread.currentThread().interrupt(),这样自己给自己中断信号,是一个很怪的操作。
2022-03-10 13:56:38 +08:00
回复了 golangLover 创建的主题 Java 如何消除 Log 的重复代码?
lombok 省事,但是这个是语法糖不是代码模板,用起来有争议。

可以考虑用包装方法把 checked exception 变成 unchecked exception 。例如:
writeValueAsStringNonChecked(ObjectMapper mapper, Object object){
try {
mapper.writeValueAsString(object);
}catch(JsonProcessingException e){
throw new RuntimeException(e);// 用得多了还可以考虑定义一个专用异常
}
}
这个方法放在哪里很自由,看你的工程规范。
2022-03-10 13:43:44 +08:00
回复了 sky96111 创建的主题 Android 检测 Root 的应用越来越多,求推荐一款 Android 备用机
加点钱,上去年、前年、甚至大前年的旗舰级,旗舰翻新机也可以。其他牌子我不清楚,我主力机用得是三星前一年的旗舰级,用了 2 年除了系统换港版外没任何不适。

单纯备用机的话,还可以考虑二手 Iphone ,这个我用了 4 年了。
2022-03-10 13:38:08 +08:00
回复了 Kiriri 创建的主题 程序员 突然想去外包了,听说外包到国企 965 不加班
前提是你要准备拿外包当跳板进编制,哪怕是要当 10 年以上的跳板。外包最大的问题不是当前如何,而是以后如何。要是你那这种外包当常态,那你就是那种一有风吹草动就被优化掉或者顶上去的临时工。
2019-11-22 15:26:56 +08:00
回复了 nothingistrue 创建的主题 全球工单系统 163,你家 Maven 镜像用不了了
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in ~~~~~maven.aliyun~~~~/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1]

这就是阿里 Maven 镜像干得好事,org.apache.maven.plugins:maven-clean-plugin:2.5,这个包它竟然没有。
2019-11-22 15:17:49 +08:00
回复了 nothingistrue 创建的主题 全球工单系统 163,你家 Maven 镜像用不了了
阿里 Maven 不是官方镜像,而是 jcenter 的镜像,貌似还有魔改,经常出问题。网易你家的已不能访问,现在老难受。
2019-11-22 15:14:40 +08:00
回复了 nothingistrue 创建的主题 全球工单系统 163,你家 Maven 镜像用不了了
所有链接都是 http,不是 https。
2019-11-22 15:12:32 +08:00
回复了 nothingistrue 创建的主题 全球工单系统 163,你家 Maven 镜像用不了了
好吧,虽然链接都表面上去掉了,貌似还是过不了后台,我再打下码,凑合着看吧。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy (copy-winsw-exe) on project xxxxxxxxr: Unable to find/resolve artifact.: Failed to read artifact descriptor for com.sun.winsw:winsw:exe:bin:2.1.2: Could not transfer artifact com.sun.winsw:winsw:pom:2.1.2 from/to nexus-163 (~~~~~~~~~~~~~repository/maven-public/): Failed to transfer file:~~~~~~~~~/repository/maven-public/com/sun/winsw/winsw/2.1.2/winsw-2.1.2.pom. Return code is: 504, ReasonPhrase: Gateway Time-out. -> [Help 1]
1 ... 101  102  103  104  105  106  107  108  109  110  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1696 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 38ms · UTC 16:20 · PVG 00:20 · LAX 09:20 · JFK 12:20
♥ Do have faith in what you're doing.