diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java index e14da3733ef..d83ea64ab48 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java @@ -289,41 +289,34 @@ public class CoreAdminHandler extends RequestHandlerBase { } /** - * Helper method to add a task to a tracking map. + * Helper method to add a task to a tracking type. */ - void addTask(String map, TaskObject o, boolean limit) { - synchronized (getRequestStatusMap(map)) { - if(limit && getRequestStatusMap(map).size() == MAX_TRACKED_REQUESTS) { - String key = getRequestStatusMap(map).entrySet().iterator().next().getKey(); - getRequestStatusMap(map).remove(key); + void addTask(String type, TaskObject o, boolean limit) { + synchronized (getRequestStatusMap(type)) { + if(limit && getRequestStatusMap(type).size() == MAX_TRACKED_REQUESTS) { + String key = getRequestStatusMap(type).entrySet().iterator().next().getKey(); + getRequestStatusMap(type).remove(key); } - addTask(map, o); + addTask(type, o); } } - void addTask(String map, TaskObject o) { - synchronized (getRequestStatusMap(map)) { - getRequestStatusMap(map).put(o.taskId, o); + private void addTask(String type, TaskObject o) { + synchronized (getRequestStatusMap(type)) { + getRequestStatusMap(type).put(o.taskId, o); } } /** * Helper method to remove a task from a tracking map. */ - void removeTask(String map, String taskId) { + private void removeTask(String map, String taskId) { synchronized (getRequestStatusMap(map)) { getRequestStatusMap(map).remove(taskId); } } - /** - * Helper method to check if a map contains a taskObject with the given taskId. - */ - boolean mapContainsTask(String map, String taskId) { - return getRequestStatusMap(map).containsKey(taskId); - } - /** * Helper method to get a request status map given the name. */ diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java index 2ad90f0344b..bbee01a28a7 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java @@ -734,12 +734,12 @@ enum CoreAdminOperation { String requestId = params.get(CoreAdminParams.REQUESTID); log.info("Checking request status for : " + requestId); - if (callInfo.handler.mapContainsTask(RUNNING, requestId)) { + if (callInfo.handler.getRequestStatusMap(RUNNING).containsKey(requestId)) { callInfo.rsp.add(RESPONSE_STATUS, RUNNING); - } else if (callInfo.handler.mapContainsTask(COMPLETED, requestId)) { + } else if (callInfo.handler.getRequestStatusMap(COMPLETED).containsKey(requestId)) { callInfo.rsp.add(RESPONSE_STATUS, COMPLETED); callInfo.rsp.add(RESPONSE, callInfo.handler.getRequestStatusMap(COMPLETED).get(requestId).getRspObject()); - } else if (callInfo.handler.mapContainsTask(FAILED, requestId)) { + } else if (callInfo.handler.getRequestStatusMap(FAILED).containsKey(requestId)) { callInfo.rsp.add(RESPONSE_STATUS, FAILED); callInfo.rsp.add(RESPONSE, callInfo.handler.getRequestStatusMap(FAILED).get(requestId).getRspObject()); } else {