This commit is contained in:
parent
c9075bacf8
commit
db90b9a388
1 changed files with 14 additions and 10 deletions
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -115,22 +116,25 @@ public class RegistryController extends AbstractQueueController {
|
||||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_ACCEPTABLE, "Unknown registry status: " + s))
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_ACCEPTABLE, "Unknown registry status: " + s))
|
||||||
.getKey())));
|
.getKey())));
|
||||||
|
|
||||||
Collection<Map<String, Object>> all = pageSize.isPresent() ?
|
AtomicReference<Collection<Map<String, Object>>> all = new AtomicReference<>();
|
||||||
stateLoader.getAllMetaTransformWithPagination(IMDGDistributedNames.Map_Registry,
|
pageIndex.ifPresentOrElse(index -> {
|
||||||
Registry.class,
|
ImdgPredicate filter = predicateBuilder.and(filters.toArray(ImdgPredicate[]::new));
|
||||||
predicateBuilder.and(filters.toArray(ImdgPredicate[]::new)),
|
all.set(stateLoader.getAllMetaTransformWithPagination(IMDGDistributedNames.Map_Registry, Registry.class, filter,
|
||||||
pageSize.get(),
|
index, pageSize.orElse(100)));
|
||||||
pageIndex.orElse(1)) :
|
},
|
||||||
stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_Registry, Registry.class, predicateBuilder.and(filters.toArray(ImdgPredicate[]::new)));
|
() -> {
|
||||||
|
ImdgPredicate filter = predicateBuilder.and(filters.toArray(ImdgPredicate[]::new));
|
||||||
|
all.set(stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_Registry, Registry.class, filter));
|
||||||
|
});
|
||||||
|
|
||||||
sw.stop();
|
sw.stop();
|
||||||
log.info("Info select and format {} data took {} ms", all.size(), sw.getLastTaskTimeMillis());
|
log.info("Info select and format {} data took {} ms", all.get().size(), sw.getLastTaskTimeMillis());
|
||||||
|
|
||||||
sw.start();
|
sw.start();
|
||||||
CommonGetAllResponse response = new CommonGetAllResponse();
|
CommonGetAllResponse response = new CommonGetAllResponse();
|
||||||
response.fromEntity(all);
|
response.fromEntity(all.get());
|
||||||
sw.stop();
|
sw.stop();
|
||||||
log.info("Info select and format {} data {}", all.size(), sw.getLastTaskTimeMillis());
|
log.info("Info select and format {} data {}", all.get().size(), sw.getLastTaskTimeMillis());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue