Search in sources :

Example 1 with BalancePartitionsRequest

use of org.voltdb.sysprocs.BalancePartitionsRequest in project voltdb by VoltDB.

the class MpScheduler method getBalancePartitions.

/**
     * Extract the two involved partitions from the @BalancePartitions request.
     */
private Set<Integer> getBalancePartitions(Iv2InitiateTaskMessage msg) {
    try {
        JSONObject jsObj = new JSONObject((String) msg.getParameters()[0]);
        BalancePartitionsRequest request = new BalancePartitionsRequest(jsObj);
        return Sets.newHashSet(request.partitionPairs.get(0).srcPartition, request.partitionPairs.get(0).destPartition);
    } catch (JSONException e) {
        hostLog.warn("Unable to determine partitions for @BalancePartitions", e);
        return null;
    }
}
Also used : JSONObject(org.json_voltpatches.JSONObject) JSONException(org.json_voltpatches.JSONException) BalancePartitionsRequest(org.voltdb.sysprocs.BalancePartitionsRequest)

Aggregations

JSONException (org.json_voltpatches.JSONException)1 JSONObject (org.json_voltpatches.JSONObject)1 BalancePartitionsRequest (org.voltdb.sysprocs.BalancePartitionsRequest)1