mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix method
This commit is contained in:
@@ -128,21 +128,24 @@ public class TaskTable implements Serializable {
|
||||
* 移除Task
|
||||
*
|
||||
* @param id Task的ID
|
||||
* @return 是否成功移除,{@code false}表示未找到对应ID的任务
|
||||
*/
|
||||
public void remove(String id) {
|
||||
public boolean remove(String id) {
|
||||
final Lock writeLock = lock.writeLock();
|
||||
writeLock.lock();
|
||||
try {
|
||||
final int index = ids.indexOf(id);
|
||||
if (index > -1) {
|
||||
tasks.remove(index);
|
||||
patterns.remove(index);
|
||||
ids.remove(index);
|
||||
size--;
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
tasks.remove(index);
|
||||
patterns.remove(index);
|
||||
ids.remove(index);
|
||||
size--;
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,4 +285,4 @@ public class TaskTable implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user