Clean up message body generation, update gradle
Change-Id: Ifca9186dc2258826ca001e37ca0aa9d286e995a5
This commit is contained in:
@@ -114,8 +114,8 @@ public class ExnConnector {
|
||||
* Connect to ActiveMQ and activate all publishers and consumers. It is
|
||||
* an error to start the controller more than once.
|
||||
*
|
||||
* @param synchronizer if non-null, a countdown latch that will be signaled
|
||||
* when the connector is stopped by calling {@link
|
||||
* @param synchronizer if non-null, a countdown latch that will be
|
||||
* signaled when the connector is stopped by calling {@link
|
||||
* CountDownLatch#countDown} once.
|
||||
*/
|
||||
public synchronized void start(CountDownLatch synchronizer) {
|
||||
|
@@ -26,15 +26,23 @@ public class SalConnector {
|
||||
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* Get list of node candidates that fulfil the requirements.
|
||||
*
|
||||
* See https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/documentation/nodecandidates-endpoints.md#71--filter-node-candidates-endpoint
|
||||
*
|
||||
* @param requirements The list of requirements.
|
||||
* @param appID The application ID, if available.
|
||||
* @return A list of node candidates, or null in case of error.
|
||||
*/
|
||||
public static List<NodeCandidate> findNodeCandidates(List<Requirement> requirements, String appID) {
|
||||
Map<String, Object> msg = new HashMap<>();
|
||||
Map<String, Object> metadata = new HashMap<>();
|
||||
metadata.put("user", "admin");
|
||||
msg.put("metaData", metadata);
|
||||
Map<String, Object> msg;
|
||||
try {
|
||||
msg.put("body", mapper.writeValueAsString(requirements));
|
||||
msg = Map.of(
|
||||
"metaData", Map.of("user", "admin"),
|
||||
"body", mapper.writeValueAsString(requirements));
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Could not convert requirements list to JSON string", e);
|
||||
log.error("Could not convert requirements list to JSON string (this should never happen)", e);
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> response = ExnConnector.findNodeCandidates.sendSync(msg, appID, null, false);
|
||||
@@ -42,7 +50,7 @@ public class SalConnector {
|
||||
try {
|
||||
return Arrays.asList(mapper.readValue(body, NodeCandidate[].class));
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Error receiving findNodeCandidates result", e);
|
||||
log.error("Error receiving findNodeCandidates result (this should never happen)", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user