mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix method
This commit is contained in:
parent
237d6dbe2e
commit
07a11f2baa
@ -9,6 +9,7 @@
|
|||||||
* 【core 】 增加AsyncUtil(pr#457@Gitee)
|
* 【core 】 增加AsyncUtil(pr#457@Gitee)
|
||||||
* 【http 】 增加HttpResource(issue#1943@Github)
|
* 【http 】 增加HttpResource(issue#1943@Github)
|
||||||
* 【http 】 增加BytesBody、FormUrlEncodedBody
|
* 【http 】 增加BytesBody、FormUrlEncodedBody
|
||||||
|
* 【cron 】 TaskTable.remove增加返回值
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
||||||
|
|
||||||
|
@ -128,21 +128,24 @@ public class TaskTable implements Serializable {
|
|||||||
* 移除Task
|
* 移除Task
|
||||||
*
|
*
|
||||||
* @param id Task的ID
|
* @param id Task的ID
|
||||||
|
* @return 是否成功移除,{@code false}表示未找到对应ID的任务
|
||||||
*/
|
*/
|
||||||
public void remove(String id) {
|
public boolean remove(String id) {
|
||||||
final Lock writeLock = lock.writeLock();
|
final Lock writeLock = lock.writeLock();
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
final int index = ids.indexOf(id);
|
final int index = ids.indexOf(id);
|
||||||
if (index > -1) {
|
if (index < 0) {
|
||||||
tasks.remove(index);
|
return false;
|
||||||
patterns.remove(index);
|
|
||||||
ids.remove(index);
|
|
||||||
size--;
|
|
||||||
}
|
}
|
||||||
|
tasks.remove(index);
|
||||||
|
patterns.remove(index);
|
||||||
|
ids.remove(index);
|
||||||
|
size--;
|
||||||
} finally {
|
} finally {
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -282,4 +285,4 @@ public class TaskTable implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user