Package org.json_voltpatches

Examples of org.json_voltpatches.JSONArray


            newPartitionCount = jo.getInt("newPartitionCount");
            catalogCrc = jo.getLong("catalogCrc");
            hostId = jo.getInt("hostId");
            instanceId = new InstanceId(jo.getJSONObject("instanceId"));

            JSONArray tables = jo.getJSONArray("tables");
            int cnt = tables.length();
            for (int i=0; i < cnt; i++) {
                JSONObject tableEntry = tables.getJSONObject(i);
                String name = tableEntry.getString("name");
                JSONArray jsonPartitions = tableEntry.getJSONArray("partitions");
                Set<Integer> partSet = new HashSet<Integer>();
                int partCnt = jsonPartitions.length();
                for (int j=0; j < partCnt; j++) {
                    int p = jsonPartitions.getInt(j);
                    partSet.add(p);
                }
                partitions.put(name, partSet);
            }
            JSONObject jsonPtoTxnId = jo.getJSONObject("partitionToTxnId");
            @SuppressWarnings("unchecked")
            Iterator<String> it = jsonPtoTxnId.keys();
            while (it.hasNext()) {
                 String key = it.next();
                 Long val = jsonPtoTxnId.getLong(key);
                 partitionToTxnId.put(Integer.valueOf(key), val);
            }
            JSONArray jdt = jo.getJSONArray("digestTables");
            for (int i = 0; i < jdt.length(); i++) {
                digestTables.add(jdt.getString(i));
            }
            JSONArray ft = jo.getJSONArray("fileTables");
            for (int i = 0; i < ft.length(); i++) {
                fileTables.add(ft.getString(i));
            }
        }
View Full Code Here


        // which has successfully overridden it.
        int masterHostId = -1;
        if (m_state.get() == AppointerState.CLUSTER_START) {
            try {
                // find master in topo
                JSONArray parts = m_topo.getJSONArray("partitions");
                for (int p = 0; p < parts.length(); p++) {
                    JSONObject aPartition = parts.getJSONObject(p);
                    int pid = aPartition.getInt("partition_id");
                    if (pid == partitionId) {
                        masterHostId = aPartition.getInt("master");
                    }
                }
View Full Code Here

        try {
            byte[] data = m_zk.getData(VoltZK.lastKnownLiveNodes, false, null);
            String jsonString = new String(data, "UTF-8");
            tmLog.debug("Read prior known live nodes: " + jsonString);
            JSONObject jsObj = new JSONObject(jsonString);
            JSONArray jsonNodes = jsObj.getJSONArray("liveNodes");
            for (int ii = 0; ii < jsonNodes.length(); ii++) {
                nodes.add(jsonNodes.getInt(ii));
            }
        } catch (Exception e) {
            VoltDB.crashLocalVoltDB("Unable to read prior known live nodes at ZK path: " +
                    VoltZK.lastKnownLiveNodes, true, e);
        }
View Full Code Here

                }
                // ENG-3166: Eventually we would like to get rid of the extra replicas beyond k_factor,
                // but for now we just look to see how many replicas of this partition we actually expect
                // and gate leader assignment on that many copies showing up.
                int replicaCount = m_kfactor + 1;
                JSONArray parts;
                try {
                    parts = m_topo.getJSONArray("partitions");
                    for (int p = 0; p < parts.length(); p++) {
                        JSONObject aPartition = parts.getJSONObject(p);
                        int pid = aPartition.getInt("partition_id");
                        if (pid == m_partitionId) {
                            replicaCount = aPartition.getJSONArray("replicas").length();
                        }
                    }
View Full Code Here

    }

    @Override
    protected void loadFromJSONObject(JSONObject obj) throws JSONException {
        m_hashColumn = obj.getInt(Members.HASH_COLUMN.name());
        JSONArray array = obj.getJSONArray(Members.RANGES.name());
        ImmutableSortedMap.Builder<Integer, Integer> b = ImmutableSortedMap.naturalOrder();
        for (int ii = 0; ii < array.length(); ii++) {
            JSONObject range = array.getJSONObject(ii);
            b.put(range.getInt(Members.RANGE_START.name()), range.getInt(Members.RANGE_END.name()));
        }
        m_ranges = b.build();
    }
View Full Code Here

                m_tableName = obj.getString("tableName");
                m_isReplicated = obj.getBoolean("isReplicated");
                m_isCompressed = obj.optBoolean("isCompressed", false);
                m_checksumType = ChecksumType.valueOf(obj.optString("checksumType", "CRC32"));
                if (!m_isReplicated) {
                    JSONArray partitionIds = obj.getJSONArray("partitionIds");
                    m_partitionIds = new int[partitionIds.length()];
                    for (int ii = 0; ii < m_partitionIds.length; ii++) {
                        m_partitionIds[ii] = partitionIds.getInt(ii);
                    }

                    if (!m_completed) {
                        for (Integer partitionId : m_partitionIds) {
                            m_corruptedPartitions.add(partitionId);
View Full Code Here

TOP

Related Classes of org.json_voltpatches.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.