Search in sources :

Example 6 with ImmutableList

use of com.google_voltpatches.common.collect.ImmutableList in project voltdb by VoltDB.

the class StreamSnapshotRequestConfig method parseStreams.

private ImmutableList<Stream> parseStreams(JSONObject jsData) {
    ImmutableList.Builder<Stream> builder = ImmutableList.builder();
    try {
        JSONArray streamArray = jsData.getJSONArray("streams");
        for (int i = 0; i < streamArray.length(); i++) {
            JSONObject streamObj = streamArray.getJSONObject(i);
            Integer newPartition = null;
            if (!streamObj.isNull("newPartition")) {
                newPartition = Integer.parseInt(streamObj.getString("newPartition"));
            }
            Stream config = new Stream(parseStreamPairs(streamObj), newPartition);
            builder.add(config);
        }
    } catch (JSONException e) {
        SNAP_LOG.warn("Failed to parse stream snapshot request config", e);
    }
    return builder.build();
}
Also used : JSONObject(org.json_voltpatches.JSONObject) ImmutableList(com.google_voltpatches.common.collect.ImmutableList) JSONArray(org.json_voltpatches.JSONArray) JSONException(org.json_voltpatches.JSONException)

Aggregations

ImmutableList (com.google_voltpatches.common.collect.ImmutableList)6 Type (java.lang.reflect.Type)2 ByteBuffer (java.nio.ByteBuffer)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)2 JSONException (org.json_voltpatches.JSONException)2 JSONObject (org.json_voltpatches.JSONObject)2 BinaryPayloadMessage (org.voltcore.messaging.BinaryPayloadMessage)2 ZKUtil (org.voltcore.zk.ZKUtil)2 CatalogMap (org.voltdb.catalog.CatalogMap)2 ImmutableMap (com.google_voltpatches.common.collect.ImmutableMap)1 File (java.io.File)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 GenericArrayType (java.lang.reflect.GenericArrayType)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 TypeVariable (java.lang.reflect.TypeVariable)1